Commit 600ef087 by Jon Yurek

Make the setter detection in Options more robust

parent bde480d1
......@@ -54,7 +54,7 @@ module Paperclip
end
def method_missing(method, *args, &blk)
if method.to_s[-1] == "="
if method.to_s[-1,1] == "="
instance_variable_set("@#{method[0..-2]}", args[0])
else
instance_variable_get("@#{method}")
......
......@@ -8,6 +8,13 @@ class MockAttachment < Struct.new(:one, :two)
end
class OptionsTest < Test::Unit::TestCase
should "be able to set a value" do
@options = Paperclip::Options.new(nil, {})
assert_nil @options.path
@options.path = "this/is/a/path"
assert_equal "this/is/a/path", @options.path
end
context "#styles with a plain hash" do
setup do
@attachment = MockAttachment.new(nil, nil)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment