Sha256: d7bf46bcd4ad346f24a7e58e022fd01578349f9ef2ff419519423480fe705bcf

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

require 'test_helper'

class AttributeTest < ActiveSupport::TestCase

  test 'accessor' do
    iphone = products(:iphone)
    assert_equal '', iphone.size_list

    iphone.expects(:size_added).never
    iphone.expects(:size_removed).never
    iphone.sizes << '64GB'
    assert_equal '64GB', iphone.size_list
    assert_equal [], iphone.added_sizes_to_list
    assert_equal [], iphone.removed_sizes_from_list

    iphone.expects(:size_added).once.with('32GB')
    iphone.expects(:size_removed).once.with('64GB')
    iphone.size_list = '32GB'
    assert_equal '32GB', iphone.size_list
    assert_equal ['32GB'], iphone.added_sizes_to_list
    assert_equal ['64GB'], iphone.removed_sizes_from_list
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
listable_collections-0.0.1 test/attribute_test.rb