Sha256: 3330c3c5e9a515362f84cb7ee1324bbb51ba0fb98fc8d9b1ca563e7b63a05a8f

Contents?: true

Size: 896 Bytes

Versions: 3

Compression:

Stored size: 896 Bytes

Contents

require 'mixers/equitable'
require 'test/unit'

class TestModuleEquatable < Test::Unit::TestCase

  def test_equatable_with_arguments
    c = Class.new
    c.class_eval { 
      include Equitable(:a,:b)
      attr_accessor :a, :b
    }
    c1,c2 = c.new,c.new
    c1.a = 10; c1.b = 20
    c2.a = 10; c2.b = 20
    assert_equal( c1, c2 )
    c1.a = 10; c1.b = 10
    c2.a = 10; c2.b = 20
    assert_not_equal( c1, c2 )
    c1.a = 10; c1.b = 20
    c2.a = 20; c2.b = 20
    assert_not_equal( c1, c2 )
  end

=begin
  def test_equate_on_old
    c = Class.new
    c.class_eval { attr_accessor :a, :b ; equate_on :a,:b }
    c1,c2 = c.new,c.new
    c1.a = 10; c1.b = 20
    c2.a = 10; c2.b = 20
    assert_equal( c1, c2 )
    c1.a = 10; c1.b = 10
    c2.a = 10; c2.b = 20
    assert_not_equal( c1, c2 )
    c1.a = 10; c1.b = 20
    c2.a = 20; c2.b = 20
    assert_not_equal( c1, c2 )
  end
=end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mixers-1.2.0 test/test_equitable.rb
mixers-1.1.0 test/test_equitable.rb
mixers-1.0.0 test/test_equitable.rb