From 3ad5277ed2c9f98508a7208848e125d274c86a3b Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 5 Dec 2013 16:57:02 +0000 Subject: Search for bodies using the underscore version of the locale. --- spec/models/public_body_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'spec/models') diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb index 23842ccff..0c29503a3 100644 --- a/spec/models/public_body_spec.rb +++ b/spec/models/public_body_spec.rb @@ -604,3 +604,12 @@ describe PublicBody, "when calculating statistics" do end end + +describe PublicBody, 'when asked for popular bodies' do + + it 'should return bodies correctly when passed the hyphenated version of the locale' do + AlaveteliConfiguration.stub!(:frontpage_publicbody_examples).and_return('') + PublicBody.popular_bodies('he-IL').should == [public_bodies(:humpadink_public_body)] + end + +end -- cgit v1.2.3 From 0cbf14f4780a9c38eb73f24f0052e50c60c40769 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 5 Dec 2013 18:50:10 +0000 Subject: Make sure globalize uses the right locale version when updating. --- spec/models/public_body_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'spec/models') diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb index 0c29503a3..73a07db41 100644 --- a/spec/models/public_body_spec.rb +++ b/spec/models/public_body_spec.rb @@ -213,6 +213,15 @@ describe PublicBody, " when saving" do public_body.name.should == "Mark's Public Body" end + it 'should update the right translation when in a locale with an underscore' do + AlaveteliLocalization.set_locales('he_IL', 'he_IL') + public_body = public_bodies(:humpadink_public_body) + translation_count = public_body.translations.size + public_body.name = 'Renamed' + public_body.save! + public_body.translations.size.should == translation_count + end + it 'should not create a new version when nothing has changed' do @public_body.versions.size.should == 0 set_default_attributes(@public_body) -- cgit v1.2.3