Sha256: f8e84b199ce26095325bcd928cef05936319c59ea7982482db58a2222c926df4
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
require 'test_helper' require './lib/fixture_overlord' require './lib/fixture_overlord/hashish' require 'ostruct' module ActiveRecord class Base; end end class Person < ActiveRecord::Base def initialize(attributes={}); end class << self def create(*args); true; end def create!(*args); true; end def build(*args); true; end end end class Minitest::Test include ::FixtureOverlord fixture_overlord :rule end module FixtureOverlord class HashishTest < Minitest::Test def hash @hash ||= { name: 'Bob', age: 44 } end def bob @bob ||= person(:bob) end def test_merge bob_extended = bob.merge(occupation: 'Secret Agent').mock assert_equal 'Secret Agent', bob_extended.occupation end def test_mock mock = bob.mock assert_equal "Bob", mock.name assert_equal 44, mock.age end def test_model model = bob.model assert_instance_of Person, model end def test_create assert bob.create assert bob.create! end def test_build assert bob.build end def test_associate bob.associate(account_id: 1) mock = bob.mock assert_equal 1, mock.account_id end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fixture_overlord-0.1.9 | test/hashish_test.rb |