aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/admin_public_body_controller_spec.rb
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2013-10-04 17:15:16 +0100
committerMark Longair <mhl@pobox.com>2013-10-04 17:15:16 +0100
commit62c7844025044413158489554e5b6a4c7dc43bb0 (patch)
treebac74fe69ebd4d809a32061d42227f6365560db9 /spec/controllers/admin_public_body_controller_spec.rb
parent7f915bf9153cac94ed2f17fee7e7ea2ee9edce8f (diff)
Add to fixtures a public body with an accented initial letter
This adds a public body called "Åčçèñtéd Authority" in the Czech locale (cs) so that we can create tests that exercise, for example, searching based on an initial letter that has a multi-byte representation in UTF-8. An old test for "add mass tags" in the admin needed to be updated since it implicitly assumed that all the public bodies in the fixtures had translations in the :en locale. The tests for loading CSV files of public bodies also needed to be updated, since they were assuming that public body names only contained letters in [A-Za-z ]. Since Unicode character classes aren't easily available in Ruby 1.8 and it makes little difference to the test, the character class is replaced by '.'.
Diffstat (limited to 'spec/controllers/admin_public_body_controller_spec.rb')
-rw-r--r--spec/controllers/admin_public_body_controller_spec.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb
index 8a72db724..fe5087d7c 100644
--- a/spec/controllers/admin_public_body_controller_spec.rb
+++ b/spec/controllers/admin_public_body_controller_spec.rb
@@ -55,7 +55,8 @@ describe AdminPublicBodyController, "when administering public bodies" do
end
it "mass assigns tags" do
- n = PublicBody.count
+ condition = "public_body_translations.locale = ?"
+ n = PublicBody.joins(:translations).where([condition, "en"]).count
post :mass_tag_add, { :new_tag => "department", :table_name => "substring" }
request.flash[:notice].should == "Added tag to table of bodies."
response.should redirect_to(:action=>'list')