diff options
Diffstat (limited to 'spec')
75 files changed, 2204 insertions, 0 deletions
diff --git a/spec/controllers/alerts_controller_spec.rb b/spec/controllers/alerts_controller_spec.rb new file mode 100644 index 0000000..82b031b --- /dev/null +++ b/spec/controllers/alerts_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe AlertsController do + + # This should return the minimal set of attributes required to create a valid + # Alert. As you add validations to Alert, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "author" => "" } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # AlertsController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all alerts as @alerts" do + alert = Alert.create! valid_attributes + get :index, {}, valid_session + assigns(:alerts).should eq([alert]) + end + end + + describe "GET show" do + it "assigns the requested alert as @alert" do + alert = Alert.create! valid_attributes + get :show, {:id => alert.to_param}, valid_session + assigns(:alert).should eq(alert) + end + end + + describe "GET new" do + it "assigns a new alert as @alert" do + get :new, {}, valid_session + assigns(:alert).should be_a_new(Alert) + end + end + + describe "GET edit" do + it "assigns the requested alert as @alert" do + alert = Alert.create! valid_attributes + get :edit, {:id => alert.to_param}, valid_session + assigns(:alert).should eq(alert) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Alert" do + expect { + post :create, {:alert => valid_attributes}, valid_session + }.to change(Alert, :count).by(1) + end + + it "assigns a newly created alert as @alert" do + post :create, {:alert => valid_attributes}, valid_session + assigns(:alert).should be_a(Alert) + assigns(:alert).should be_persisted + end + + it "redirects to the created alert" do + post :create, {:alert => valid_attributes}, valid_session + response.should redirect_to(Alert.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved alert as @alert" do + # Trigger the behavior that occurs when invalid params are submitted + Alert.any_instance.stub(:save).and_return(false) + post :create, {:alert => { "author" => "invalid value" }}, valid_session + assigns(:alert).should be_a_new(Alert) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Alert.any_instance.stub(:save).and_return(false) + post :create, {:alert => { "author" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested alert" do + alert = Alert.create! valid_attributes + # Assuming there are no other alerts in the database, this + # specifies that the Alert created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Alert.any_instance.should_receive(:update).with({ "author" => "" }) + put :update, {:id => alert.to_param, :alert => { "author" => "" }}, valid_session + end + + it "assigns the requested alert as @alert" do + alert = Alert.create! valid_attributes + put :update, {:id => alert.to_param, :alert => valid_attributes}, valid_session + assigns(:alert).should eq(alert) + end + + it "redirects to the alert" do + alert = Alert.create! valid_attributes + put :update, {:id => alert.to_param, :alert => valid_attributes}, valid_session + response.should redirect_to(alert) + end + end + + describe "with invalid params" do + it "assigns the alert as @alert" do + alert = Alert.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Alert.any_instance.stub(:save).and_return(false) + put :update, {:id => alert.to_param, :alert => { "author" => "invalid value" }}, valid_session + assigns(:alert).should eq(alert) + end + + it "re-renders the 'edit' template" do + alert = Alert.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Alert.any_instance.stub(:save).and_return(false) + put :update, {:id => alert.to_param, :alert => { "author" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested alert" do + alert = Alert.create! valid_attributes + expect { + delete :destroy, {:id => alert.to_param}, valid_session + }.to change(Alert, :count).by(-1) + end + + it "redirects to the alerts list" do + alert = Alert.create! valid_attributes + delete :destroy, {:id => alert.to_param}, valid_session + response.should redirect_to(alerts_url) + end + end + +end diff --git a/spec/controllers/games_controller_spec.rb b/spec/controllers/games_controller_spec.rb new file mode 100644 index 0000000..ab8b6b2 --- /dev/null +++ b/spec/controllers/games_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe GamesController do + + # This should return the minimal set of attributes required to create a valid + # Game. As you add validations to Game, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "name" => "MyText" } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # GamesController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all games as @games" do + game = Game.create! valid_attributes + get :index, {}, valid_session + assigns(:games).should eq([game]) + end + end + + describe "GET show" do + it "assigns the requested game as @game" do + game = Game.create! valid_attributes + get :show, {:id => game.to_param}, valid_session + assigns(:game).should eq(game) + end + end + + describe "GET new" do + it "assigns a new game as @game" do + get :new, {}, valid_session + assigns(:game).should be_a_new(Game) + end + end + + describe "GET edit" do + it "assigns the requested game as @game" do + game = Game.create! valid_attributes + get :edit, {:id => game.to_param}, valid_session + assigns(:game).should eq(game) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Game" do + expect { + post :create, {:game => valid_attributes}, valid_session + }.to change(Game, :count).by(1) + end + + it "assigns a newly created game as @game" do + post :create, {:game => valid_attributes}, valid_session + assigns(:game).should be_a(Game) + assigns(:game).should be_persisted + end + + it "redirects to the created game" do + post :create, {:game => valid_attributes}, valid_session + response.should redirect_to(Game.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved game as @game" do + # Trigger the behavior that occurs when invalid params are submitted + Game.any_instance.stub(:save).and_return(false) + post :create, {:game => { "name" => "invalid value" }}, valid_session + assigns(:game).should be_a_new(Game) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Game.any_instance.stub(:save).and_return(false) + post :create, {:game => { "name" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested game" do + game = Game.create! valid_attributes + # Assuming there are no other games in the database, this + # specifies that the Game created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Game.any_instance.should_receive(:update).with({ "name" => "MyText" }) + put :update, {:id => game.to_param, :game => { "name" => "MyText" }}, valid_session + end + + it "assigns the requested game as @game" do + game = Game.create! valid_attributes + put :update, {:id => game.to_param, :game => valid_attributes}, valid_session + assigns(:game).should eq(game) + end + + it "redirects to the game" do + game = Game.create! valid_attributes + put :update, {:id => game.to_param, :game => valid_attributes}, valid_session + response.should redirect_to(game) + end + end + + describe "with invalid params" do + it "assigns the game as @game" do + game = Game.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Game.any_instance.stub(:save).and_return(false) + put :update, {:id => game.to_param, :game => { "name" => "invalid value" }}, valid_session + assigns(:game).should eq(game) + end + + it "re-renders the 'edit' template" do + game = Game.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Game.any_instance.stub(:save).and_return(false) + put :update, {:id => game.to_param, :game => { "name" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested game" do + game = Game.create! valid_attributes + expect { + delete :destroy, {:id => game.to_param}, valid_session + }.to change(Game, :count).by(-1) + end + + it "redirects to the games list" do + game = Game.create! valid_attributes + delete :destroy, {:id => game.to_param}, valid_session + response.should redirect_to(games_url) + end + end + +end diff --git a/spec/controllers/main_controller_spec.rb b/spec/controllers/main_controller_spec.rb new file mode 100644 index 0000000..247e21d --- /dev/null +++ b/spec/controllers/main_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe MainController do + +end diff --git a/spec/controllers/matches_controller_spec.rb b/spec/controllers/matches_controller_spec.rb new file mode 100644 index 0000000..1f7adf8 --- /dev/null +++ b/spec/controllers/matches_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe MatchesController do + + # This should return the minimal set of attributes required to create a valid + # Match. As you add validations to Match, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "tournament" => "" } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # MatchesController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all matches as @matches" do + match = Match.create! valid_attributes + get :index, {}, valid_session + assigns(:matches).should eq([match]) + end + end + + describe "GET show" do + it "assigns the requested match as @match" do + match = Match.create! valid_attributes + get :show, {:id => match.to_param}, valid_session + assigns(:match).should eq(match) + end + end + + describe "GET new" do + it "assigns a new match as @match" do + get :new, {}, valid_session + assigns(:match).should be_a_new(Match) + end + end + + describe "GET edit" do + it "assigns the requested match as @match" do + match = Match.create! valid_attributes + get :edit, {:id => match.to_param}, valid_session + assigns(:match).should eq(match) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Match" do + expect { + post :create, {:match => valid_attributes}, valid_session + }.to change(Match, :count).by(1) + end + + it "assigns a newly created match as @match" do + post :create, {:match => valid_attributes}, valid_session + assigns(:match).should be_a(Match) + assigns(:match).should be_persisted + end + + it "redirects to the created match" do + post :create, {:match => valid_attributes}, valid_session + response.should redirect_to(Match.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved match as @match" do + # Trigger the behavior that occurs when invalid params are submitted + Match.any_instance.stub(:save).and_return(false) + post :create, {:match => { "tournament" => "invalid value" }}, valid_session + assigns(:match).should be_a_new(Match) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Match.any_instance.stub(:save).and_return(false) + post :create, {:match => { "tournament" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested match" do + match = Match.create! valid_attributes + # Assuming there are no other matches in the database, this + # specifies that the Match created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Match.any_instance.should_receive(:update).with({ "tournament" => "" }) + put :update, {:id => match.to_param, :match => { "tournament" => "" }}, valid_session + end + + it "assigns the requested match as @match" do + match = Match.create! valid_attributes + put :update, {:id => match.to_param, :match => valid_attributes}, valid_session + assigns(:match).should eq(match) + end + + it "redirects to the match" do + match = Match.create! valid_attributes + put :update, {:id => match.to_param, :match => valid_attributes}, valid_session + response.should redirect_to(match) + end + end + + describe "with invalid params" do + it "assigns the match as @match" do + match = Match.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Match.any_instance.stub(:save).and_return(false) + put :update, {:id => match.to_param, :match => { "tournament" => "invalid value" }}, valid_session + assigns(:match).should eq(match) + end + + it "re-renders the 'edit' template" do + match = Match.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Match.any_instance.stub(:save).and_return(false) + put :update, {:id => match.to_param, :match => { "tournament" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested match" do + match = Match.create! valid_attributes + expect { + delete :destroy, {:id => match.to_param}, valid_session + }.to change(Match, :count).by(-1) + end + + it "redirects to the matches list" do + match = Match.create! valid_attributes + delete :destroy, {:id => match.to_param}, valid_session + response.should redirect_to(matches_url) + end + end + +end diff --git a/spec/controllers/pms_controller_spec.rb b/spec/controllers/pms_controller_spec.rb new file mode 100644 index 0000000..f0822db --- /dev/null +++ b/spec/controllers/pms_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe PmsController do + + # This should return the minimal set of attributes required to create a valid + # Pm. As you add validations to Pm, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "author" => "" } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # PmsController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all pms as @pms" do + pm = Pm.create! valid_attributes + get :index, {}, valid_session + assigns(:pms).should eq([pm]) + end + end + + describe "GET show" do + it "assigns the requested pm as @pm" do + pm = Pm.create! valid_attributes + get :show, {:id => pm.to_param}, valid_session + assigns(:pm).should eq(pm) + end + end + + describe "GET new" do + it "assigns a new pm as @pm" do + get :new, {}, valid_session + assigns(:pm).should be_a_new(Pm) + end + end + + describe "GET edit" do + it "assigns the requested pm as @pm" do + pm = Pm.create! valid_attributes + get :edit, {:id => pm.to_param}, valid_session + assigns(:pm).should eq(pm) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Pm" do + expect { + post :create, {:pm => valid_attributes}, valid_session + }.to change(Pm, :count).by(1) + end + + it "assigns a newly created pm as @pm" do + post :create, {:pm => valid_attributes}, valid_session + assigns(:pm).should be_a(Pm) + assigns(:pm).should be_persisted + end + + it "redirects to the created pm" do + post :create, {:pm => valid_attributes}, valid_session + response.should redirect_to(Pm.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved pm as @pm" do + # Trigger the behavior that occurs when invalid params are submitted + Pm.any_instance.stub(:save).and_return(false) + post :create, {:pm => { "author" => "invalid value" }}, valid_session + assigns(:pm).should be_a_new(Pm) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Pm.any_instance.stub(:save).and_return(false) + post :create, {:pm => { "author" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested pm" do + pm = Pm.create! valid_attributes + # Assuming there are no other pms in the database, this + # specifies that the Pm created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Pm.any_instance.should_receive(:update).with({ "author" => "" }) + put :update, {:id => pm.to_param, :pm => { "author" => "" }}, valid_session + end + + it "assigns the requested pm as @pm" do + pm = Pm.create! valid_attributes + put :update, {:id => pm.to_param, :pm => valid_attributes}, valid_session + assigns(:pm).should eq(pm) + end + + it "redirects to the pm" do + pm = Pm.create! valid_attributes + put :update, {:id => pm.to_param, :pm => valid_attributes}, valid_session + response.should redirect_to(pm) + end + end + + describe "with invalid params" do + it "assigns the pm as @pm" do + pm = Pm.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Pm.any_instance.stub(:save).and_return(false) + put :update, {:id => pm.to_param, :pm => { "author" => "invalid value" }}, valid_session + assigns(:pm).should eq(pm) + end + + it "re-renders the 'edit' template" do + pm = Pm.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Pm.any_instance.stub(:save).and_return(false) + put :update, {:id => pm.to_param, :pm => { "author" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested pm" do + pm = Pm.create! valid_attributes + expect { + delete :destroy, {:id => pm.to_param}, valid_session + }.to change(Pm, :count).by(-1) + end + + it "redirects to the pms list" do + pm = Pm.create! valid_attributes + delete :destroy, {:id => pm.to_param}, valid_session + response.should redirect_to(pms_url) + end + end + +end diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb new file mode 100644 index 0000000..73248fb --- /dev/null +++ b/spec/controllers/search_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe SearchController do + +end diff --git a/spec/controllers/servers_controller_spec.rb b/spec/controllers/servers_controller_spec.rb new file mode 100644 index 0000000..c6f4fa6 --- /dev/null +++ b/spec/controllers/servers_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe ServersController do + + # This should return the minimal set of attributes required to create a valid + # Server. As you add validations to Server, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # ServersController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all servers as @servers" do + server = Server.create! valid_attributes + get :index, {}, valid_session + assigns(:servers).should eq([server]) + end + end + + describe "GET show" do + it "assigns the requested server as @server" do + server = Server.create! valid_attributes + get :show, {:id => server.to_param}, valid_session + assigns(:server).should eq(server) + end + end + + describe "GET new" do + it "assigns a new server as @server" do + get :new, {}, valid_session + assigns(:server).should be_a_new(Server) + end + end + + describe "GET edit" do + it "assigns the requested server as @server" do + server = Server.create! valid_attributes + get :edit, {:id => server.to_param}, valid_session + assigns(:server).should eq(server) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Server" do + expect { + post :create, {:server => valid_attributes}, valid_session + }.to change(Server, :count).by(1) + end + + it "assigns a newly created server as @server" do + post :create, {:server => valid_attributes}, valid_session + assigns(:server).should be_a(Server) + assigns(:server).should be_persisted + end + + it "redirects to the created server" do + post :create, {:server => valid_attributes}, valid_session + response.should redirect_to(Server.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved server as @server" do + # Trigger the behavior that occurs when invalid params are submitted + Server.any_instance.stub(:save).and_return(false) + post :create, {:server => { }}, valid_session + assigns(:server).should be_a_new(Server) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Server.any_instance.stub(:save).and_return(false) + post :create, {:server => { }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested server" do + server = Server.create! valid_attributes + # Assuming there are no other servers in the database, this + # specifies that the Server created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Server.any_instance.should_receive(:update).with({ "these" => "params" }) + put :update, {:id => server.to_param, :server => { "these" => "params" }}, valid_session + end + + it "assigns the requested server as @server" do + server = Server.create! valid_attributes + put :update, {:id => server.to_param, :server => valid_attributes}, valid_session + assigns(:server).should eq(server) + end + + it "redirects to the server" do + server = Server.create! valid_attributes + put :update, {:id => server.to_param, :server => valid_attributes}, valid_session + response.should redirect_to(server) + end + end + + describe "with invalid params" do + it "assigns the server as @server" do + server = Server.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Server.any_instance.stub(:save).and_return(false) + put :update, {:id => server.to_param, :server => { }}, valid_session + assigns(:server).should eq(server) + end + + it "re-renders the 'edit' template" do + server = Server.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Server.any_instance.stub(:save).and_return(false) + put :update, {:id => server.to_param, :server => { }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested server" do + server = Server.create! valid_attributes + expect { + delete :destroy, {:id => server.to_param}, valid_session + }.to change(Server, :count).by(-1) + end + + it "redirects to the servers list" do + server = Server.create! valid_attributes + delete :destroy, {:id => server.to_param}, valid_session + response.should redirect_to(servers_url) + end + end + +end diff --git a/spec/controllers/teams_controller_spec.rb b/spec/controllers/teams_controller_spec.rb new file mode 100644 index 0000000..9c74d89 --- /dev/null +++ b/spec/controllers/teams_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe TeamsController do + + # This should return the minimal set of attributes required to create a valid + # Team. As you add validations to Team, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # TeamsController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all teams as @teams" do + team = Team.create! valid_attributes + get :index, {}, valid_session + assigns(:teams).should eq([team]) + end + end + + describe "GET show" do + it "assigns the requested team as @team" do + team = Team.create! valid_attributes + get :show, {:id => team.to_param}, valid_session + assigns(:team).should eq(team) + end + end + + describe "GET new" do + it "assigns a new team as @team" do + get :new, {}, valid_session + assigns(:team).should be_a_new(Team) + end + end + + describe "GET edit" do + it "assigns the requested team as @team" do + team = Team.create! valid_attributes + get :edit, {:id => team.to_param}, valid_session + assigns(:team).should eq(team) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Team" do + expect { + post :create, {:team => valid_attributes}, valid_session + }.to change(Team, :count).by(1) + end + + it "assigns a newly created team as @team" do + post :create, {:team => valid_attributes}, valid_session + assigns(:team).should be_a(Team) + assigns(:team).should be_persisted + end + + it "redirects to the created team" do + post :create, {:team => valid_attributes}, valid_session + response.should redirect_to(Team.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved team as @team" do + # Trigger the behavior that occurs when invalid params are submitted + Team.any_instance.stub(:save).and_return(false) + post :create, {:team => { }}, valid_session + assigns(:team).should be_a_new(Team) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Team.any_instance.stub(:save).and_return(false) + post :create, {:team => { }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested team" do + team = Team.create! valid_attributes + # Assuming there are no other teams in the database, this + # specifies that the Team created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Team.any_instance.should_receive(:update).with({ "these" => "params" }) + put :update, {:id => team.to_param, :team => { "these" => "params" }}, valid_session + end + + it "assigns the requested team as @team" do + team = Team.create! valid_attributes + put :update, {:id => team.to_param, :team => valid_attributes}, valid_session + assigns(:team).should eq(team) + end + + it "redirects to the team" do + team = Team.create! valid_attributes + put :update, {:id => team.to_param, :team => valid_attributes}, valid_session + response.should redirect_to(team) + end + end + + describe "with invalid params" do + it "assigns the team as @team" do + team = Team.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Team.any_instance.stub(:save).and_return(false) + put :update, {:id => team.to_param, :team => { }}, valid_session + assigns(:team).should eq(team) + end + + it "re-renders the 'edit' template" do + team = Team.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Team.any_instance.stub(:save).and_return(false) + put :update, {:id => team.to_param, :team => { }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested team" do + team = Team.create! valid_attributes + expect { + delete :destroy, {:id => team.to_param}, valid_session + }.to change(Team, :count).by(-1) + end + + it "redirects to the teams list" do + team = Team.create! valid_attributes + delete :destroy, {:id => team.to_param}, valid_session + response.should redirect_to(teams_url) + end + end + +end diff --git a/spec/controllers/tournaments_controller_spec.rb b/spec/controllers/tournaments_controller_spec.rb new file mode 100644 index 0000000..f7b6e19 --- /dev/null +++ b/spec/controllers/tournaments_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe TournamentsController do + + # This should return the minimal set of attributes required to create a valid + # Tournament. As you add validations to Tournament, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "game" => "" } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # TournamentsController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all tournaments as @tournaments" do + tournament = Tournament.create! valid_attributes + get :index, {}, valid_session + assigns(:tournaments).should eq([tournament]) + end + end + + describe "GET show" do + it "assigns the requested tournament as @tournament" do + tournament = Tournament.create! valid_attributes + get :show, {:id => tournament.to_param}, valid_session + assigns(:tournament).should eq(tournament) + end + end + + describe "GET new" do + it "assigns a new tournament as @tournament" do + get :new, {}, valid_session + assigns(:tournament).should be_a_new(Tournament) + end + end + + describe "GET edit" do + it "assigns the requested tournament as @tournament" do + tournament = Tournament.create! valid_attributes + get :edit, {:id => tournament.to_param}, valid_session + assigns(:tournament).should eq(tournament) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Tournament" do + expect { + post :create, {:tournament => valid_attributes}, valid_session + }.to change(Tournament, :count).by(1) + end + + it "assigns a newly created tournament as @tournament" do + post :create, {:tournament => valid_attributes}, valid_session + assigns(:tournament).should be_a(Tournament) + assigns(:tournament).should be_persisted + end + + it "redirects to the created tournament" do + post :create, {:tournament => valid_attributes}, valid_session + response.should redirect_to(Tournament.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved tournament as @tournament" do + # Trigger the behavior that occurs when invalid params are submitted + Tournament.any_instance.stub(:save).and_return(false) + post :create, {:tournament => { "game" => "invalid value" }}, valid_session + assigns(:tournament).should be_a_new(Tournament) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Tournament.any_instance.stub(:save).and_return(false) + post :create, {:tournament => { "game" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested tournament" do + tournament = Tournament.create! valid_attributes + # Assuming there are no other tournaments in the database, this + # specifies that the Tournament created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Tournament.any_instance.should_receive(:update).with({ "game" => "" }) + put :update, {:id => tournament.to_param, :tournament => { "game" => "" }}, valid_session + end + + it "assigns the requested tournament as @tournament" do + tournament = Tournament.create! valid_attributes + put :update, {:id => tournament.to_param, :tournament => valid_attributes}, valid_session + assigns(:tournament).should eq(tournament) + end + + it "redirects to the tournament" do + tournament = Tournament.create! valid_attributes + put :update, {:id => tournament.to_param, :tournament => valid_attributes}, valid_session + response.should redirect_to(tournament) + end + end + + describe "with invalid params" do + it "assigns the tournament as @tournament" do + tournament = Tournament.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Tournament.any_instance.stub(:save).and_return(false) + put :update, {:id => tournament.to_param, :tournament => { "game" => "invalid value" }}, valid_session + assigns(:tournament).should eq(tournament) + end + + it "re-renders the 'edit' template" do + tournament = Tournament.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Tournament.any_instance.stub(:save).and_return(false) + put :update, {:id => tournament.to_param, :tournament => { "game" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested tournament" do + tournament = Tournament.create! valid_attributes + expect { + delete :destroy, {:id => tournament.to_param}, valid_session + }.to change(Tournament, :count).by(-1) + end + + it "redirects to the tournaments list" do + tournament = Tournament.create! valid_attributes + delete :destroy, {:id => tournament.to_param}, valid_session + response.should redirect_to(tournaments_url) + end + end + +end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb new file mode 100644 index 0000000..142455c --- /dev/null +++ b/spec/controllers/users_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe UsersController do + +end diff --git a/spec/helpers/alerts_helper_spec.rb b/spec/helpers/alerts_helper_spec.rb new file mode 100644 index 0000000..812e415 --- /dev/null +++ b/spec/helpers/alerts_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the AlertsHelper. For example: +# +# describe AlertsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe AlertsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/games_helper_spec.rb b/spec/helpers/games_helper_spec.rb new file mode 100644 index 0000000..72addeb --- /dev/null +++ b/spec/helpers/games_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the GamesHelper. For example: +# +# describe GamesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe GamesHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/main_helper_spec.rb b/spec/helpers/main_helper_spec.rb new file mode 100644 index 0000000..9d316c5 --- /dev/null +++ b/spec/helpers/main_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the MainHelper. For example: +# +# describe MainHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe MainHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/matches_helper_spec.rb b/spec/helpers/matches_helper_spec.rb new file mode 100644 index 0000000..271cd00 --- /dev/null +++ b/spec/helpers/matches_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the MatchesHelper. For example: +# +# describe MatchesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe MatchesHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/pms_helper_spec.rb b/spec/helpers/pms_helper_spec.rb new file mode 100644 index 0000000..5ebf709 --- /dev/null +++ b/spec/helpers/pms_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the PmsHelper. For example: +# +# describe PmsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe PmsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/search_helper_spec.rb b/spec/helpers/search_helper_spec.rb new file mode 100644 index 0000000..fabfe99 --- /dev/null +++ b/spec/helpers/search_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the SearchHelper. For example: +# +# describe SearchHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe SearchHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/servers_helper_spec.rb b/spec/helpers/servers_helper_spec.rb new file mode 100644 index 0000000..487d1e4 --- /dev/null +++ b/spec/helpers/servers_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the ServersHelper. For example: +# +# describe ServersHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe ServersHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/teams_helper_spec.rb b/spec/helpers/teams_helper_spec.rb new file mode 100644 index 0000000..9572616 --- /dev/null +++ b/spec/helpers/teams_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the TeamsHelper. For example: +# +# describe TeamsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe TeamsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/tournaments_helper_spec.rb b/spec/helpers/tournaments_helper_spec.rb new file mode 100644 index 0000000..c7eb224 --- /dev/null +++ b/spec/helpers/tournaments_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the TournamentsHelper. For example: +# +# describe TournamentsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe TournamentsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb new file mode 100644 index 0000000..e65fff9 --- /dev/null +++ b/spec/helpers/users_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the UsersHelper. For example: +# +# describe UsersHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe UsersHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/alert_spec.rb b/spec/models/alert_spec.rb new file mode 100644 index 0000000..d7fa4af --- /dev/null +++ b/spec/models/alert_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Alert do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/game_attribute_spec.rb b/spec/models/game_attribute_spec.rb new file mode 100644 index 0000000..200e59b --- /dev/null +++ b/spec/models/game_attribute_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe GameAttribute do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/game_spec.rb b/spec/models/game_spec.rb new file mode 100644 index 0000000..8c56446 --- /dev/null +++ b/spec/models/game_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Game do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/match_spec.rb b/spec/models/match_spec.rb new file mode 100644 index 0000000..86931c9 --- /dev/null +++ b/spec/models/match_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Match do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/pm_spec.rb b/spec/models/pm_spec.rb new file mode 100644 index 0000000..d56845b --- /dev/null +++ b/spec/models/pm_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Pm do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/server_settings_spec.rb b/spec/models/server_settings_spec.rb new file mode 100644 index 0000000..d579746 --- /dev/null +++ b/spec/models/server_settings_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe ServerSettings do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/server_spec.rb b/spec/models/server_spec.rb new file mode 100644 index 0000000..646344a --- /dev/null +++ b/spec/models/server_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Server do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/team_match_pair_spec.rb b/spec/models/team_match_pair_spec.rb new file mode 100644 index 0000000..676c563 --- /dev/null +++ b/spec/models/team_match_pair_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe TeamMatchPair do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/team_spec.rb b/spec/models/team_spec.rb new file mode 100644 index 0000000..666a904 --- /dev/null +++ b/spec/models/team_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Team do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/tournament_option_spec.rb b/spec/models/tournament_option_spec.rb new file mode 100644 index 0000000..501b316 --- /dev/null +++ b/spec/models/tournament_option_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe TournamentOption do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/tournament_spec.rb b/spec/models/tournament_spec.rb new file mode 100644 index 0000000..56c919d --- /dev/null +++ b/spec/models/tournament_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Tournament do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb new file mode 100644 index 0000000..44032b4 --- /dev/null +++ b/spec/models/user_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe User do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/user_team_pair_spec.rb b/spec/models/user_team_pair_spec.rb new file mode 100644 index 0000000..9947368 --- /dev/null +++ b/spec/models/user_team_pair_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe UserTeamPair do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/requests/alerts_spec.rb b/spec/requests/alerts_spec.rb new file mode 100644 index 0000000..03c332a --- /dev/null +++ b/spec/requests/alerts_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Alerts" do + describe "GET /alerts" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get alerts_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/games_spec.rb b/spec/requests/games_spec.rb new file mode 100644 index 0000000..1a84608 --- /dev/null +++ b/spec/requests/games_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Games" do + describe "GET /games" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get games_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/matches_spec.rb b/spec/requests/matches_spec.rb new file mode 100644 index 0000000..250f746 --- /dev/null +++ b/spec/requests/matches_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Matches" do + describe "GET /matches" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get matches_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/pms_spec.rb b/spec/requests/pms_spec.rb new file mode 100644 index 0000000..1862b87 --- /dev/null +++ b/spec/requests/pms_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Pms" do + describe "GET /pms" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get pms_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/servers_spec.rb b/spec/requests/servers_spec.rb new file mode 100644 index 0000000..2a1562e --- /dev/null +++ b/spec/requests/servers_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Servers" do + describe "GET /servers" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get servers_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/teams_spec.rb b/spec/requests/teams_spec.rb new file mode 100644 index 0000000..f0caf7a --- /dev/null +++ b/spec/requests/teams_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Teams" do + describe "GET /teams" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get teams_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/tournaments_spec.rb b/spec/requests/tournaments_spec.rb new file mode 100644 index 0000000..09b4b55 --- /dev/null +++ b/spec/requests/tournaments_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Tournaments" do + describe "GET /tournaments" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get tournaments_path + response.status.should be(200) + end + end +end diff --git a/spec/routing/alerts_routing_spec.rb b/spec/routing/alerts_routing_spec.rb new file mode 100644 index 0000000..9485907 --- /dev/null +++ b/spec/routing/alerts_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe AlertsController do + describe "routing" do + + it "routes to #index" do + get("/alerts").should route_to("alerts#index") + end + + it "routes to #new" do + get("/alerts/new").should route_to("alerts#new") + end + + it "routes to #show" do + get("/alerts/1").should route_to("alerts#show", :id => "1") + end + + it "routes to #edit" do + get("/alerts/1/edit").should route_to("alerts#edit", :id => "1") + end + + it "routes to #create" do + post("/alerts").should route_to("alerts#create") + end + + it "routes to #update" do + put("/alerts/1").should route_to("alerts#update", :id => "1") + end + + it "routes to #destroy" do + delete("/alerts/1").should route_to("alerts#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/games_routing_spec.rb b/spec/routing/games_routing_spec.rb new file mode 100644 index 0000000..3b3ec0c --- /dev/null +++ b/spec/routing/games_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe GamesController do + describe "routing" do + + it "routes to #index" do + get("/games").should route_to("games#index") + end + + it "routes to #new" do + get("/games/new").should route_to("games#new") + end + + it "routes to #show" do + get("/games/1").should route_to("games#show", :id => "1") + end + + it "routes to #edit" do + get("/games/1/edit").should route_to("games#edit", :id => "1") + end + + it "routes to #create" do + post("/games").should route_to("games#create") + end + + it "routes to #update" do + put("/games/1").should route_to("games#update", :id => "1") + end + + it "routes to #destroy" do + delete("/games/1").should route_to("games#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/matches_routing_spec.rb b/spec/routing/matches_routing_spec.rb new file mode 100644 index 0000000..a9f8254 --- /dev/null +++ b/spec/routing/matches_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe MatchesController do + describe "routing" do + + it "routes to #index" do + get("/matches").should route_to("matches#index") + end + + it "routes to #new" do + get("/matches/new").should route_to("matches#new") + end + + it "routes to #show" do + get("/matches/1").should route_to("matches#show", :id => "1") + end + + it "routes to #edit" do + get("/matches/1/edit").should route_to("matches#edit", :id => "1") + end + + it "routes to #create" do + post("/matches").should route_to("matches#create") + end + + it "routes to #update" do + put("/matches/1").should route_to("matches#update", :id => "1") + end + + it "routes to #destroy" do + delete("/matches/1").should route_to("matches#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/pms_routing_spec.rb b/spec/routing/pms_routing_spec.rb new file mode 100644 index 0000000..839b0a9 --- /dev/null +++ b/spec/routing/pms_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe PmsController do + describe "routing" do + + it "routes to #index" do + get("/pms").should route_to("pms#index") + end + + it "routes to #new" do + get("/pms/new").should route_to("pms#new") + end + + it "routes to #show" do + get("/pms/1").should route_to("pms#show", :id => "1") + end + + it "routes to #edit" do + get("/pms/1/edit").should route_to("pms#edit", :id => "1") + end + + it "routes to #create" do + post("/pms").should route_to("pms#create") + end + + it "routes to #update" do + put("/pms/1").should route_to("pms#update", :id => "1") + end + + it "routes to #destroy" do + delete("/pms/1").should route_to("pms#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/servers_routing_spec.rb b/spec/routing/servers_routing_spec.rb new file mode 100644 index 0000000..e514d15 --- /dev/null +++ b/spec/routing/servers_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe ServersController do + describe "routing" do + + it "routes to #index" do + get("/servers").should route_to("servers#index") + end + + it "routes to #new" do + get("/servers/new").should route_to("servers#new") + end + + it "routes to #show" do + get("/servers/1").should route_to("servers#show", :id => "1") + end + + it "routes to #edit" do + get("/servers/1/edit").should route_to("servers#edit", :id => "1") + end + + it "routes to #create" do + post("/servers").should route_to("servers#create") + end + + it "routes to #update" do + put("/servers/1").should route_to("servers#update", :id => "1") + end + + it "routes to #destroy" do + delete("/servers/1").should route_to("servers#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/teams_routing_spec.rb b/spec/routing/teams_routing_spec.rb new file mode 100644 index 0000000..818fa7b --- /dev/null +++ b/spec/routing/teams_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe TeamsController do + describe "routing" do + + it "routes to #index" do + get("/teams").should route_to("teams#index") + end + + it "routes to #new" do + get("/teams/new").should route_to("teams#new") + end + + it "routes to #show" do + get("/teams/1").should route_to("teams#show", :id => "1") + end + + it "routes to #edit" do + get("/teams/1/edit").should route_to("teams#edit", :id => "1") + end + + it "routes to #create" do + post("/teams").should route_to("teams#create") + end + + it "routes to #update" do + put("/teams/1").should route_to("teams#update", :id => "1") + end + + it "routes to #destroy" do + delete("/teams/1").should route_to("teams#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/tournaments_routing_spec.rb b/spec/routing/tournaments_routing_spec.rb new file mode 100644 index 0000000..e4a229c --- /dev/null +++ b/spec/routing/tournaments_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe TournamentsController do + describe "routing" do + + it "routes to #index" do + get("/tournaments").should route_to("tournaments#index") + end + + it "routes to #new" do + get("/tournaments/new").should route_to("tournaments#new") + end + + it "routes to #show" do + get("/tournaments/1").should route_to("tournaments#show", :id => "1") + end + + it "routes to #edit" do + get("/tournaments/1/edit").should route_to("tournaments#edit", :id => "1") + end + + it "routes to #create" do + post("/tournaments").should route_to("tournaments#create") + end + + it "routes to #update" do + put("/tournaments/1").should route_to("tournaments#update", :id => "1") + end + + it "routes to #destroy" do + delete("/tournaments/1").should route_to("tournaments#destroy", :id => "1") + end + + end +end 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 |