Sha256: b5b032a24d4a693ee71b7feff83a38f5a083e955a930c9e33296ae879930f6f2
Contents?: true
Size: 906 Bytes
Versions: 2
Compression:
Stored size: 906 Bytes
Contents
require 'minitest/autorun' require_relative 'test_helper' class FakeUser < ActiveRecord::Base def self.needs_attr_accessible? ActiveRecord::VERSION::MAJOR == 3 end if needs_attr_accessible? attr_accessible :name, :address end end class TestDifference < MiniTest::Test def setup @john = FakeUser.create(:name => 'john', :address => 'NYC') @smith = FakeUser.create(:name => 'smith', :address => 'NYC') end def test_john_and_smith_not_matching_on_id_and_name assert_equal({:id => [@john.id, @smith.id], :name=>["john", "smith"]}, @john.differs_from(@smith)) end def test_john_and_smith_not_matching_on_name assert_equal({:name=>["john", "smith"]}, @john.differs_from(@smith, :ignore_attributes => [:id, :created_at])) end def test_john_and_smith_matching_on_address assert_equal({}, @john.differs_from(@smith, :only_attributes => [:address])) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
difference-1.0.2 | test/test_difference.rb |
difference-1.0.2.alpha | test/test_difference.rb |