spec/lib/id/boolean_spec.rb in id-0.1 vs spec/lib/id/boolean_spec.rb in id-0.1.1

- old
+ new

@@ -29,10 +29,21 @@ it 'parses symbols as well as strings' do b = Id::Boolean.parse(:true) expect(b).to be_true end + it 'parses trueclass as true' do + b = Id::Boolean.parse(true) + expect(b).to be_true + end + it 'parses everything else as false' do b = Id::Boolean.parse(:cottage_cheese) expect(b).to be_false end + + it 'works with default values' do + test_class = Class.new { include Id::Model; field :foo, type: Id::Boolean, default: false } + expect(test_class.new.foo).to be_false + end + end