spec/dm/matchers/errors_on_spec.rb in dm-rspec-0.2.4 vs spec/dm/matchers/errors_on_spec.rb in dm-rspec-0.3.0
- old
+ new
@@ -9,22 +9,22 @@
end
context '#should' do
it 'passes' do
- lambda {@one_err.should have(1).error_on :name}.should_pass
- lambda {@two_errs.should have(2).errors_on :name}.should_pass
- lambda {@valid.should have(0).errors_on :name}.should_pass
+ lambda {expect((@one_err.error_on :name).size).to eq(1)}.should_pass
+ lambda {expect((@two_errs.errors_on :name).size).to eq(2)}.should_pass
+ lambda {expect((@valid.errors_on :name).size).to eq(0)}.should_pass
end
it 'fails for valid mode' do
- lambda {@valid.should have(1).errors_on :name}.should fail
+ expect {expect(@valid.errors_on :name.size).to eq(1)}.to fail
end
end
context '#should_not' do
it 'fails for invalid model' do
- lambda {@one_err.should_not have(1).error_on :name}.should fail
- lambda {@two_errs.should_not have(2).errors_on :name}.should fail
+ expect {expect((@one_err.error_on :name).size).not_to eq(1)}.to fail
+ expect {expect((@two_errs.errors_on :name).size).not_to eq(2)}.to fail
end
end
end