diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-01-14 15:34:55 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-01-14 15:34:55 +0000 |
commit | 09a7180b3f5ddbed54da23a6985fff196cc36af2 (patch) | |
tree | 8284d33e672289edc8931776cc7f08c29492b830 /spec/models | |
parent | 425c2c90c4515bb6b26cee1e8748f68796b2dc26 (diff) | |
parent | bde6832d6cc9d98d48e50b0c13ac83ccfd78dd58 (diff) |
Merge branch 'rails-3-develop' of ssh://git.mysociety.org/data/git/public/alaveteli into rails-3-develop
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/public_body_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb index ed24ced52..dc09bdfa6 100644 --- a/spec/models/public_body_spec.rb +++ b/spec/models/public_body_spec.rb @@ -300,6 +300,37 @@ describe PublicBody, "when searching" do end end +describe PublicBody, "when asked for the internal_admin_body" do + before(:each) do + # Make sure that there's no internal_admin_body before each of + # these tests: + PublicBody.connection.delete("DELETE FROM public_bodies WHERE url_name = 'internal_admin_body'") + PublicBody.connection.delete("DELETE FROM public_body_translations WHERE url_name = 'internal_admin_body'") + end + + it "should create the internal_admin_body if it didn't exist" do + iab = PublicBody.internal_admin_body + iab.should_not be_nil + end + + it "should find the internal_admin_body even if the default locale has changed since it was created" do + with_default_locale("en") do + I18n.with_locale(:en) do + iab = PublicBody.internal_admin_body + iab.should_not be_nil + end + end + with_default_locale("es") do + I18n.with_locale(:es) do + iab = PublicBody.internal_admin_body + iab.should_not be_nil + end + end + end + +end + + describe PublicBody, " when dealing public body locales" do it "shouldn't fail if it internal_admin_body was created in a locale other than the default" do # first time, do it with the non-default locale |