aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/admin_public_body_controller_spec.rb56
-rw-r--r--spec/controllers/comment_controller_spec.rb2
-rw-r--r--spec/controllers/public_body_controller_spec.rb42
-rw-r--r--spec/controllers/request_controller_spec.rb28
-rw-r--r--spec/controllers/track_controller_spec.rb10
-rw-r--r--spec/controllers/user_controller_spec.rb8
-rw-r--r--spec/fixtures/public_body_translations.yml43
-rw-r--r--spec/models/has_tag_string_tag_spec.rb2
-rw-r--r--spec/models/incoming_message_spec.rb4
-rw-r--r--spec/models/info_request_spec.rb6
-rw-r--r--spec/models/outgoing_mailer_spec.rb4
-rw-r--r--spec/models/public_body_spec.rb4
-rw-r--r--spec/models/request_mailer_spec.rb2
-rw-r--r--spec/models/xapian_spec.rb7
-rw-r--r--spec/spec_helper.rb10
15 files changed, 178 insertions, 50 deletions
diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb
index db2e449f8..a32c27dd9 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
+ fixtures :public_bodies, :public_body_translations
it "shows the index page" do
get :index
@@ -43,3 +43,57 @@ describe AdminPublicBodyController, "when administering public bodies" do
end
+
+describe AdminPublicBodyController, "when administering public bodies with i18n" do
+ integrate_views
+ fixtures :public_bodies, :public_body_translations
+
+ it "shows the index page" do
+ get :index
+ end
+
+ it "searches for 'humpa'" do
+ get :index, {:query => "humpa", :locale => "es"}
+ assigns[:public_bodies].should == [ public_bodies(:humpadink_public_body) ]
+ end
+
+ it "shows a public body" do
+ get :show, {:id => 2, :locale => "es" }
+ end
+
+ it "creates a new public body" do
+ PublicBody.count.should == 2
+ post :create, { :public_body => { :name => "New Quango", :short_name => "", :tag_string => "blah", :request_email => 'newquango@localhost', :last_edit_comment => 'From test code' } }
+ PublicBody.count.should == 3
+ end
+
+ it "edits a public body" do
+ get :edit, {:id => 3, :locale => 'es'}
+ response.body.should include('Baguette')
+ end
+
+ it "saves edits to a public body" do
+ PublicBody.with_locale(:es) do
+ pb = PublicBody.find(id=3)
+ pb.name.should == "El Department for Humpadinking"
+ end
+
+ post :update, { :id => 3, :public_body => { :name => "Renamed", :short_name => "", :tag_string => "some tags", :request_email => 'edited@localhost', :last_edit_comment => 'From test code' }, :locale => "es" }
+ response.flash[:notice].should include('successful')
+ pb = PublicBody.find(public_bodies(:humpadink_public_body).id)
+ PublicBody.with_locale(:es) do
+ pb.name.should == "Renamed"
+ end
+ PublicBody.with_locale(:en) do
+ pb.name.should == "Department for Humpadinking"
+ end
+ end
+
+ it "destroy a public body" do
+ PublicBody.count.should == 2
+ post :destroy, { :id => 3 }
+ PublicBody.count.should == 1
+ end
+
+
+end
diff --git a/spec/controllers/comment_controller_spec.rb b/spec/controllers/comment_controller_spec.rb
index dfa5be73c..2b0f5eee2 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, :users, :comments
+ fixtures :info_requests, :outgoing_messages, :public_bodies, :public_body_translations, :users, :comments
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/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb
index fbab832f6..8b84b89ec 100644
--- a/spec/controllers/public_body_controller_spec.rb
+++ b/spec/controllers/public_body_controller_spec.rb
@@ -4,8 +4,8 @@ require 'json'
describe PublicBodyController, "when showing a body" do
integrate_views
- fixtures :public_bodies, :public_body_versions
-
+ fixtures :public_bodies, :public_body_translations, :public_body_versions
+
it "should be successful" do
get :show, :url_name => "dfh"
response.should be_success
@@ -21,11 +21,28 @@ describe PublicBodyController, "when showing a body" do
assigns[:public_body].should == public_bodies(:humpadink_public_body)
end
+ it "should assign the body using different locale from that used for url_name" do
+ get :show, {:url_name => "dfh", :locale => 'es'}
+ assigns[:public_body].notes.should == "Baguette"
+ end
+
+ it "should assign the body using same locale as that used in url_name" do
+ get :show, {:url_name => "edfh", :locale => 'es'}
+ assigns[:public_body].notes.should == "Baguette"
+ end
+
+ it "should assign the body using same locale as that used in url_name even with wrongly set locale" do
+ PublicBody.with_locale(:en) do
+ get :show, {:url_name => "edfh", :locale => 'es'}
+ response.body.should include('Baguette')
+ end
+ end
+
it "should redirect to newest name if you use historic name of public body in URL" do
get :show, :url_name => "hdink"
response.should redirect_to(:controller => 'public_body', :action => 'show', :url_name => "dfh")
end
-
+
it "should redirect to lower case name if you use mixed case name in URL" do
get :show, :url_name => "dFh"
response.should redirect_to(:controller => 'public_body', :action => 'show', :url_name => "dfh")
@@ -34,8 +51,8 @@ end
describe PublicBodyController, "when listing bodies" do
integrate_views
- fixtures :public_bodies, :public_body_versions
-
+ fixtures :public_bodies, :public_body_translations, :public_body_versions
+
it "should be successful" do
get :list
response.should be_success
@@ -51,6 +68,15 @@ describe PublicBodyController, "when listing bodies" do
assigns[:description].should == "all"
end
+ it "should list bodies in alphabetical order with different locale" do
+ get :list, :locale => "es"
+ response.should render_template('list')
+
+ assigns[:public_bodies].should == [ public_bodies(:geraldine_public_body), public_bodies(:humpadink_public_body) ]
+ assigns[:tag].should == "all"
+ assigns[:description].should == "all"
+ end
+
it "should list a tagged thing on the appropriate list page, and others on the other page, and all still on the all page" do
public_bodies(:humpadink_public_body).tag_string = "foo local_council"
@@ -94,9 +120,9 @@ describe PublicBodyController, "when listing bodies" do
end
describe PublicBodyController, "when showing JSON version for API" do
-
- fixtures :public_bodies
-
+
+ fixtures :public_bodies, :public_body_translations
+
it "should be successful" do
get :show, :url_name => "dfh", :format => "json"
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index cc8513e7f..a543995f6 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -1,3 +1,7 @@
+# £2k p/a
+# talk about margins
+#
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'json'
@@ -34,7 +38,7 @@ end
describe RequestController, "when showing one request" do
- fixtures :info_requests, :info_request_events, :public_bodies, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating views
+ 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
it "should be successful" do
get :show, :url_title => 'why_do_you_have_such_a_fancy_dog'
@@ -183,7 +187,7 @@ describe RequestController, "when showing one request" do
end
describe RequestController, "when changing prominence of a request" do
- fixtures :info_requests, :info_request_events, :public_bodies, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views
+ fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views
it "should not show hidden requests" do
ir = info_requests(:fancy_dog_request)
@@ -268,7 +272,7 @@ end
describe RequestController, "when creating a new request" do
integrate_views
- fixtures :info_requests, :outgoing_messages, :public_bodies, :users
+ fixtures :info_requests, :outgoing_messages, :public_bodies, :public_body_translations, :users
before do
@user = users(:bob_smith_user)
@@ -455,7 +459,7 @@ end
describe RequestController, "when viewing an individual response for reply/followup" do
integrate_views
- fixtures :info_requests, :info_request_events, :public_bodies, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating 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
it "should ask for login if you are logged in as wrong person" do
session[:user_id] = users(:silly_name_user).id
@@ -482,7 +486,7 @@ end
describe RequestController, "when classifying an information request" do
- fixtures :info_requests, :info_request_events, :public_bodies, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating 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
before do
@dog_request = info_requests(:fancy_dog_request)
@@ -800,7 +804,7 @@ end
describe RequestController, "when sending a followup message" do
integrate_views
- fixtures :info_requests, :info_request_events, :public_bodies, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views
+ fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views
it "should require login" do
post :show_response, :outgoing_message => { :body => "What a useless response! You suck.", :what_doing => 'normal_sort' }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_followup => 1
@@ -880,7 +884,7 @@ end
describe RequestController, "sending overdue request alerts" do
integrate_views
- fixtures :info_requests, :info_request_events, :public_bodies, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views
+ fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views
it "should send an overdue alert mail to creators of overdue requests" do
chicken_request = info_requests(:naughty_chicken_request)
@@ -964,7 +968,7 @@ end
describe RequestController, "sending unclassified new response reminder alerts" do
integrate_views
- fixtures :info_requests, :info_request_events, :public_bodies, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating 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
it "should send an alert" do
RequestMailer.alert_new_response_reminders
@@ -991,7 +995,7 @@ end
describe RequestController, "clarification required alerts" do
integrate_views
- fixtures :info_requests, :info_request_events, :public_bodies, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views
+ fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views
it "should send an alert" do
ir = info_requests(:fancy_dog_request)
@@ -1042,7 +1046,7 @@ end
describe RequestController, "comment alerts" do
integrate_views
- fixtures :info_requests, :info_request_events, :public_bodies, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating 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
it "should send an alert (once and once only)" do
# delete ficture comment and make new one, so is in last month (as
@@ -1136,7 +1140,7 @@ end
describe RequestController, "authority uploads a response from the web interface" do
- fixtures :info_requests, :info_request_events, :public_bodies, :users
+ fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users
before(:all) do
# domain after the @ is used for authentication of FOI officers, so to test it
@@ -1223,7 +1227,7 @@ end
describe RequestController, "when showing JSON version for API" do
- fixtures :info_requests, :info_request_events, :public_bodies, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments
+ fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments
it "should return data in JSON form" do
get :show, :url_title => 'why_do_you_have_such_a_fancy_dog', :format => 'json'
diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb
index c31491375..8076d40c2 100644
--- a/spec/controllers/track_controller_spec.rb
+++ b/spec/controllers/track_controller_spec.rb
@@ -35,13 +35,13 @@ end
describe TrackController, "when sending alerts for a track" do
integrate_views
- fixtures :info_requests, :outgoing_messages, :incoming_messages, :raw_emails, :info_request_events, :users, :track_things, :track_things_sent_emails
+ fixtures :info_requests, :outgoing_messages, :incoming_messages, :raw_emails, :info_request_events, :users, :track_things, :track_things_sent_emails, :public_bodies, :public_body_translations
include LinkToHelper # for main_url
-
+
before do
rebuild_xapian_index
end
-
+
it "should send alerts" do
# set the time the comment event happened at to within the last week
ire = info_request_events(:silly_comment_event)
@@ -94,7 +94,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
+ fixtures :info_requests, :outgoing_messages, :incoming_messages, :raw_emails, :info_request_events, :users, :track_things, :comments, :public_bodies, :public_body_translations
before do
rebuild_xapian_index
@@ -119,7 +119,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
+ fixtures :info_requests, :outgoing_messages, :incoming_messages, :raw_emails, :info_request_events, :users, :track_things, :comments, :public_bodies, :public_body_translations
before do
rebuild_xapian_index
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index 9168b0cdd..93ea6de48 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -7,7 +7,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
+ fixtures :users, :outgoing_messages, :incoming_messages, :raw_emails, :info_requests, :info_request_events, :comments, :public_bodies, :public_body_translations
it "should be successful" do
get :show, :url_name => "bob_smith"
@@ -125,7 +125,7 @@ describe UserController, "when signing in" do
# check is right confirmation URL
mail_token.should == post_redirect.email_token
- params_from(:get, mail_path).should == { :controller => 'user', :action => 'confirm', :email_token => mail_token }
+ params_from(:get, mail_path).should == { :controller => 'user', :action => 'confirm', :email_token => mail_token, :locale => "en" }
# check confirmation URL works
session[:user_id].should be_nil
@@ -420,8 +420,8 @@ describe UserController, "when changing email address" do
"signchangeemail"=>{
"old_email"=>"bob@localhost",
"new_email"=>"newbob@localhost"},
- "controller"=>"user"}
-
+ "controller"=>"user",
+ "locale"=>"en"}
post :signchangeemail, post_redirect.post_params
response.should redirect_to(:controller => 'user', :action => 'show', :url_name => 'bob_smith')
diff --git a/spec/fixtures/public_body_translations.yml b/spec/fixtures/public_body_translations.yml
new file mode 100644
index 000000000..b5e947044
--- /dev/null
+++ b/spec/fixtures/public_body_translations.yml
@@ -0,0 +1,43 @@
+geraldine_es_public_body_translation:
+ name: El A Geraldine Quango
+ first_letter: E
+ request_email: geraldine-requests@localhost
+ id: "1"
+ public_body_id: "2"
+ short_name: eTGQ
+ url_name: etgq
+ locale: es
+ notes: ""
+
+geraldine_en_public_body_translation:
+ name: Geraldine Quango
+ first_letter: G
+ request_email: geraldine-requests@localhost
+ id: "2"
+ public_body_id: "2"
+ short_name: TGQ
+ url_name: tgq
+ locale: en
+ notes: ""
+
+humpadink_es_public_body_translation:
+ name: "El Department for Humpadinking"
+ first_letter: E
+ request_email: humpadink-requests@localhost
+ id: "3"
+ public_body_id: "3"
+ short_name: eDfH
+ url_name: edfh
+ locale: es
+ notes: Baguette
+
+humpadink_en_public_body_translation:
+ name: "Department for Humpadinking"
+ first_letter: D
+ request_email: humpadink-requests@localhost
+ id: "4"
+ public_body_id: "3"
+ short_name: DfH
+ url_name: dfh
+ locale: en
+ notes: An albatross told me!!!
diff --git a/spec/models/has_tag_string_tag_spec.rb b/spec/models/has_tag_string_tag_spec.rb
index 9dfcf3daf..ba439acb8 100644
--- a/spec/models/has_tag_string_tag_spec.rb
+++ b/spec/models/has_tag_string_tag_spec.rb
@@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe HasTagString::HasTagStringTag, " when fiddling with tag strings " do
- fixtures :public_bodies
+ fixtures :public_bodies, :public_body_translations
it "should be able to make a new tag and save it" do
@tag = HasTagString::HasTagStringTag.new
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb
index 1e2b21964..abbe94a47 100644
--- a/spec/models/incoming_message_spec.rb
+++ b/spec/models/incoming_message_spec.rb
@@ -109,7 +109,7 @@ describe IncomingMessage, " checking validity to reply to" do
end
describe IncomingMessage, " when censoring data" do
- fixtures :incoming_messages, :raw_emails, :public_bodies, :info_requests, :users
+ fixtures :incoming_messages, :raw_emails, :public_bodies, :public_body_translations, :info_requests, :users
before do
@test_data = "There was a mouse called Stilton, he wished that he was blue."
@@ -199,7 +199,7 @@ describe IncomingMessage, " when censoring data" do
end
describe IncomingMessage, " when censoring whole users" do
- fixtures :incoming_messages, :raw_emails, :public_bodies, :info_requests, :users
+ fixtures :incoming_messages, :raw_emails, :public_bodies, :public_body_translations, :info_requests, :users
before do
@test_data = "There was a mouse called Stilton, he wished that he was blue."
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index 59868f647..00ae218da 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -40,7 +40,7 @@ describe InfoRequest do
describe " when emailing" do
- fixtures :info_requests, :info_request_events, :public_bodies, :users
+ fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users
before do
@info_request = info_requests(:fancy_dog_request)
@@ -120,7 +120,7 @@ describe InfoRequest do
end
describe "when calculating the status" do
- fixtures :info_requests, :info_request_events, :holidays, :public_bodies
+ fixtures :info_requests, :info_request_events, :holidays, :public_bodies, :public_body_translations
before do
@ir = info_requests(:naughty_chicken_request)
@@ -160,7 +160,7 @@ describe InfoRequest do
end
describe "when calculating the status for a school" do
- fixtures :info_requests, :info_request_events, :holidays, :public_bodies
+ fixtures :info_requests, :info_request_events, :holidays, :public_bodies, :public_body_translations
before do
@ir = info_requests(:naughty_chicken_request)
diff --git a/spec/models/outgoing_mailer_spec.rb b/spec/models/outgoing_mailer_spec.rb
index e86f5635c..3073c5ffd 100644
--- a/spec/models/outgoing_mailer_spec.rb
+++ b/spec/models/outgoing_mailer_spec.rb
@@ -4,7 +4,7 @@ describe OutgoingMailer, " when working out follow up addresses" do
# This is done with fixtures as the code is a bit tangled with the way it
# calls TMail. XXX untangle it and make these tests spread out and using
# mocks. Put parts of the tests in spec/lib/tmail_extensions.rb
- fixtures :info_requests, :incoming_messages, :raw_emails, :public_bodies
+ fixtures :info_requests, :incoming_messages, :raw_emails, :public_bodies, :public_body_translations
it "should parse them right" do
ir = info_requests(:fancy_dog_request)
@@ -24,7 +24,7 @@ describe OutgoingMailer, " when working out follow up addresses" do
# check the basic entry in the fixture is fine
OutgoingMailer.name_and_email_for_followup(ir, im).should == "foiperson@localhost"
- OutgoingMailer.name_for_followup(ir, im).should == "The Geraldine Quango"
+ OutgoingMailer.name_for_followup(ir, im).should == "Geraldine Quango"
OutgoingMailer.email_for_followup(ir, im).should == "foiperson@localhost"
end
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index f00138ab3..acfe005e8 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -95,7 +95,7 @@ describe PublicBody, " using machine tags" do
end
describe PublicBody, "when finding_by_tags" do
- fixtures :public_bodies
+ fixtures :public_bodies, :public_body_translations
before do
@geraldine = public_bodies(:geraldine_public_body)
@@ -161,7 +161,7 @@ describe PublicBody, " when saving" do
end
describe PublicBody, "when searching" do
- fixtures :public_bodies, :public_body_versions
+ fixtures :public_bodies, :public_body_translations, :public_body_versions
it "should find by existing url name" do
body = PublicBody.find_by_url_name_with_historic('dfh')
diff --git a/spec/models/request_mailer_spec.rb b/spec/models/request_mailer_spec.rb
index b9e845c1d..a8311e8f8 100644
--- a/spec/models/request_mailer_spec.rb
+++ b/spec/models/request_mailer_spec.rb
@@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe RequestMailer, " when receiving incoming mail" do
- fixtures :info_requests, :incoming_messages, :raw_emails, :users, :public_bodies
+ fixtures :info_requests, :incoming_messages, :raw_emails, :users, :public_bodies, :public_body_translations
it "should append it to the appropriate request" do
ir = info_requests(:fancy_dog_request)
diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb
index 36836d95b..79ffc4839 100644
--- a/spec/models/xapian_spec.rb
+++ b/spec/models/xapian_spec.rb
@@ -34,7 +34,7 @@ describe User, " when indexing users with Xapian" do
end
describe PublicBody, " when indexing public bodies with Xapian" do
- fixtures :public_bodies, :incoming_messages, :outgoing_messages, :raw_emails, :comments
+ fixtures :public_bodies, :public_body_translations, :incoming_messages, :outgoing_messages, :raw_emails, :comments
it "should search index the main name field" do
rebuild_xapian_index
@@ -69,7 +69,7 @@ describe PublicBody, " when indexing public bodies with Xapian" do
end
describe PublicBody, " when indexing requests by body they are to" do
- fixtures :public_bodies, :info_request_events, :info_requests, :raw_emails, :comments
+ fixtures :public_bodies, :public_body_translations, :info_request_events, :info_requests, :raw_emails, :comments
it "should find requests to the body" do
rebuild_xapian_index
@@ -290,7 +290,7 @@ describe InfoRequest, " when indexing requests by tag" do
end
describe PublicBody, " when indexing authorities by tag" do
- fixtures :public_bodies, :incoming_messages, :outgoing_messages, :raw_emails, :comments
+ fixtures :public_bodies, :public_body_translations, :incoming_messages, :outgoing_messages, :raw_emails, :comments
it "should find request by tag, even when changes" do
rebuild_xapian_index
@@ -302,7 +302,6 @@ describe PublicBody, " when indexing authorities by tag" do
xapian_object = InfoRequest.full_search([PublicBody], "tag:mice", 'created_at', true, nil, 100, 1)
xapian_object.results.size.should == 1
xapian_object.results[0][:model] == public_bodies(:geraldine_public_body)
-
xapian_object = InfoRequest.full_search([PublicBody], "tag:mice:3", 'created_at', true, nil, 100, 1)
xapian_object.results.size.should == 1
xapian_object.results[0][:model] == public_bodies(:geraldine_public_body)
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 6439a0f19..87a89f755 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,7 +1,6 @@
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
-RAILS_ENV = "test"
require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment'))
require 'spec/autorun'
require 'spec/rails'
@@ -17,8 +16,6 @@ Spec::Runner.configure do |config|
# If you're not using ActiveRecord you should remove these
# lines, delete config/database.yml and disable :active_record
# in your config/boot.rb
- config.use_transactional_fixtures = true
- config.use_instantiated_fixtures = false
config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
# == Fixtures
@@ -118,6 +115,11 @@ if $tempfilecount.nil?
def process(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
# Call original process function
+ if parameters.nil?
+ parameters = {:locale => "en"}
+ elsif not parameters.has_key?(:locale)
+ parameters[:locale] = "en"
+ end
self.original_process(action, parameters, session, flash, http_method)
# XXX Is there a better way to check this than calling a private method?
@@ -133,4 +135,4 @@ if $tempfilecount.nil?
else
puts "WARNING: HTML validation script " + $html_validation_script + " not found"
end
-end \ No newline at end of file
+end