diff options
author | David Cabo <david@calibea.com> | 2011-08-16 03:50:11 +0200 |
---|---|---|
committer | David Cabo <david@calibea.com> | 2011-08-16 12:22:21 +0200 |
commit | 95e357b02b75de103d93180e3a33417f0c83dfb3 (patch) | |
tree | 4640212275cd028ac1889631791cc89a97dc746d /spec/models | |
parent | 19b54415ca0f2177aa1786a7deba5b4a5f1ce1df (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.rb | 14 |
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 |