Sha256: f86f8b2e51f5c2d2671002ecf150c68298085ab7e5c3009c54684db50dd010c9
Contents?: true
Size: 899 Bytes
Versions: 9
Compression:
Stored size: 899 Bytes
Contents
require "more/spec_helper" describe 'OpenConstructor' do class Test include RubyExt::OpenConstructor attr_accessor :name, :value end it 'should initialize atributes from Hash' do t = Test.new.set(name: 'name', value: 'value') [t.name, t.value].should == ['name', 'value'] end it 'should initialize atributes from any Object' do t = Test.new.set(name: 'name', value: 'value') t2 = Test.new.set t [t2.name, t2.value].should == ['name', 'value'] end it 'restrict copied values' do t = Test.new.set(name: 'name', value: 'value') t2 = Test.new.set t, [:name] [t2.name, t2.value].should == ['name', nil] t = {name: 'name', value: 'value'} t2 = Test.new.set t, [:name] [t2.name, t2.value].should == ['name', nil] end it 'to_hash' do h = {name: 'name', value: 'value'} t = Test.new.set h t.to_hash.should == h end end
Version data entries
9 entries across 9 versions & 1 rubygems