diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/admin_public_body_controller_spec.rb | 3 | ||||
-rw-r--r-- | spec/fixtures/public_bodies.yml | 18 | ||||
-rw-r--r-- | spec/fixtures/public_body_translations.yml | 12 | ||||
-rw-r--r-- | spec/models/public_body_spec.rb | 14 |
4 files changed, 39 insertions, 8 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') diff --git a/spec/fixtures/public_bodies.yml b/spec/fixtures/public_bodies.yml index 1fa016d3a..71fe0a379 100644 --- a/spec/fixtures/public_bodies.yml +++ b/spec/fixtures/public_bodies.yml @@ -128,3 +128,21 @@ other_public_body: info_requests_successful_count: 0 info_requests_not_held_count: 0 info_requests_overdue_count: 0 +accented_public_body: + id: 8 + version: 1 + name: 'Åčçèñtéd Authority' + first_letter: Å + request_email: accented@localhost + short_name: 'Åčçèñtéd Authority' + url_name: accented_authority + notes: This is to test unicode handling in body names + updated_at: 2008-10-25 10:51:01.161639 + last_edit_comment: Another edit + last_edit_editor: louise + created_at: 2008-10-25 10:51:01.161639 + api_key: 7 + info_requests_count: 0 + info_requests_successful_count: 0 + info_requests_not_held_count: 0 + info_requests_overdue_count: 0 diff --git a/spec/fixtures/public_body_translations.yml b/spec/fixtures/public_body_translations.yml index de1bf2f18..2030804ac 100644 --- a/spec/fixtures/public_body_translations.yml +++ b/spec/fixtures/public_body_translations.yml @@ -115,3 +115,15 @@ humpadink_he_IL_public_body_translation: publication_scheme: "" disclosure_log: "" +accented_public_body_translation: + id: 10 + public_body_id: 8 + locale: cs + name: "Åčçèñtéd Authority" + first_letter: 'Å' + request_email: accented@localhost + short_name: "Åčçèñtéd Authority" + url_name: accented_authority + notes: This is to test unicode handling in body names + publication_scheme: "" + disclosure_log: "" diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb index 582f1430e..b0cb15f27 100644 --- a/spec/models/public_body_spec.rb +++ b/spec/models/public_body_spec.rb @@ -300,7 +300,7 @@ describe PublicBody, " when loading CSV files" do errors.should == [] notes.size.should == 2 notes[0].should == "line 1: creating new authority 'aBody' (locale: en):\n\t{\"name\":\"aBody\"}" - notes[1].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/ + notes[1].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( .+\n)*You may want to delete them manually.\n/ end it "should do a dry run successfully" do @@ -316,7 +316,7 @@ describe PublicBody, " when loading CSV files" do "line 3: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t\{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\"\}", "line 4: creating new authority 'Gobierno de Aragón' (locale: en):\n\t\{\"name\":\"Gobierno de Arag\\u00f3n\",\"request_email\":\"spain_foi@localhost\"}", ] - notes[4].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/ + notes[4].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( .+\n)*You may want to delete them manually.\n/ PublicBody.count.should == original_count end @@ -334,7 +334,7 @@ describe PublicBody, " when loading CSV files" do "line 3: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t\{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\"\}", "line 4: creating new authority 'Gobierno de Aragón' (locale: en):\n\t\{\"name\":\"Gobierno de Arag\\u00f3n\",\"request_email\":\"spain_foi@localhost\"}", ] - notes[4].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/ + notes[4].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( .+\n)*You may want to delete them manually.\n/ PublicBody.count.should == original_count + 4 end @@ -352,7 +352,7 @@ describe PublicBody, " when loading CSV files" do "line 3: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t\{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\"\}", "line 4: creating new authority 'Gobierno de Aragón' (locale: en):\n\t\{\"name\":\"Gobierno de Arag\\u00f3n\",\"request_email\":\"spain_foi@localhost\"}", ] - notes[4].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/ + notes[4].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( .+\n)*You may want to delete them manually.\n/ PublicBody.count.should == original_count + 4 end @@ -368,7 +368,7 @@ describe PublicBody, " when loading CSV files" do "line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t\{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\",\"tag_string\":\"scottish\"\}", "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t\{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"\}", ] - notes[3].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/ + notes[3].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( .+\n)*You may want to delete them manually.\n/ PublicBody.count.should == original_count end @@ -425,7 +425,7 @@ describe PublicBody, " when loading CSV files" do "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"}", "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: es):\n\t{\"name\":\"Autoridad Irlandesa\"}", ] - notes[6].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/ + notes[6].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( .+\n)*You may want to delete them manually.\n/ PublicBody.count.should == original_count + 3 @@ -451,7 +451,7 @@ describe PublicBody, " when loading CSV files" do "line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\",\"tag_string\":\"scottish\"}", "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"}", ] - notes[3].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/ + notes[3].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( .+\n)*You may want to delete them manually.\n/ PublicBody.count.should == original_count end |