Sha256: 48fce095b6f028cc89e10075ff3487e3d3a30f94af67a81011cdb46b92313028
Contents?: true
Size: 1.5 KB
Versions: 5
Compression:
Stored size: 1.5 KB
Contents
require 'test_helper' class MakerTest < ActiveSupport::TestCase test 'overrides' do assert_equal 'other', build(:user, name: 'other').name list = build(:user, 3, name: 'other') 3.times do |index| assert_equal 'other', list[index].name end assert_equal 'other', create(:user, name: 'other').name list = create(:user, 3, name: 'other') 3.times do |index| assert_equal 'other', list[index].name end end test 'inheritance' do user = build(:user_with_age) assert_equal 'name', user.name assert_equal 9, user.age user = create(:user_with_age) assert_equal 'name', user.name assert_equal 9, user.age end test 'dependent' do assert_equal 'name', build(:user).username assert_equal 'name', create(:user).username end test 'sequences' do assert_operator build(:user).email, :<, create(:user).email assert_operator build(:user).phone, :<, create(:user).phone end test 'aliases' do user = Makers.definitions.find(:user) assert_kind_of Makers::Maker, user assert_equal user, Makers.definitions.find(:owner) end test 'associations' do posts = build(:user).posts assert_equal 1, posts.size post = posts.first assert post.new_record? posts = build(:user_with_posts).posts assert_equal 2, posts.size post = posts.first assert post.persisted? end test 'definitions' do assert_raises do Makers.find :wrong end assert_raises do Makers.add :user end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
makers-4.0.0.4 | test/maker_test.rb |
makers-4.0.0.3 | test/maker_test.rb |
makers-4.0.0.2 | test/maker_test.rb |
makers-4.0.0.1 | test/maker_test.rb |
makers-4.0.0.0 | test/maker_test.rb |