Sha256: 43e5d107f30e44f43dcf39650f1b92bf402a11838bba4e11a1fc073f56531e6e
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
require_relative '../helper' class TestItem < MiniTest::Unit::TestCase def test_extension_loaded assert Item.respond_to?(:create_dummy) assert TestDummy::Loader.load!(Item) assert_equal [ :account, :bill, :description ], Item.dummy_definition.fields end def test_reflection_properties reflection_class, foreign_key = TestDummy::Support.reflection_properties(Item, :account) assert_equal Account, reflection_class assert_equal :account_id, foreign_key end def test_create_dummy item = Item.create_dummy assert item assert item.description? assert_equal true, item.valid? assert_equal false, item.new_record? assert item.account assert_equal false, item.account.new_record? assert_equal item.account.id, item.account_id assert item.bill assert_equal false, item.bill.new_record? assert_equal item.bill.id, item.bill_id assert_equal item.account.id, item.bill.account_id assert_equal [ item.id ], item.account.items.collect(&:id) assert_equal [ item.id ], item.bill.items.collect(&:id) end def test_create_dummy_via_association bill = a Bill assert bill.account assert bill.account.id assert_equal false, bill.new_record? item = one_of bill.items assert item assert_equal true, item.valid? assert_equal false, item.new_record? assert_equal bill.id, item.bill_id assert_equal bill.account_id, item.account_id account = bill.account assert account assert account.bills assert_equal [ bill.id ], account.bills.collect(&:id) assert account.items assert_equal [ item.id ], account.items.collect(&:id) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
test_dummy-0.5.0 | test/unit/test_item.rb |