Sha256: 233547c580349f9cd2c977d971d485f21966bba0d4ef31d9a52483a92b537646

Contents?: true

Size: 1.29 KB

Versions: 8

Compression:

Stored size: 1.29 KB

Contents

require './test/helper'

class AttachmentOptionsTest < Test::Unit::TestCase
  should "be a Hash" do
    assert_kind_of Hash, Paperclip::AttachmentOptions.new({})
  end

  should "add a default empty validations" do
    options = {:arbi => :trary}
    expected = {:validations => []}.merge(options)
    actual = Paperclip::AttachmentOptions.new(options).to_hash
    assert_equal expected, actual
  end

  should "not override validations if passed to initializer" do
    options = {:validations => "something"}
    attachment_options = Paperclip::AttachmentOptions.new(options)
    assert_equal "something", attachment_options[:validations]
  end

  should "respond to []" do
    assert Paperclip::AttachmentOptions.new({}).respond_to?(:[])
  end

  should "deliver the specified options through []" do
    intended_options = {:specific_key => "specific value"}
    attachment_options = Paperclip::AttachmentOptions.new(intended_options)
    assert_equal "specific value", attachment_options[:specific_key]
  end

  should "respond to []=" do
    assert Paperclip::AttachmentOptions.new({}).respond_to?(:[]=)
  end

  should "remember options set with []=" do
    attachment_options = Paperclip::AttachmentOptions.new({})
    attachment_options[:foo] = "bar"
    assert_equal "bar", attachment_options[:foo]
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
paperclip-v2_7-patched-ruby-1_8_6-2.7.5 test/attachment_options_test.rb
paperclip-2.7.5 test/attachment_options_test.rb
paperclip-2.7.4 test/attachment_options_test.rb
paperclip-2.7.2 test/attachment_options_test.rb
paperclip-2.8.0 test/attachment_options_test.rb
paperclip-2.7.1 test/attachment_options_test.rb
paperclip-2.7.0 test/attachment_options_test.rb
paperclip-2.6.0 test/attachment_options_test.rb