From f2b2f12f67e6e6ee3519cf7ffb7ecf653ff1bd7c Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Tue, 9 Apr 2013 17:45:10 +0100 Subject: [PATCH] Delete specs for unused views and controller methods. --- .../authentications_controller_spec.rb | 69 +------------------ spec/helpers/authentications_helper_spec.rb | 15 ---- .../authentications/edit.html.haml_spec.rb | 24 ------- .../authentications/index.html.haml_spec.rb | 11 ++- .../authentications/new.html.haml_spec.rb | 24 ------- .../authentications/show.html.haml_spec.rb | 21 ------ 6 files changed, 6 insertions(+), 158 deletions(-) delete mode 100644 spec/helpers/authentications_helper_spec.rb delete mode 100644 spec/views/authentications/edit.html.haml_spec.rb delete mode 100644 spec/views/authentications/new.html.haml_spec.rb delete mode 100644 spec/views/authentications/show.html.haml_spec.rb diff --git a/spec/controllers/authentications_controller_spec.rb b/spec/controllers/authentications_controller_spec.rb index bb8f53f76..6b37708aa 100644 --- a/spec/controllers/authentications_controller_spec.rb +++ b/spec/controllers/authentications_controller_spec.rb @@ -24,7 +24,7 @@ describe AuthenticationsController do # Authentication. As you add validations to Authentication, be sure to # update the return value of this method accordingly. def valid_attributes - { "member_id" => "1" } + { } end # This should return the minimal set of values that should be in the session @@ -42,29 +42,6 @@ describe AuthenticationsController do end end - describe "GET show" do - it "assigns the requested authentication as @authentication" do - authentication = Authentication.create! valid_attributes - get :show, {:id => authentication.to_param}, valid_session - assigns(:authentication).should eq(authentication) - end - end - - describe "GET new" do - it "assigns a new authentication as @authentication" do - get :new, {}, valid_session - assigns(:authentication).should be_a_new(Authentication) - end - end - - describe "GET edit" do - it "assigns the requested authentication as @authentication" do - authentication = Authentication.create! valid_attributes - get :edit, {:id => authentication.to_param}, valid_session - assigns(:authentication).should eq(authentication) - end - end - describe "POST create" do describe "with valid params" do it "creates a new Authentication" do @@ -102,50 +79,6 @@ describe AuthenticationsController do end end - describe "PUT update" do - describe "with valid params" do - it "updates the requested authentication" do - authentication = Authentication.create! valid_attributes - # Assuming there are no other authentications in the database, this - # specifies that the Authentication created on the previous line - # receives the :update_attributes message with whatever params are - # submitted in the request. - Authentication.any_instance.should_receive(:update_attributes).with({ "member_id" => "1" }) - put :update, {:id => authentication.to_param, :authentication => { "member_id" => "1" }}, valid_session - end - - it "assigns the requested authentication as @authentication" do - authentication = Authentication.create! valid_attributes - put :update, {:id => authentication.to_param, :authentication => valid_attributes}, valid_session - assigns(:authentication).should eq(authentication) - end - - it "redirects to the authentication" do - authentication = Authentication.create! valid_attributes - put :update, {:id => authentication.to_param, :authentication => valid_attributes}, valid_session - response.should redirect_to(authentication) - end - end - - describe "with invalid params" do - it "assigns the authentication as @authentication" do - authentication = Authentication.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Authentication.any_instance.stub(:save).and_return(false) - put :update, {:id => authentication.to_param, :authentication => { "member_id" => "invalid value" }}, valid_session - assigns(:authentication).should eq(authentication) - end - - it "re-renders the 'edit' template" do - authentication = Authentication.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Authentication.any_instance.stub(:save).and_return(false) - put :update, {:id => authentication.to_param, :authentication => { "member_id" => "invalid value" }}, valid_session - response.should render_template("edit") - end - end - end - describe "DELETE destroy" do it "destroys the requested authentication" do authentication = Authentication.create! valid_attributes diff --git a/spec/helpers/authentications_helper_spec.rb b/spec/helpers/authentications_helper_spec.rb deleted file mode 100644 index 1294169a4..000000000 --- a/spec/helpers/authentications_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the AuthenticationsHelper. For example: -# -# describe AuthenticationsHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe AuthenticationsHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/views/authentications/edit.html.haml_spec.rb b/spec/views/authentications/edit.html.haml_spec.rb deleted file mode 100644 index 725f39986..000000000 --- a/spec/views/authentications/edit.html.haml_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'spec_helper' - -describe "authentications/edit" do - before(:each) do - @authentication = assign(:authentication, stub_model(Authentication, - :member_id => 1, - :provider => "MyString", - :uid => "MyString", - :secret => "MyString" - )) - end - - it "renders the edit authentication form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form", :action => authentications_path(@authentication), :method => "post" do - assert_select "input#authentication_member_id", :name => "authentication[member_id]" - assert_select "input#authentication_provider", :name => "authentication[provider]" - assert_select "input#authentication_uid", :name => "authentication[uid]" - assert_select "input#authentication_secret", :name => "authentication[secret]" - end - end -end diff --git a/spec/views/authentications/index.html.haml_spec.rb b/spec/views/authentications/index.html.haml_spec.rb index 5e5748e97..f780966ae 100644 --- a/spec/views/authentications/index.html.haml_spec.rb +++ b/spec/views/authentications/index.html.haml_spec.rb @@ -7,13 +7,13 @@ describe "authentications/index" do :member_id => 1, :provider => "Provider", :uid => "Uid", - :secret => "Secret" + :name => "Name" ), stub_model(Authentication, :member_id => 1, :provider => "Provider", :uid => "Uid", - :secret => "Secret" + :name => "Name" ) ]) end @@ -21,9 +21,8 @@ describe "authentications/index" do it "renders a list of authentications" do render # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "tr>td", :text => 1.to_s, :count => 2 - assert_select "tr>td", :text => "Provider".to_s, :count => 2 - assert_select "tr>td", :text => "Uid".to_s, :count => 2 - assert_select "tr>td", :text => "Secret".to_s, :count => 2 + assert_select ".authentication", :count => 2 + assert_select ".provider", :text => "Provider".to_s, :count => 2 + assert_select ".name", :text => "Name".to_s, :count => 2 end end diff --git a/spec/views/authentications/new.html.haml_spec.rb b/spec/views/authentications/new.html.haml_spec.rb deleted file mode 100644 index 89e54b43d..000000000 --- a/spec/views/authentications/new.html.haml_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'spec_helper' - -describe "authentications/new" do - before(:each) do - assign(:authentication, stub_model(Authentication, - :member_id => 1, - :provider => "MyString", - :uid => "MyString", - :secret => "MyString" - ).as_new_record) - end - - it "renders new authentication form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form", :action => authentications_path, :method => "post" do - assert_select "input#authentication_member_id", :name => "authentication[member_id]" - assert_select "input#authentication_provider", :name => "authentication[provider]" - assert_select "input#authentication_uid", :name => "authentication[uid]" - assert_select "input#authentication_secret", :name => "authentication[secret]" - end - end -end diff --git a/spec/views/authentications/show.html.haml_spec.rb b/spec/views/authentications/show.html.haml_spec.rb deleted file mode 100644 index c0f0c1179..000000000 --- a/spec/views/authentications/show.html.haml_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'spec_helper' - -describe "authentications/show" do - before(:each) do - @authentication = assign(:authentication, stub_model(Authentication, - :member_id => 1, - :provider => "Provider", - :uid => "Uid", - :secret => "Secret" - )) - end - - it "renders attributes in

" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - rendered.should match(/1/) - rendered.should match(/Provider/) - rendered.should match(/Uid/) - rendered.should match(/Secret/) - end -end