aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
authorDavid Cabo <david@calibea.com>2011-08-16 03:50:11 +0200
committerDavid Cabo <david@calibea.com>2011-08-16 12:22:21 +0200
commit95e357b02b75de103d93180e3a33417f0c83dfb3 (patch)
tree4640212275cd028ac1889631791cc89a97dc746d /spec/models
parent19b54415ca0f2177aa1786a7deba5b4a5f1ce1df (diff)
Don't fail if a body has the same url_name in several locales (closes #139)
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/public_body_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index ec84cbe65..3d00d37fb 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -210,6 +210,20 @@ describe PublicBody, "when searching" do
body.id.should == 3
body.class.to_s.should == 'PublicBody'
end
+
+ it "should cope with same url_name across multiple locales" do
+ PublicBody.with_locale(:es) do
+ # use the unique spanish name to retrieve and edit
+ body = PublicBody.find_by_url_name_with_historic('etgq')
+ body.short_name = 'tgq' # Same as english version
+ body.save!
+
+ # now try to retrieve it
+ body = PublicBody.find_by_url_name_with_historic('tgq')
+ body.id.should == public_bodies(:geraldine_public_body).id
+ body.name.should == "El A Geraldine Quango"
+ end
+ end
end
describe PublicBody, " when loading CSV files" do