Created
June 5, 2009 19:34
-
-
Save qrush/124457 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Failing test case | |
context "Default style and styles coercing image mime type to be something | |
different than original" do | |
setup do | |
rebuild_model :styles => {:thumb=> ["100x100#", :jpg], | |
:small => ["150x150>", :jpg], | |
:medium => ["300x300>", :jpg], | |
:large => ["500x500>", :jpg] | |
}, | |
:default_style => :large | |
@dummy = Dummy.new | |
@file = File.new(File.join(File.dirname(__FILE__), | |
"fixtures", | |
"5k.png"), 'rb') | |
@dummy.avatar = @file | |
end | |
teardown { @file.close } | |
context 'when saved' do | |
setup do | |
@dummy.save | |
end | |
should 'have the correct path containing correct file mime type' do | |
assert_match(/\/system\/avatars\/1\/large\/5k.jpg/, @dummy.avatar.url) | |
end | |
should 'have the correct url containing correct file mime type' do | |
assert_match(/\/system\/avatars\/1\/large\/5k.jpg/, @dummy.avatar.path) | |
end | |
end | |
end | |
--Fix | |
attachment.rb | |
line 121 | |
#changed style from default of nil to include the default style | |
def path style = default_style #:nodoc: | |
original_filename.nil? ? nil : interpolate(@path, style) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment