From e1cefed1365f9ca39ff388a4dd756687387fca2d Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Mon, 30 Jan 2012 11:13:06 +0000 Subject: Fix test failure introduced in commit 24bbaa5afac5ce27c351e3b460be1b0182446ba1 --- spec/controllers/admin_public_body_controller_spec.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'spec/controllers/admin_public_body_controller_spec.rb') diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb index 6954e22a1..9a7c46476 100644 --- a/spec/controllers/admin_public_body_controller_spec.rb +++ b/spec/controllers/admin_public_body_controller_spec.rb @@ -8,8 +8,14 @@ describe AdminPublicBodyController, "when administering public bodies" do username = MySociety::Config.get('ADMIN_USERNAME', '') password = MySociety::Config.get('ADMIN_PASSWORD', '') basic_auth_login @request + + @old_filters = ActionController::Routing::Routes.filters + ActionController::Routing::Routes.filters = RoutingFilter::Chain.new end + after do + ActionController::Routing::Routes.filters = @old_filters + end it "shows the index page" do get :index @@ -198,11 +204,11 @@ describe AdminPublicBodyController, "when creating public bodies with i18n" do @old_filters = ActionController::Routing::Routes.filters ActionController::Routing::Routes.filters = RoutingFilter::Chain.new end + after do ActionController::Routing::Routes.filters = @old_filters end - it "creates a new public body in one locale" do n = PublicBody.count post :create, { :public_body => { :name => "New Quango", :short_name => "", :tag_string => "blah", :request_email => 'newquango@localhost', :last_edit_comment => 'From test code' } } -- cgit v1.2.3 From 8dbc0b891801e1605ae08774eae69f71242808d6 Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Tue, 31 Jan 2012 17:17:13 +1100 Subject: Fixes #393 - Route the mass_assign_tags action so it does what it says on the tin --- spec/controllers/admin_public_body_controller_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/controllers/admin_public_body_controller_spec.rb') diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb index 6954e22a1..a2f458025 100644 --- a/spec/controllers/admin_public_body_controller_spec.rb +++ b/spec/controllers/admin_public_body_controller_spec.rb @@ -61,6 +61,14 @@ describe AdminPublicBodyController, "when administering public bodies" do get :show, :id => 2 session[:using_admin].should == 1 end + + it "mass assigns tags" do + n = PublicBody.count + post :mass_tag_add, { :new_tag => "department", :table_name => "substring" } + response.flash[:notice].should == "Added tag to table of bodies." + response.should redirect_to(:action=>'list') + PublicBody.find_by_tag("department").count.should == n + end end describe AdminPublicBodyController, "when administering public bodies and paying attention to authentication" do -- cgit v1.2.3 From 951b266d2e83ddeee1f096e19d64ce3d46618618 Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Tue, 31 Jan 2012 08:45:03 +0000 Subject: Correct copy-pasto I am not sure why the tests anyway passed with this mistake, but clearly those trailing .should's ought not to have been there. --- spec/controllers/admin_public_body_controller_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/controllers/admin_public_body_controller_spec.rb') diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb index 6954e22a1..261f8b695 100644 --- a/spec/controllers/admin_public_body_controller_spec.rb +++ b/spec/controllers/admin_public_body_controller_spec.rb @@ -70,7 +70,7 @@ describe AdminPublicBodyController, "when administering public bodies and paying it "disallows non-authenticated users to do anything" do @request.env["HTTP_AUTHORIZATION"] = "" - n = PublicBody.count.should + n = PublicBody.count post :destroy, { :id => 3 } response.code.should == "401" PublicBody.count.should == n @@ -105,7 +105,7 @@ describe AdminPublicBodyController, "when administering public bodies and paying config['ADMIN_USERNAME'] = 'biz' config['ADMIN_PASSWORD'] = 'fuz' @request.env["HTTP_AUTHORIZATION"] = "" - n = PublicBody.count.should + n = PublicBody.count basic_auth_login(@request, "baduser", "badpassword") post :destroy, { :id => public_bodies(:forlorn_public_body).id } response.code.should == "401" -- cgit v1.2.3 From ac4587afff81177a0bf86fc0064b81538811cb29 Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Tue, 31 Jan 2012 16:29:04 +0000 Subject: Load all fixtures for all tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ad hoc specification of fixtures has been an ongoing source of bugs in the tests. The straw that broke the camel’s back is that 7c6eb09 requires the fixtures to be loaded in order (i.e. children before their parents), and it would have been a painful process to reorder all the dozens of different fixture lists, but the test system ought to be more reliable this way. --- spec/controllers/admin_public_body_controller_spec.rb | 4 ---- 1 file changed, 4 deletions(-) (limited to 'spec/controllers/admin_public_body_controller_spec.rb') diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb index 7af637c1c..844100d07 100644 --- a/spec/controllers/admin_public_body_controller_spec.rb +++ b/spec/controllers/admin_public_body_controller_spec.rb @@ -2,7 +2,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe AdminPublicBodyController, "when administering public bodies" do integrate_views - fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things before do username = MySociety::Config.get('ADMIN_USERNAME', '') @@ -72,7 +71,6 @@ end describe AdminPublicBodyController, "when administering public bodies and paying attention to authentication" do integrate_views - fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things it "disallows non-authenticated users to do anything" do @request.env["HTTP_AUTHORIZATION"] = "" @@ -125,7 +123,6 @@ end describe AdminPublicBodyController, "when administering public bodies with i18n" do integrate_views - fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things before do username = MySociety::Config.get('ADMIN_USERNAME', '') @@ -194,7 +191,6 @@ end describe AdminPublicBodyController, "when creating public bodies with i18n" do integrate_views - fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things before do username = MySociety::Config.get('ADMIN_USERNAME', '') -- cgit v1.2.3