spec/lib/abstractivator/enum_spec.rb in abstractivator-0.0.20 vs spec/lib/abstractivator/enum_spec.rb in abstractivator-0.0.21

- old
+ new

@@ -32,9 +32,17 @@ end it 'raises an error if no such value exists in the enumeration' do expect{Container::Traditional.from_symbol(:baz)}.to raise_error end end + describe '::from' do + it 'returns the typed version of the value' do + x = 'apple' + expect(x.enum_type).to be_nil + result = Container::Fruits.from(x) + expect(result.enum_type).to eql Container::Fruits + end + end end describe '#define_enum' do it 'defines an enum given an array of symbols' do expect(Container::Fruits::APPLE).to eql 'apple'