aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/admin_public_body_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/admin_public_body_controller_spec.rb')
-rw-r--r--spec/controllers/admin_public_body_controller_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb
index 5b8ed6c55..f176150da 100644
--- a/spec/controllers/admin_public_body_controller_spec.rb
+++ b/spec/controllers/admin_public_body_controller_spec.rb
@@ -44,6 +44,15 @@ describe AdminPublicBodyController, 'when showing the form for a new public body
assigns[:public_body].should be_a(PublicBody)
end
+ it "builds new translations for all locales" do
+ get :new
+
+ translations = assigns[:public_body].translations.map{ |t| t.locale.to_s }.sort
+ available = I18n.available_locales.map{ |l| l.to_s }.sort
+
+ expect(translations).to eq(available)
+ end
+
context 'when passed a change request id as a param' do
render_views
@@ -161,6 +170,12 @@ describe AdminPublicBodyController, "when editing a public body" do
response.should render_template('edit')
end
+ it "builds new translations if the body does not already have a translation in the specified locale" do
+ public_body = FactoryGirl.create(:public_body)
+ get :edit, :id => public_body.id
+ expect(assigns[:public_body].translations.map(&:locale)).to include(:fr)
+ end
+
context 'when passed a change request id as a param' do
render_views