spec/enum/enum_spec.rb in iron-enum-1.0.0 vs spec/enum/enum_spec.rb in iron-enum-1.0.1
- old
+ new
@@ -23,7 +23,17 @@
it 'should test the validity of values' do
EnumTest.valid_value?(10).should be_true
EnumTest.valid_value?(555).should be_false
end
+
+ it 'should enforce proper keys' do
+ expect { EnumTest.enum('not-a-key', 27) }.to raise_error
+ expect { EnumTest.enum(27, 100) }.to raise_error
+ end
+
+ it 'should enforce proper values' do
+ expect { EnumTest.enum(:some_key, nil) }.to raise_error
+ expect { EnumTest.enum(:some_key, '200') }.to raise_error
+ end
end
\ No newline at end of file