Sha256: 3f2ca1cfe214724d67a34c6c897ad663eed8a9ab194cd7253af0663fdb9fe22b
Contents?: true
Size: 887 Bytes
Versions: 3
Compression:
Stored size: 887 Bytes
Contents
require 'test_helper' class AssociationTest < ActiveSupport::TestCase test 'methods' do shop = Shop.create %w(iPhone iPad).each do |name| shop.products.create name: name end assert_equal 'iPhone,iPad', shop.product_list imac = Product.new(name: 'iMac') shop.expects(:product_added).never shop.expects(:product_removed).never shop.products << imac assert_equal 'iPhone,iPad,iMac', shop.product_list assert_equal [], shop.added_products_to_list assert_equal [], shop.removed_products_from_list shop.expects(:product_added).once.with('MacBook') shop.expects(:product_removed).once.with('iPad') shop.product_list = 'iMac,iPhone,MacBook' assert_equal 'iPhone,iMac,MacBook', shop.product_list assert_equal ['MacBook'], shop.added_products_to_list assert_equal ['iPad'], shop.removed_products_from_list end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
listable_collections-4.0.0.1 | test/association_test.rb |
listable_collections-4.0.0.0 | test/association_test.rb |
listable_collections-0.1.0 | test/association_test.rb |