Skip to content

Commit

Permalink
get better titles from filenames. also added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
djones committed Feb 10, 2010
1 parent 13ac918 commit e85c280
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion db/schema.rb
@@ -1,4 +1,4 @@
# This file is auto-generated from the current state of the database. Instead of editing this file,
# This file is auto-generated from the current state of the database. Instead of editing this file,
# please use the migrations feature of Active Record to incrementally modify your database, and
# then regenerate this schema definition.
#
Expand Down
Binary file added test/files/The world!.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/files/car-wallpapers19.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions test/fixtures/images.yml
@@ -0,0 +1,14 @@
the_world:
content_type: image/gif
filename: The%20world!.gif
width: 614
height: 340
size: 17535
# TODO: image_type? What's that used for?

our_car:
content_type: image/jpg
filename: car-wallpapers19.jpg
width: 640
height: 300
size: 87647
10 changes: 9 additions & 1 deletion test/unit/image_test.rb
Expand Up @@ -5,10 +5,18 @@ class ImageTest < ActiveSupport::TestCase
fixtures :images

def test_titles
assert_equal "The World", images(:the_world).title
assert_equal "Car Wallpapers19", images(:our_car).title
end

def test_per_page

assert_equal 18, Image.per_page(dialog = true)
assert_equal 20, Image.per_page # dialog = false
end

def test_attachment_fu_options
assert_equal 50.megabytes, Image.attachment_options[:max_size]
assert_equal 'Rmagick', Image.attachment_options[:processor]
end

end

0 comments on commit e85c280

Please sign in to comment.