spec/attribute_spec.rb in attributor-2.2.1 vs spec/attribute_spec.rb in attributor-2.3.0
- old
+ new
@@ -224,15 +224,10 @@
context 'load' do
let(:context){ ['context'] }
let(:value) { '1' }
- it 'does not call type.load for nil values' do
- type.should_not_receive(:load)
- attribute.load(nil)
- end
-
it 'delegates to type.load' do
type.should_receive(:load).with(value,context, {})
attribute.load(value,context)
end
@@ -250,18 +245,16 @@
context 'for nil' do
let(:value) { nil }
it { should == default_value}
end
-
- context 'for a value that the type loads as nil' do
- let(:value) { "not nil"}
- before do
- type.should_receive(:load).and_return(nil)
- end
+ context 'for false' do
+ let(:type) { Attributor::Boolean }
+ let(:default_value) { false }
+ let(:value) { nil }
it { should == default_value}
- end
+ end
end
context 'validating a value' do
context '#validate' do