diff options
author | Mark Longair <mhl@pobox.com> | 2013-12-09 09:54:15 +0000 |
---|---|---|
committer | Mark Longair <mhl@pobox.com> | 2013-12-09 09:54:15 +0000 |
commit | 8724db30b4f953e6d129db399ef9e9a79cd9fee4 (patch) | |
tree | 1324a10fb4b0ebd21f5538d358ea4d846eff4c9e /spec/models | |
parent | 970d30d7f90177a7dc897e0d06b2f5ad06dffdb8 (diff) | |
parent | f920268650b6bb906be1828ed26a3732f4d10cc1 (diff) |
Merge branch 'fix-command-line-csv' into rails-3-develop
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 23842ccff..d1e2e233d 100644 --- a/spec/models/public_body_spec.rb +++ b/spec/models/public_body_spec.rb @@ -473,6 +473,20 @@ describe PublicBody, " when loading CSV files" do PublicBody.count.should == original_count end + + it "should be able to load CSV from a file as well as a string" do + # Essentially the same code is used for import_csv_from_file + # as import_csv, so this is just a basic check that + # import_csv_from_file can load from a file at all. (It would + # be easy to introduce a regression that broke this, because + # of the confusing change in behaviour of CSV.parse between + # Ruby 1.8 and 1.9.) + original_count = PublicBody.count + filename = file_fixture_name('fake-authority-type-with-field-names.csv') + PublicBody.import_csv_from_file(filename, '', 'replace', false, 'someadmin') + PublicBody.count.should == original_count + 3 + end + end describe PublicBody do |