Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes file upload tests

  • Loading branch information...
commit 78ad2ebd31d5ecdbf37370fad500e9ef66527090 1 parent 993f5d4
@tvdeyen authored
View
8 test/test_helper.rb
@@ -9,12 +9,7 @@
# Run the migrations
ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
-# Setup the fixtures path
-Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/"
-$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
-
require File.dirname(__FILE__) + '/mock_file'
-require File.dirname(__FILE__) + '/s3_stubs'
require 'open-uri'
unless Magick::QuantumDepth == 16
@@ -31,9 +26,6 @@ def create_fixtures(*table_names)
Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names)
end
end
-
- self.use_transactional_fixtures = true
- self.use_instantiated_fixtures = false
def files(name)
case name
View
4 test/unit/file_upload_from_local_test.rb
@@ -10,14 +10,14 @@ def test_should_require_an_image
p = PhotoBare.new
assert !p.save, 'Record expected to not be allowed to save'
assert_equal 1, p.errors.size
- assert_equal 'is required', p.errors.on(:image_file)
+ assert_equal 'is required', p.errors.messages[:image_file].join()
end
def test_should_require_an_valid_image
p = PhotoBare.new(:image_file => files(:not_a_photo))
assert !p.save, 'Record expected to not be allowed to save'
assert_equal 1, p.errors.size
- assert_equal 'was not a readable image', p.errors.on(:image_file)
+ assert_equal 'was not a readable image', p.errors.messages[:image_file].join()
end
def test_should_correct_colorspace_and_dpi
View
4 test/unit/file_upload_from_url_test.rb
@@ -12,7 +12,7 @@ def test_should_be_invalid_with_nonimage_from_url
p = PhotoBare.new(:image_file_url => 'http://www.google.com/')
assert !p.save, 'Record expected to be invalid after upload via URL'
assert_equal 1, p.errors.size
- assert_equal 'was not a readable image', p.errors.on(:image_file_url)
+ assert_equal 'was not a readable image', p.errors.messages[:image_file_url].join()
rescue SocketError
print '!'
end
@@ -21,7 +21,7 @@ def test_should_be_invalid_with_invalid_url
p = PhotoBare.new(:image_file_url => 'foo')
assert !p.save, 'Record expected to be invalid after upload via URL'
assert_equal 1, p.errors.size
- assert_equal 'was not a readable image', p.errors.on(:image_file_url)
+ assert_equal 'was not a readable image', p.errors.messages[:image_file_url].join()
rescue SocketError
print '!'
end
View
4 test/unit/file_upload_to_db_test.rb
@@ -14,14 +14,14 @@ def test_should_require_an_image
p = PhotoDb.new
assert !p.save, 'Record expected to not be allowed to save'
assert_equal 1, p.errors.size
- assert_equal 'is required', p.errors.on(:image_file)
+ assert_equal 'is required', p.errors.messages[:image_file].join()
end
def test_should_require_an_valid_image
p = PhotoDb.new(:image_file => files(:not_a_photo))
assert !p.save, 'Record expected to not be allowed to save'
assert_equal 1, p.errors.size
- assert_equal 'was not a readable image', p.errors.on(:image_file)
+ assert_equal 'was not a readable image', p.errors.messages[:image_file].join()
end
def test_should_retrieve_a_stored_image
Please sign in to comment.
Something went wrong with that request. Please try again.