diff options
author | Matthew Landauer <matthew@openaustralia.org> | 2013-01-16 19:07:54 +1100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-04-02 15:38:14 +0100 |
commit | 7106744372abce3c00dd326d4bc5d5ce5cac9d78 (patch) | |
tree | 8caaec66039956306291c67af872e1da61b76a86 /spec/controllers/public_body_controller_spec.rb | |
parent | e576ac11a9a9de4f574585d2f05c566d79d8a213 (diff) |
Set locale in controller test by passing parameter in get
Also using I18n.locale to pass the current locale around.
Diffstat (limited to 'spec/controllers/public_body_controller_spec.rb')
-rw-r--r-- | spec/controllers/public_body_controller_spec.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb index 5f4012737..013c56129 100644 --- a/spec/controllers/public_body_controller_spec.rb +++ b/spec/controllers/public_body_controller_spec.rb @@ -43,18 +43,14 @@ describe PublicBodyController, "when showing a body" do :conditions => ["public_body_id = ?", public_bodies(:humpadink_public_body).id]) end - it "should assign the body using different locale from that used for url_name" do - PublicBody.with_locale(:es) do - get :show, {:url_name => "dfh", :view => 'all'} - assigns[:public_body].notes.should == "Baguette" - end + it "should redirect to the canonical name in the chosen locale" do + get :show, {:url_name => "dfh", :view => 'all', :show_locale => "es"} + response.should redirect_to "http://test.host/es/body/edfh" end it "should assign the body using same locale as that used in url_name" do - PublicBody.with_locale(:es) do - get :show, {:url_name => "edfh", :view => 'all'} - assigns[:public_body].notes.should == "Baguette" - end + get :show, {:url_name => "edfh", :view => 'all', :show_locale => "es"} + response.should include_text("Baguette") end it "should redirect use to the relevant locale even when url_name is for a different locale" do |