aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/admin_censor_rule_controller_spec.rb2
-rw-r--r--spec/controllers/admin_public_body_controller_spec.rb10
-rw-r--r--spec/controllers/general_controller_spec.rb4
-rw-r--r--spec/controllers/public_body_controller_spec.rb2
-rw-r--r--spec/controllers/request_controller_spec.rb40
-rw-r--r--spec/controllers/services_controller_spec.rb10
-rw-r--r--spec/controllers/user_controller_spec.rb4
7 files changed, 36 insertions, 36 deletions
diff --git a/spec/controllers/admin_censor_rule_controller_spec.rb b/spec/controllers/admin_censor_rule_controller_spec.rb
index a2014808c..b9f936836 100644
--- a/spec/controllers/admin_censor_rule_controller_spec.rb
+++ b/spec/controllers/admin_censor_rule_controller_spec.rb
@@ -585,7 +585,7 @@ describe AdminCensorRuleController, "when making censor rules from the admin int
:replacement => "tofu",
:last_edit_comment => "none"
}
- PurgeRequest.all().first.model_id.should == ir.id
+ PurgeRequest.all.first.model_id.should == ir.id
end
end
diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb
index 035c478bf..1b960ccc3 100644
--- a/spec/controllers/admin_public_body_controller_spec.rb
+++ b/spec/controllers/admin_public_body_controller_spec.rb
@@ -651,17 +651,17 @@ describe AdminPublicBodyController, "when administering public bodies and paying
render_views
before do
- config = MySociety::Config.load_default()
+ config = MySociety::Config.load_default
config['SKIP_ADMIN_AUTH'] = false
basic_auth_login @request
end
after do
- config = MySociety::Config.load_default()
+ config = MySociety::Config.load_default
config['SKIP_ADMIN_AUTH'] = true
end
def setup_emergency_credentials(username, password)
- config = MySociety::Config.load_default()
+ config = MySociety::Config.load_default
config['SKIP_ADMIN_AUTH'] = false
config['ADMIN_USERNAME'] = username
config['ADMIN_PASSWORD'] = password
@@ -678,7 +678,7 @@ describe AdminPublicBodyController, "when administering public bodies and paying
end
it "skips admin authorisation when SKIP_ADMIN_AUTH set" do
- config = MySociety::Config.load_default()
+ config = MySociety::Config.load_default
config['SKIP_ADMIN_AUTH'] = true
@request.env["HTTP_AUTHORIZATION"] = ""
n = PublicBody.count
@@ -758,7 +758,7 @@ describe AdminPublicBodyController, "when administering public bodies and paying
end
it 'returns the REMOTE_USER value from the request environment when skipping admin auth' do
- config = MySociety::Config.load_default()
+ config = MySociety::Config.load_default
config['SKIP_ADMIN_AUTH'] = true
@request.env["HTTP_AUTHORIZATION"] = ""
@request.env["REMOTE_USER"] = "i_am_admin"
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index d466625b7..495624403 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -112,7 +112,7 @@ describe GeneralController, "when showing the frontpage" do
it "should render the front page with default language and ignore the browser setting" do
- config = MySociety::Config.load_default()
+ config = MySociety::Config.load_default
config['USE_DEFAULT_BROWSER_LANGUAGE'] = false
accept_language = "en-GB,en-US;q=0.8,en;q=0.6"
request.env['HTTP_ACCEPT_LANGUAGE'] = accept_language
@@ -123,7 +123,7 @@ describe GeneralController, "when showing the frontpage" do
end
it "should render the front page with browser-selected language when there's no default set" do
- config = MySociety::Config.load_default()
+ config = MySociety::Config.load_default
config['USE_DEFAULT_BROWSER_LANGUAGE'] = true
accept_language = "es-ES,en-GB,en-US;q=0.8,en;q=0.6"
request.env['HTTP_ACCEPT_LANGUAGE'] = accept_language
diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb
index 02e37684c..c5c94a45c 100644
--- a/spec/controllers/public_body_controller_spec.rb
+++ b/spec/controllers/public_body_controller_spec.rb
@@ -336,7 +336,7 @@ end
describe PublicBodyController, "when showing public body statistics" do
it "should render the right template with the right data" do
- config = MySociety::Config.load_default()
+ config = MySociety::Config.load_default
config['MINIMUM_REQUESTS_FOR_STATISTICS'] = 1
config['PUBLIC_BODY_STATISTICS_PAGE'] = true
get :statistics
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index eb4ea5e7d..a5534e9ff 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -40,41 +40,41 @@ describe RequestController, "when changing things that appear on the request pag
it "should purge the downstream cache when mail is received" do
ir = info_requests(:fancy_dog_request)
receive_incoming_mail('incoming-request-plain.email', ir.incoming_email)
- PurgeRequest.all().first.model_id.should == ir.id
+ PurgeRequest.all.first.model_id.should == ir.id
end
it "should purge the downstream cache when a comment is added" do
ir = info_requests(:fancy_dog_request)
new_comment = info_requests(:fancy_dog_request).add_comment('I also love making annotations.', users(:bob_smith_user))
- PurgeRequest.all().first.model_id.should == ir.id
+ PurgeRequest.all.first.model_id.should == ir.id
end
it "should purge the downstream cache when a followup is made" do
session[:user_id] = users(:bob_smith_user).id
ir = info_requests(:fancy_dog_request)
post :show_response, :outgoing_message => { :body => "What a useless response! You suck.", :what_doing => 'normal_sort' }, :id => ir.id, :submitted_followup => 1
- PurgeRequest.all().first.model_id.should == ir.id
+ PurgeRequest.all.first.model_id.should == ir.id
end
it "should purge the downstream cache when the request is categorised" do
ir = info_requests(:fancy_dog_request)
ir.set_described_state('waiting_clarification')
- PurgeRequest.all().first.model_id.should == ir.id
+ PurgeRequest.all.first.model_id.should == ir.id
end
it "should purge the downstream cache when the authority data is changed" do
ir = info_requests(:fancy_dog_request)
ir.public_body.name = "Something new"
ir.public_body.save!
- PurgeRequest.all().map{|x| x.model_id}.should =~ ir.public_body.info_requests.map{|x| x.id}
+ PurgeRequest.all.map{|x| x.model_id}.should =~ ir.public_body.info_requests.map{|x| x.id}
end
it "should purge the downstream cache when the user name is changed" do
ir = info_requests(:fancy_dog_request)
ir.user.name = "Something new"
ir.user.save!
- PurgeRequest.all().map{|x| x.model_id}.should =~ ir.user.info_requests.map{|x| x.id}
+ PurgeRequest.all.map{|x| x.model_id}.should =~ ir.user.info_requests.map{|x| x.id}
end
it "should not purge the downstream cache when non-visible user details are changed" do
ir = info_requests(:fancy_dog_request)
ir.user.hashed_password = "some old hash"
ir.user.save!
- PurgeRequest.all().count.should == 0
+ PurgeRequest.all.count.should == 0
end
it "should purge the downstream cache when censor rules have changed" do
# TODO: really, CensorRules should execute expiry logic as part
@@ -86,17 +86,17 @@ describe RequestController, "when changing things that appear on the request pag
ir = info_requests(:fancy_dog_request)
ir.prominence = 'hidden'
ir.save!
- PurgeRequest.all().first.model_id.should == ir.id
+ PurgeRequest.all.first.model_id.should == ir.id
end
it "should not create more than one entry for any given resource" do
ir = info_requests(:fancy_dog_request)
ir.prominence = 'hidden'
ir.save!
- PurgeRequest.all().count.should == 1
+ PurgeRequest.all.count.should == 1
ir = info_requests(:fancy_dog_request)
ir.prominence = 'hidden'
ir.save!
- PurgeRequest.all().count.should == 1
+ PurgeRequest.all.count.should == 1
end
end
@@ -611,7 +611,7 @@ describe RequestController, "when showing one request" do
it "should censor attachments downloaded as binary" do
ir = info_requests(:fancy_dog_request)
- censor_rule = CensorRule.new()
+ censor_rule = CensorRule.new
censor_rule.text = "Second"
censor_rule.replacement = "Mouse"
censor_rule.last_edit_editor = "unknown"
@@ -632,7 +632,7 @@ describe RequestController, "when showing one request" do
it "should censor with rules on the user (rather than the request)" do
ir = info_requests(:fancy_dog_request)
- censor_rule = CensorRule.new()
+ censor_rule = CensorRule.new
censor_rule.text = "Second"
censor_rule.replacement = "Mouse"
censor_rule.last_edit_editor = "unknown"
@@ -675,7 +675,7 @@ describe RequestController, "when showing one request" do
s.should contain /hello world.txt/m
end
- censor_rule = CensorRule.new()
+ censor_rule = CensorRule.new
# Note that the censor rule applies to the original filename,
# not the display_filename:
censor_rule.text = "hello-world.txt"
@@ -1471,7 +1471,7 @@ describe RequestController, "when classifying an information request" do
it 'should record a classification' do
event = mock_model(InfoRequestEvent)
- @dog_request.stub!(:log_event).with("status_update", anything()).and_return(event)
+ @dog_request.stub!(:log_event).with("status_update", anything).and_return(event)
RequestClassification.should_receive(:create!).with(:user_id => @admin_user.id,
:info_request_event_id => event.id)
post_status('rejected')
@@ -1915,7 +1915,7 @@ describe RequestController, "sending overdue request alerts" do
it "should send an overdue alert mail to creators of overdue requests" do
chicken_request = info_requests(:naughty_chicken_request)
- chicken_request.outgoing_messages[0].last_sent_at = Time.now() - 30.days
+ chicken_request.outgoing_messages[0].last_sent_at = Time.now - 30.days
chicken_request.outgoing_messages[0].save!
RequestMailer.alert_overdue_requests
@@ -1941,7 +1941,7 @@ describe RequestController, "sending overdue request alerts" do
it "should include clause for schools when sending an overdue alert mail to creators of overdue requests" do
chicken_request = info_requests(:naughty_chicken_request)
- chicken_request.outgoing_messages[0].last_sent_at = Time.now() - 30.days
+ chicken_request.outgoing_messages[0].last_sent_at = Time.now - 30.days
chicken_request.outgoing_messages[0].save!
chicken_request.public_body.tag_string = "school"
@@ -1972,7 +1972,7 @@ describe RequestController, "sending overdue request alerts" do
it "should send a very overdue alert mail to creators of very overdue requests" do
chicken_request = info_requests(:naughty_chicken_request)
- chicken_request.outgoing_messages[0].last_sent_at = Time.now() - 60.days
+ chicken_request.outgoing_messages[0].last_sent_at = Time.now - 60.days
chicken_request.outgoing_messages[0].save!
RequestMailer.alert_overdue_requests
@@ -1998,7 +1998,7 @@ describe RequestController, "sending overdue request alerts" do
it "should not resend alerts to people who've already received them" do
chicken_request = info_requests(:naughty_chicken_request)
- chicken_request.outgoing_messages[0].last_sent_at = Time.now() - 60.days
+ chicken_request.outgoing_messages[0].last_sent_at = Time.now - 60.days
chicken_request.outgoing_messages[0].save!
RequestMailer.alert_overdue_requests
chicken_mails = ActionMailer::Base.deliveries.select{|x| x.body =~ /chickens/}
@@ -2011,7 +2011,7 @@ describe RequestController, "sending overdue request alerts" do
it 'should send alerts for requests where the last event forming the initial request is a followup
being sent following a request for clarification' do
chicken_request = info_requests(:naughty_chicken_request)
- chicken_request.outgoing_messages[0].last_sent_at = Time.now() - 60.days
+ chicken_request.outgoing_messages[0].last_sent_at = Time.now - 60.days
chicken_request.outgoing_messages[0].save!
RequestMailer.alert_overdue_requests
chicken_mails = ActionMailer::Base.deliveries.select{|x| x.body =~ /chickens/}
@@ -2048,7 +2048,7 @@ describe RequestController, "sending overdue request alerts" do
chicken_mails.size.should == 1
# Make the followup older
- outgoing_message.last_sent_at = Time.now() - 60.days
+ outgoing_message.last_sent_at = Time.now - 60.days
outgoing_message.save!
# Now it should be alerted on
diff --git a/spec/controllers/services_controller_spec.rb b/spec/controllers/services_controller_spec.rb
index d4a3e5939..6ab527bc9 100644
--- a/spec/controllers/services_controller_spec.rb
+++ b/spec/controllers/services_controller_spec.rb
@@ -9,7 +9,7 @@ describe ServicesController, "when returning a message for people in other count
# store and restore the locale in the context of the test suite to isolate
# changes made in these tests
before do
- @old_locale = FastGettext.locale()
+ @old_locale = FastGettext.locale
end
it 'keeps the flash' do
@@ -21,7 +21,7 @@ describe ServicesController, "when returning a message for people in other count
end
it "should show no alaveteli message when in the deployed country" do
- config = MySociety::Config.load_default()
+ config = MySociety::Config.load_default
config['ISO_COUNTRY_CODE'] = "DE"
controller.stub!(:country_from_ip).and_return('DE')
get :other_country_message
@@ -29,7 +29,7 @@ describe ServicesController, "when returning a message for people in other count
end
it "should show an alaveteli message when not in the deployed country and in a country with no FOI website" do
- config = MySociety::Config.load_default()
+ config = MySociety::Config.load_default
config['ISO_COUNTRY_CODE'] = "DE"
controller.stub!(:country_from_ip).and_return('ZZ')
get :other_country_message
@@ -37,7 +37,7 @@ describe ServicesController, "when returning a message for people in other count
end
it "should show link to other FOI website when not in the deployed country" do
- config = MySociety::Config.load_default()
+ config = MySociety::Config.load_default
config['ISO_COUNTRY_CODE'] = "ZZ"
controller.stub!(:country_from_ip).and_return('ES')
request.env['HTTP_ACCEPT_LANGUAGE'] = "es"
@@ -60,7 +60,7 @@ describe ServicesController, "when returning a message for people in other count
end
it "should return the 'another country' message if the service responds OK" do
- config = MySociety::Config.load_default()
+ config = MySociety::Config.load_default
config['ISO_COUNTRY_CODE'] = "DE"
AlaveteliConfiguration.stub!(:gaze_url).and_return('http://denmark.com')
FakeWeb.register_uri(:get, %r|denmark.com|, :body => "DK")
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index 2d3b36f70..fb03615f8 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -76,11 +76,11 @@ describe UserController, "when redirecting a show request to a canonical url" do
end
it 'should not redirect a long canonical name that has a numerical suffix' do
- User.stub!(:find).with(:first, anything()).and_return(mock_model(User,
+ User.stub!(:find).with(:first, anything).and_return(mock_model(User,
:url_name => 'bob_smithbob_smithbob_smithbob_s_2',
:name => 'Bob Smith Bob Smith Bob Smith Bob Smith',
:info_requests => []))
- User.stub!(:find).with(:all, anything()).and_return([])
+ User.stub!(:find).with(:all, anything).and_return([])
get :show, :url_name => 'bob_smithbob_smithbob_smithbob_s_2'
response.should be_success
end