Sha256: 8a12d56690063c81bf9622f3412374c8cf3d2231ecb34e29ce8a822523b24247

Contents?: true

Size: 672 Bytes

Versions: 4

Compression:

Stored size: 672 Bytes

Contents

covers 'facets/kernel/assign_from'

tests Kernel do

  c = Struct.new(:name, :address, :zip)

  unit :assign_from do
    bob = c.new("Bob Sawyer", "123 Maple, Anytown NC", 12345)
    joe = c.new("Joe Pitare")

    joe.assign_from(bob, :address, :zip)

    joe.name.assert == "Joe Pitare"
    joe.address. == "123 Maple, Anytown NC"
    joe.zip.assert == 12345
  end

  c1 = Class.new do
    attr_accessor :a
    attr_accessor :b
  end

  c2 = Class.new do
    attr_accessor :a
    attr_accessor :b
  end

  unit :assign_from do
    o1 = c1.new
    o1.a = 1
    o1.b = 2

    o2 = c2.new
    o2.assign_from(o1, :a, :b)

    o2.a.assert == 1
    o2.b.assert == 2
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facets-2.9.1 test/core/kernel/test_assign_from.rb
facets-2.9.0 test/core/kernel/test_assign_from.rb
facets-2.9.0.pre.2 test/core/kernel/test_assign_from.rb
facets-2.9.0.pre.1 test/core/kernel/test_assign_from.rb