Skip to content

Commit

Permalink
Don't run network dependant tests unless there is an internet connect…
Browse files Browse the repository at this point in the history
…ion available
  • Loading branch information
AlexJWayne authored and dummied committed Jan 21, 2009
1 parent a52631d commit 7858547
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/unit/file_upload_from_url_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@ class FleximageFileUploadFromUrlTest < Test::Unit::TestCase
def test_should_be_valid_with_image_from_url
p = PhotoBare.new(:image_file_url => files(:web_photo))
assert p.save, 'Record expected to be valid after upload via URL'
rescue SocketError
print '!'
end

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)
rescue SocketError
print '!'
end

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)
rescue SocketError
print '!'
end
end
2 changes: 2 additions & 0 deletions test/unit/magic_columns_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ def test_should_save_data_in_magic_columns_from_url
assert_equal files(:web_photo), p.image_filename
assert_equal 110, p.image_height
assert_equal 276, p.image_width
rescue SocketError
print '!'
end
end

0 comments on commit 7858547

Please sign in to comment.