aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/admin_public_body_controller_spec.rb8
-rw-r--r--spec/controllers/admin_request_controller_spec.rb4
-rw-r--r--spec/controllers/admin_track_controller_spec.rb2
-rw-r--r--spec/controllers/admin_user_controller_spec.rb2
-rw-r--r--spec/controllers/comment_controller_spec.rb2
-rw-r--r--spec/controllers/general_controller_spec.rb26
-rw-r--r--spec/controllers/public_body_controller_spec.rb23
-rw-r--r--spec/controllers/request_controller_spec.rb59
-rw-r--r--spec/controllers/request_game_controller_spec.rb2
-rw-r--r--spec/controllers/track_controller_spec.rb8
-rw-r--r--spec/controllers/user_controller_spec.rb7
11 files changed, 84 insertions, 59 deletions
diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb
index 0a90cd64b..22af3df80 100644
--- a/spec/controllers/admin_public_body_controller_spec.rb
+++ b/spec/controllers/admin_public_body_controller_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe AdminPublicBodyController, "when administering public bodies" do
integrate_views
- fixtures :public_bodies, :public_body_translations
+ 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', '')
@@ -57,7 +57,7 @@ end
describe AdminPublicBodyController, "when administering public bodies and paying attention to authentication" do
integrate_views
- fixtures :public_bodies, :public_body_translations
+ 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"] = ""
@@ -107,7 +107,7 @@ end
describe AdminPublicBodyController, "when administering public bodies with i18n" do
integrate_views
- fixtures :public_bodies, :public_body_translations
+ 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', '')
@@ -176,7 +176,7 @@ end
describe AdminPublicBodyController, "when creating public bodies with i18n" do
integrate_views
- fixtures :public_bodies, :public_body_translations
+ 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', '')
diff --git a/spec/controllers/admin_request_controller_spec.rb b/spec/controllers/admin_request_controller_spec.rb
index 6f9af0525..635d73b9e 100644
--- a/spec/controllers/admin_request_controller_spec.rb
+++ b/spec/controllers/admin_request_controller_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe AdminRequestController, "when administering requests" do
integrate_views
- fixtures :info_requests, :outgoing_messages, :users, :info_request_events, :public_bodies, :public_body_translations
+ fixtures :users, :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before { basic_auth_login @request }
it "shows the index/list page" do
@@ -41,7 +41,7 @@ end
describe AdminRequestController, "when administering the holding pen" do
integrate_views
- fixtures :info_requests, :incoming_messages, :raw_emails, :users, :public_bodies, :public_body_translations
+ fixtures :users, :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
basic_auth_login @request
load_raw_emails_data(raw_emails)
diff --git a/spec/controllers/admin_track_controller_spec.rb b/spec/controllers/admin_track_controller_spec.rb
index 4d5b0ac5e..b87ee9f0e 100644
--- a/spec/controllers/admin_track_controller_spec.rb
+++ b/spec/controllers/admin_track_controller_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe AdminTrackController, "when administering tracks" do
integrate_views
- fixtures :track_things, :users
+ fixtures :users, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "shows the list page" do
get :list
diff --git a/spec/controllers/admin_user_controller_spec.rb b/spec/controllers/admin_user_controller_spec.rb
index 313f3f328..b2b2d0626 100644
--- a/spec/controllers/admin_user_controller_spec.rb
+++ b/spec/controllers/admin_user_controller_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe AdminUserController, "when administering users" do
integrate_views
- fixtures :users
+ fixtures :users, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before { basic_auth_login @request }
it "shows the index/list page" do
diff --git a/spec/controllers/comment_controller_spec.rb b/spec/controllers/comment_controller_spec.rb
index 2b0f5eee2..4c14b8d24 100644
--- a/spec/controllers/comment_controller_spec.rb
+++ b/spec/controllers/comment_controller_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe CommentController, "when commenting on a request" do
integrate_views
- fixtures :info_requests, :outgoing_messages, :public_bodies, :public_body_translations, :users, :comments
+ fixtures :users, :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "should give an error and render 'new' template when body text is just some whitespace" do
post :new, :url_title => info_requests(:naughty_chicken_request).url_title,
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index 1ffbda90d..40a676d61 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -2,15 +2,19 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe GeneralController, "when searching" do
integrate_views
- fixtures [ :info_requests,
- :info_request_events,
- :public_bodies,
- :public_body_translations,
- :users,
- :raw_emails,
- :outgoing_messages,
- :incoming_messages,
- :comments ]
+ 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(:each) do
load_raw_emails_data(raw_emails)
@@ -70,13 +74,13 @@ describe GeneralController, "when searching" do
describe "when using different locale settings" do
home_link_regex = /href=".*\/en"/
it "should generate URLs with a locale prepended when there's more than one locale set" do
- ActionController::Routing::Routes.add_filters(['conditionallyprependlocale'])
+ ActionController::Routing::Routes.add_filters('conditionallyprependlocale')
get :frontpage
response.should have_text(home_link_regex)
end
it "should generate URLs without a locale prepended when there's only one locale set" do
- ActionController::Routing::Routes.add_filters(['conditionallyprependlocale'])
+ ActionController::Routing::Routes.add_filters('conditionallyprependlocale')
old_available_locales = FastGettext.default_available_locales
available_locales = ['en']
FastGettext.default_available_locales = available_locales
diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb
index c5c9d60e1..53e6c169a 100644
--- a/spec/controllers/public_body_controller_spec.rb
+++ b/spec/controllers/public_body_controller_spec.rb
@@ -4,7 +4,7 @@ require 'json'
describe PublicBodyController, "when showing a body" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :public_body_versions
+ 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 "should be successful" do
get :show, :url_name => "dfh", :view => 'all'
@@ -61,13 +61,26 @@ end
describe PublicBodyController, "when listing bodies" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :public_body_versions
+ 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 "should be successful" do
get :list
response.should be_success
end
+ it "should list all bodies even when there are no translations for selected locale" do
+ PublicBody.with_locale(:es) do
+
+ spanish_only = PublicBody.new(:name => 'Spanish only',
+ :short_name => 'SO',
+ :request_email => 'spanish@flourish.org',
+ :last_edit_editor => 'test',
+ :last_edit_comment => '')
+ end
+ get :list
+ assigns[:public_bodies].length.should == 3
+ end
+
it "should list bodies in alphabetical order" do
get :list
@@ -110,7 +123,7 @@ describe PublicBodyController, "when listing bodies" do
get :list, :tag => "other"
response.should render_template('list')
assigns[:public_bodies].should == [ public_bodies(:geraldine_public_body) ]
-
+
get :list
response.should render_template('list')
assigns[:public_bodies].count.should == 2
@@ -142,7 +155,7 @@ end
describe PublicBodyController, "when showing JSON version for API" do
- fixtures :public_bodies, :public_body_translations
+ 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 "should be successful" do
get :show, :url_name => "dfh", :format => "json", :view => 'all'
@@ -157,7 +170,7 @@ describe PublicBodyController, "when showing JSON version for API" do
end
describe PublicBodyController, "when doing type ahead searches" do
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments
+ 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 "should return nothing for the empty query string" do
get :search_typeahead, :q => ""
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 494713a4a..3420d212e 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -1,9 +1,10 @@
+# -*- coding: utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'json'
describe RequestController, "when listing recent requests" do
- fixtures :info_requests, :outgoing_messages, :users, :info_request_events, :public_bodies, :public_body_translations, :incoming_messages, :raw_emails, :comments
+ fixtures :users, :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
@@ -51,7 +52,7 @@ end
describe RequestController, "when showing one request" do
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating 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 # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
@@ -137,6 +138,13 @@ describe RequestController, "when showing one request" do
response.should have_text(/First hello/)
end
+ it "should convert message body to UTF8" do
+ ir = info_requests(:fancy_dog_request)
+ receive_incoming_mail('iso8859_2_raw_email.email', ir.incoming_email)
+ get :show, :url_title => 'why_do_you_have_such_a_fancy_dog'
+ response.should have_text(/tënde/u)
+ end
+
it "should generate valid HTML verson of plain text attachments " do
ir = info_requests(:fancy_dog_request)
receive_incoming_mail('incoming-request-two-same-name.email', ir.incoming_email)
@@ -232,17 +240,16 @@ describe RequestController, "when showing one request" do
get :download_entire_request, :url_title => title
assigns[:url_path].should have_text(/#{title}.zip$/)
response.location.should have_text(/#{assigns[:url_path]}/)
- assigns[:url_path].should_not == old_path
zipfile = Zip::ZipFile.open(File.join(File.dirname(__FILE__), "../../cache/zips", assigns[:url_path])) { |zipfile|
zipfile.count.should == 4
-zipfile.entries.each {|x| puts x.name}
}
+ assigns[:url_path].should_not == old_path
end
end
end
describe RequestController, "when changing prominence of a request" do
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :info_request_events, :track_things # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
@@ -358,7 +365,7 @@ end
describe RequestController, "when creating a new request" do
integrate_views
- fixtures :info_requests, :outgoing_messages, :public_bodies, :public_body_translations, :users
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
@user = users(:bob_smith_user)
@@ -542,7 +549,7 @@ end
describe RequestController, "when viewing an individual response for reply/followup" do
integrate_views
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating 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 # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
@@ -589,7 +596,7 @@ end
describe RequestController, "when classifying an information request" do
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating 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 # all needed as integrating views
before(:each) do
@dog_request = info_requests(:fancy_dog_request)
@@ -800,7 +807,7 @@ describe RequestController, "when classifying an information request" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /as needing admin/
- mail.from_addrs.to_s.should == @request_owner.name_and_email
+ mail.from_addrs.first.to_s.should == @request_owner.name_and_email
end
it 'should say it is showing advice as to what to do next' do
@@ -925,7 +932,7 @@ end
describe RequestController, "when sending a followup message" do
integrate_views
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating 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 # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
@@ -978,7 +985,7 @@ describe RequestController, "when sending a followup message" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /What a useless response! You suck./
- mail.to_addrs.to_s.should == "FOI Person <foiperson@localhost>"
+ mail.to_addrs.first.to_s.should == "FOI Person <foiperson@localhost>"
response.should redirect_to(:action => 'show', :url_title => info_requests(:fancy_dog_request).url_title)
@@ -1008,7 +1015,7 @@ end
describe RequestController, "sending overdue request alerts" do
integrate_views
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating 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 # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
@@ -1025,7 +1032,7 @@ describe RequestController, "sending overdue request alerts" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /promptly, as normally/
- mail.to_addrs.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email
mail.body =~ /(http:\/\/.*\/c\/(.*))/
mail_url = $1
@@ -1053,7 +1060,7 @@ describe RequestController, "sending overdue request alerts" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /promptly, as normally/
- mail.to_addrs.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email
end
it "should send not actually send the overdue alert if the user is banned" do
@@ -1078,7 +1085,7 @@ describe RequestController, "sending overdue request alerts" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /required by law/
- mail.to_addrs.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email
mail.body =~ /(http:\/\/.*\/c\/(.*))/
mail_url = $1
@@ -1096,7 +1103,7 @@ end
describe RequestController, "sending unclassified new response reminder alerts" do
integrate_views
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating 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 # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
@@ -1109,7 +1116,7 @@ describe RequestController, "sending unclassified new response reminder alerts"
deliveries.size.should == 3 # sufficiently late it sends reminders too
mail = deliveries[0]
mail.body.should =~ /To let us know/
- mail.to_addrs.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
mail.body =~ /(http:\/\/.*\/c\/(.*))/
mail_url = $1
mail_token = $2
@@ -1127,7 +1134,7 @@ end
describe RequestController, "clarification required alerts" do
integrate_views
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating 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 # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -1146,7 +1153,7 @@ describe RequestController, "clarification required alerts" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /asked you to explain/
- mail.to_addrs.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
mail.body =~ /(http:\/\/.*\/c\/(.*))/
mail_url = $1
mail_token = $2
@@ -1181,7 +1188,7 @@ end
describe RequestController, "comment alerts" do
integrate_views
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating 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 # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -1200,7 +1207,7 @@ describe RequestController, "comment alerts" do
deliveries = ActionMailer::Base.deliveries
mail = deliveries[0]
mail.body.should =~ /has annotated your/
- mail.to_addrs.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
mail.body =~ /(http:\/\/.*)/
mail_url = $1
@@ -1243,7 +1250,7 @@ describe RequestController, "comment alerts" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /There are 2 new annotations/
- mail.to_addrs.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
mail.body =~ /(http:\/\/.*)/
mail_url = $1
@@ -1256,7 +1263,7 @@ end
describe RequestController, "when viewing comments" do
integrate_views
- fixtures :users, :raw_emails, :incoming_messages, :info_requests
+ fixtures :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -1279,7 +1286,7 @@ end
describe RequestController, "authority uploads a response from the web interface" do
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:all) do
# domain after the @ is used for authentication of FOI officers, so to test it
@@ -1366,7 +1373,7 @@ end
describe RequestController, "when showing JSON version for API" do
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments
+ 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(:each) do
load_raw_emails_data(raw_emails)
@@ -1386,7 +1393,7 @@ describe RequestController, "when showing JSON version for API" do
end
describe RequestController, "when doing type ahead searches" do
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments
+ 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 "should return nothing for the empty query string" do
get :search_typeahead, :q => ""
diff --git a/spec/controllers/request_game_controller_spec.rb b/spec/controllers/request_game_controller_spec.rb
index 4883bfdd6..cc0808ef3 100644
--- a/spec/controllers/request_game_controller_spec.rb
+++ b/spec/controllers/request_game_controller_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe RequestGameController, "when playing the game" do
- fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating 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 # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
end
diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb
index 435d9a0d3..90d13495f 100644
--- a/spec/controllers/track_controller_spec.rb
+++ b/spec/controllers/track_controller_spec.rb
@@ -36,7 +36,7 @@ end
describe TrackController, "when sending alerts for a track" do
integrate_views
- fixtures :comments, :info_requests, :outgoing_messages, :incoming_messages, :raw_emails, :info_request_events, :users, :track_things, :track_things_sent_emails, :public_bodies, :public_body_translations
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things, :track_things_sent_emails
include LinkToHelper # for main_url
before(:each) do
@@ -58,7 +58,7 @@ describe TrackController, "when sending alerts for a track" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /Alter your subscription/
- mail.to_addrs.to_s.should include(users(:silly_name_user).email)
+ mail.to_addrs.first.to_s.should include(users(:silly_name_user).email)
mail.body =~ /(http:\/\/.*\/c\/(.*))/
mail_url = $1
mail_token = $2
@@ -110,7 +110,7 @@ end
describe TrackController, "when viewing RSS feed for a track" do
integrate_views
- fixtures :info_requests, :outgoing_messages, :incoming_messages, :raw_emails, :info_request_events, :users, :track_things, :comments, :public_bodies, :public_body_translations
+ 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(:each) do
load_raw_emails_data(raw_emails)
@@ -136,7 +136,7 @@ end
describe TrackController, "when viewing JSON version of a track feed" do
integrate_views
- fixtures :info_requests, :outgoing_messages, :incoming_messages, :raw_emails, :info_request_events, :users, :track_things, :comments, :public_bodies, :public_body_translations
+ 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(:each) do
load_raw_emails_data(raw_emails)
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index b4cc0d6e3..399b275a7 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'json'
@@ -7,7 +8,7 @@ require 'json'
describe UserController, "when showing a user" do
integrate_views
- fixtures :users, :outgoing_messages, :incoming_messages, :raw_emails, :info_requests, :info_request_events, :comments, :public_bodies, :public_body_translations
+ fixtures :users, :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -260,8 +261,8 @@ describe UserController, "when sending another user a message" do
mail = deliveries[0]
mail.body.should include("Bob Smith has used #{MySociety::Config.get('SITE_NAME')} to send you the message below")
mail.body.should include("Just a test!")
- #mail.to_addrs.to_s.should == users(:silly_name_user).name_and_email # XXX fix some nastiness with quoting name_and_email
- mail.from_addrs.to_s.should == users(:bob_smith_user).name_and_email
+ #mail.to_addrs.first.to_s.should == users(:silly_name_user).name_and_email # XXX fix some nastiness with quoting name_and_email
+ mail.from_addrs.first.to_s.should == users(:bob_smith_user).name_and_email
end
end