Sha256: 718c079cf272a4dadde7daecda939c717d249c83cd895cc62bbb75f0a488b65e
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
require 'test_helper' class SummonTest < ActiveSupport::TestCase def setup Summon.noisy = false Corner.delete_all Compartment.delete_all Handle.delete_all Box.delete_all Secret.delete_all end test "building a number of objects" do Summon(:corner, 3) assert_equal 3, Corner.count end test "building a variable number of objects" do Summon(:corner, 3..5) assert_operator 3..5, :===, Corner.count end test "overriding default factory attributes" do Summon(:corner, 1, :sharp => false) assert_equal false, Corner.first.sharp end test "building has_many associations" do Summon(:box, 1) do |b| b.corners 3 b.compartments 2 do |c| c.secrets 4 end end assert_equal 3, Box.first.corners.count assert_equal 3, Corner.count assert_equal 2, Box.first.compartments.count assert_equal 2, Compartment.count assert_equal 8, Secret.count end test "building has_one associations" do Summon(:box, 1) do |b| b.compartments 2 do |c| c.handle end end assert_equal 2, Compartment.count assert_equal 2, Handle.count end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jim-summon-0.1.0 | test/summon_test.rb |