Sha256: 4b7e5b6dc6886946927581c77de60c55d4e980337a0eaf517d975120f07eb342
Contents?: true
Size: 920 Bytes
Versions: 3
Compression:
Stored size: 920 Bytes
Contents
covers 'facets/kernel/replace' tests Object do unit :replace do c = Class.new do attr_reader :a, :b def initialize(a,b) @a, @b = a, b end end o = c.new(1,2) o.a.assert == 1 o.b.assert == 2 o.replace(:a=>3, :b=>4) o.a.assert == 3 o.b.assert == 4 end end tests Object do unit :replace do c = Class.new do attr :name attr :age def initialize(name, age) @name, @age = name, age end end o = c.new('bob', 60) o.name.assert == 'bob' o.age.assert == 60 o.replace(:name=>'tom', :age=>40) o.name.assert == 'tom' o.age.assert == 40 end end tests Struct do unit :replace do s = Struct.new(:name, :age) o = s.new('bob', 60) o.name.assert == 'bob' o.age.assert == 60 o.replace(:name=>'tom', :age=>40) o.name.assert == 'tom' o.age.assert == 40 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-2.9.0 | test/core/kernel/test_replace.rb |
facets-2.9.0.pre.2 | test/core/kernel/test_replace.rb |
facets-2.9.0.pre.1 | test/core/kernel/test_replace.rb |