diff options
author | DavisLWebb <davislwebb@ymail.com> | 2014-03-01 20:24:43 -0500 |
---|---|---|
committer | DavisLWebb <davislwebb@ymail.com> | 2014-03-01 20:24:43 -0500 |
commit | 11be92e4bac671852fd03922049ca592ae4c9f4e (patch) | |
tree | a70875391bbf07448f816800afd6296679fc4c06 /spec/views | |
parent | 2eb242f3e5b1f1ab66d84556cabcad965fe387aa (diff) |
changed the gemfile to include rspecy testing and a security name i cant remember the name of
Diffstat (limited to 'spec/views')
28 files changed, 532 insertions, 0 deletions
diff --git a/spec/views/alerts/edit.html.erb_spec.rb b/spec/views/alerts/edit.html.erb_spec.rb new file mode 100644 index 0000000..d837f26 --- /dev/null +++ b/spec/views/alerts/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "alerts/edit" do + before(:each) do + @alert = assign(:alert, stub_model(Alert, + :author => nil, + :message => "MyText" + )) + end + + it "renders the edit alert form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", alert_path(@alert), "post" do + assert_select "input#alert_author[name=?]", "alert[author]" + assert_select "textarea#alert_message[name=?]", "alert[message]" + end + end +end diff --git a/spec/views/alerts/index.html.erb_spec.rb b/spec/views/alerts/index.html.erb_spec.rb new file mode 100644 index 0000000..a5b4f3c --- /dev/null +++ b/spec/views/alerts/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "alerts/index" do + before(:each) do + assign(:alerts, [ + stub_model(Alert, + :author => nil, + :message => "MyText" + ), + stub_model(Alert, + :author => nil, + :message => "MyText" + ) + ]) + end + + it "renders a list of alerts" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => nil.to_s, :count => 2 + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/alerts/new.html.erb_spec.rb b/spec/views/alerts/new.html.erb_spec.rb new file mode 100644 index 0000000..e38cbd3 --- /dev/null +++ b/spec/views/alerts/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "alerts/new" do + before(:each) do + assign(:alert, stub_model(Alert, + :author => nil, + :message => "MyText" + ).as_new_record) + end + + it "renders new alert form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", alerts_path, "post" do + assert_select "input#alert_author[name=?]", "alert[author]" + assert_select "textarea#alert_message[name=?]", "alert[message]" + end + end +end diff --git a/spec/views/alerts/show.html.erb_spec.rb b/spec/views/alerts/show.html.erb_spec.rb new file mode 100644 index 0000000..267c9f1 --- /dev/null +++ b/spec/views/alerts/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "alerts/show" do + before(:each) do + @alert = assign(:alert, stub_model(Alert, + :author => nil, + :message => "MyText" + )) + end + + it "renders attributes in <p>" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(//) + rendered.should match(/MyText/) + end +end diff --git a/spec/views/games/edit.html.erb_spec.rb b/spec/views/games/edit.html.erb_spec.rb new file mode 100644 index 0000000..d568c90 --- /dev/null +++ b/spec/views/games/edit.html.erb_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe "games/edit" do + before(:each) do + @game = assign(:game, stub_model(Game, + :name => "MyText", + :players_per_team => 1, + :teams_per_match => 1, + :set_rounds => 1, + :randomized_teams => 1 + )) + end + + it "renders the edit game form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", game_path(@game), "post" do + assert_select "textarea#game_name[name=?]", "game[name]" + assert_select "input#game_players_per_team[name=?]", "game[players_per_team]" + assert_select "input#game_teams_per_match[name=?]", "game[teams_per_match]" + assert_select "input#game_set_rounds[name=?]", "game[set_rounds]" + assert_select "input#game_randomized_teams[name=?]", "game[randomized_teams]" + end + end +end diff --git a/spec/views/games/index.html.erb_spec.rb b/spec/views/games/index.html.erb_spec.rb new file mode 100644 index 0000000..3107393 --- /dev/null +++ b/spec/views/games/index.html.erb_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +describe "games/index" do + before(:each) do + assign(:games, [ + stub_model(Game, + :name => "MyText", + :players_per_team => 1, + :teams_per_match => 2, + :set_rounds => 3, + :randomized_teams => 4 + ), + stub_model(Game, + :name => "MyText", + :players_per_team => 1, + :teams_per_match => 2, + :set_rounds => 3, + :randomized_teams => 4 + ) + ]) + end + + it "renders a list of games" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + assert_select "tr>td", :text => 1.to_s, :count => 2 + assert_select "tr>td", :text => 2.to_s, :count => 2 + assert_select "tr>td", :text => 3.to_s, :count => 2 + assert_select "tr>td", :text => 4.to_s, :count => 2 + end +end diff --git a/spec/views/games/new.html.erb_spec.rb b/spec/views/games/new.html.erb_spec.rb new file mode 100644 index 0000000..ebe6113 --- /dev/null +++ b/spec/views/games/new.html.erb_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe "games/new" do + before(:each) do + assign(:game, stub_model(Game, + :name => "MyText", + :players_per_team => 1, + :teams_per_match => 1, + :set_rounds => 1, + :randomized_teams => 1 + ).as_new_record) + end + + it "renders new game form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", games_path, "post" do + assert_select "textarea#game_name[name=?]", "game[name]" + assert_select "input#game_players_per_team[name=?]", "game[players_per_team]" + assert_select "input#game_teams_per_match[name=?]", "game[teams_per_match]" + assert_select "input#game_set_rounds[name=?]", "game[set_rounds]" + assert_select "input#game_randomized_teams[name=?]", "game[randomized_teams]" + end + end +end diff --git a/spec/views/games/show.html.erb_spec.rb b/spec/views/games/show.html.erb_spec.rb new file mode 100644 index 0000000..fb75ad6 --- /dev/null +++ b/spec/views/games/show.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "games/show" do + before(:each) do + @game = assign(:game, stub_model(Game, + :name => "MyText", + :players_per_team => 1, + :teams_per_match => 2, + :set_rounds => 3, + :randomized_teams => 4 + )) + end + + it "renders attributes in <p>" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/MyText/) + rendered.should match(/1/) + rendered.should match(/2/) + rendered.should match(/3/) + rendered.should match(/4/) + end +end diff --git a/spec/views/matches/edit.html.erb_spec.rb b/spec/views/matches/edit.html.erb_spec.rb new file mode 100644 index 0000000..0f7c673 --- /dev/null +++ b/spec/views/matches/edit.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "matches/edit" do + before(:each) do + @match = assign(:match, stub_model(Match, + :tournament => nil + )) + end + + it "renders the edit match form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", match_path(@match), "post" do + assert_select "input#match_tournament[name=?]", "match[tournament]" + end + end +end diff --git a/spec/views/matches/index.html.erb_spec.rb b/spec/views/matches/index.html.erb_spec.rb new file mode 100644 index 0000000..e920f16 --- /dev/null +++ b/spec/views/matches/index.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "matches/index" do + before(:each) do + assign(:matches, [ + stub_model(Match, + :tournament => nil + ), + stub_model(Match, + :tournament => nil + ) + ]) + end + + it "renders a list of matches" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => nil.to_s, :count => 2 + end +end diff --git a/spec/views/matches/new.html.erb_spec.rb b/spec/views/matches/new.html.erb_spec.rb new file mode 100644 index 0000000..c3537dc --- /dev/null +++ b/spec/views/matches/new.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "matches/new" do + before(:each) do + assign(:match, stub_model(Match, + :tournament => nil + ).as_new_record) + end + + it "renders new match form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", matches_path, "post" do + assert_select "input#match_tournament[name=?]", "match[tournament]" + end + end +end diff --git a/spec/views/matches/show.html.erb_spec.rb b/spec/views/matches/show.html.erb_spec.rb new file mode 100644 index 0000000..4460feb --- /dev/null +++ b/spec/views/matches/show.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "matches/show" do + before(:each) do + @match = assign(:match, stub_model(Match, + :tournament => nil + )) + end + + it "renders attributes in <p>" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(//) + end +end diff --git a/spec/views/pms/edit.html.erb_spec.rb b/spec/views/pms/edit.html.erb_spec.rb new file mode 100644 index 0000000..5ec0de5 --- /dev/null +++ b/spec/views/pms/edit.html.erb_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "pms/edit" do + before(:each) do + @pm = assign(:pm, stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + )) + end + + it "renders the edit pm form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", pm_path(@pm), "post" do + assert_select "input#pm_author[name=?]", "pm[author]" + assert_select "input#pm_recipient[name=?]", "pm[recipient]" + assert_select "textarea#pm_message[name=?]", "pm[message]" + end + end +end diff --git a/spec/views/pms/index.html.erb_spec.rb b/spec/views/pms/index.html.erb_spec.rb new file mode 100644 index 0000000..a3bc733 --- /dev/null +++ b/spec/views/pms/index.html.erb_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe "pms/index" do + before(:each) do + assign(:pms, [ + stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + ), + stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + ) + ]) + end + + it "renders a list of pms" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => nil.to_s, :count => 2 + assert_select "tr>td", :text => nil.to_s, :count => 2 + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/pms/new.html.erb_spec.rb b/spec/views/pms/new.html.erb_spec.rb new file mode 100644 index 0000000..342af96 --- /dev/null +++ b/spec/views/pms/new.html.erb_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "pms/new" do + before(:each) do + assign(:pm, stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + ).as_new_record) + end + + it "renders new pm form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", pms_path, "post" do + assert_select "input#pm_author[name=?]", "pm[author]" + assert_select "input#pm_recipient[name=?]", "pm[recipient]" + assert_select "textarea#pm_message[name=?]", "pm[message]" + end + end +end diff --git a/spec/views/pms/show.html.erb_spec.rb b/spec/views/pms/show.html.erb_spec.rb new file mode 100644 index 0000000..5802887 --- /dev/null +++ b/spec/views/pms/show.html.erb_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe "pms/show" do + before(:each) do + @pm = assign(:pm, stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + )) + end + + it "renders attributes in <p>" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(//) + rendered.should match(//) + rendered.should match(/MyText/) + end +end diff --git a/spec/views/servers/edit.html.erb_spec.rb b/spec/views/servers/edit.html.erb_spec.rb new file mode 100644 index 0000000..870126c --- /dev/null +++ b/spec/views/servers/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "servers/edit" do + before(:each) do + @server = assign(:server, stub_model(Server)) + end + + it "renders the edit server form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", server_path(@server), "post" do + end + end +end diff --git a/spec/views/servers/index.html.erb_spec.rb b/spec/views/servers/index.html.erb_spec.rb new file mode 100644 index 0000000..9af4a19 --- /dev/null +++ b/spec/views/servers/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "servers/index" do + before(:each) do + assign(:servers, [ + stub_model(Server), + stub_model(Server) + ]) + end + + it "renders a list of servers" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/servers/new.html.erb_spec.rb b/spec/views/servers/new.html.erb_spec.rb new file mode 100644 index 0000000..bfc69c5 --- /dev/null +++ b/spec/views/servers/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "servers/new" do + before(:each) do + assign(:server, stub_model(Server).as_new_record) + end + + it "renders new server form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", servers_path, "post" do + end + end +end diff --git a/spec/views/servers/show.html.erb_spec.rb b/spec/views/servers/show.html.erb_spec.rb new file mode 100644 index 0000000..3762389 --- /dev/null +++ b/spec/views/servers/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "servers/show" do + before(:each) do + @server = assign(:server, stub_model(Server)) + end + + it "renders attributes in <p>" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/teams/edit.html.erb_spec.rb b/spec/views/teams/edit.html.erb_spec.rb new file mode 100644 index 0000000..1153b6d --- /dev/null +++ b/spec/views/teams/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "teams/edit" do + before(:each) do + @team = assign(:team, stub_model(Team)) + end + + it "renders the edit team form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", team_path(@team), "post" do + end + end +end diff --git a/spec/views/teams/index.html.erb_spec.rb b/spec/views/teams/index.html.erb_spec.rb new file mode 100644 index 0000000..e894f36 --- /dev/null +++ b/spec/views/teams/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "teams/index" do + before(:each) do + assign(:teams, [ + stub_model(Team), + stub_model(Team) + ]) + end + + it "renders a list of teams" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/teams/new.html.erb_spec.rb b/spec/views/teams/new.html.erb_spec.rb new file mode 100644 index 0000000..6a05475 --- /dev/null +++ b/spec/views/teams/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "teams/new" do + before(:each) do + assign(:team, stub_model(Team).as_new_record) + end + + it "renders new team form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", teams_path, "post" do + end + end +end diff --git a/spec/views/teams/show.html.erb_spec.rb b/spec/views/teams/show.html.erb_spec.rb new file mode 100644 index 0000000..1d8ebd5 --- /dev/null +++ b/spec/views/teams/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "teams/show" do + before(:each) do + @team = assign(:team, stub_model(Team)) + end + + it "renders attributes in <p>" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/tournaments/edit.html.erb_spec.rb b/spec/views/tournaments/edit.html.erb_spec.rb new file mode 100644 index 0000000..db7cbb5 --- /dev/null +++ b/spec/views/tournaments/edit.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "tournaments/edit" do + before(:each) do + @tournament = assign(:tournament, stub_model(Tournament, + :game => nil + )) + end + + it "renders the edit tournament form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", tournament_path(@tournament), "post" do + assert_select "input#tournament_game[name=?]", "tournament[game]" + end + end +end diff --git a/spec/views/tournaments/index.html.erb_spec.rb b/spec/views/tournaments/index.html.erb_spec.rb new file mode 100644 index 0000000..bf36e06 --- /dev/null +++ b/spec/views/tournaments/index.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "tournaments/index" do + before(:each) do + assign(:tournaments, [ + stub_model(Tournament, + :game => nil + ), + stub_model(Tournament, + :game => nil + ) + ]) + end + + it "renders a list of tournaments" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => nil.to_s, :count => 2 + end +end diff --git a/spec/views/tournaments/new.html.erb_spec.rb b/spec/views/tournaments/new.html.erb_spec.rb new file mode 100644 index 0000000..49785a4 --- /dev/null +++ b/spec/views/tournaments/new.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "tournaments/new" do + before(:each) do + assign(:tournament, stub_model(Tournament, + :game => nil + ).as_new_record) + end + + it "renders new tournament form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", tournaments_path, "post" do + assert_select "input#tournament_game[name=?]", "tournament[game]" + end + end +end diff --git a/spec/views/tournaments/show.html.erb_spec.rb b/spec/views/tournaments/show.html.erb_spec.rb new file mode 100644 index 0000000..abb1879 --- /dev/null +++ b/spec/views/tournaments/show.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "tournaments/show" do + before(:each) do + @tournament = assign(:tournament, stub_model(Tournament, + :game => nil + )) + end + + it "renders attributes in <p>" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(//) + end +end |