Sha256: f3a45ed84d151606e7c65f557117af804826866c62052957762b8b8573c7986a
Contents?: true
Size: 784 Bytes
Versions: 14
Compression:
Stored size: 784 Bytes
Contents
require 'spec_helper' describe 'have errors_on' do before(:all) do @valid = Book.new(:name => 'War and Peace') @one_err = Book.new(:name => 'too short') @two_errs = Book.new 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 end it 'fails for valid mode' do lambda {@valid.should have(1).errors_on :name}.should 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 end end end
Version data entries
14 entries across 14 versions & 2 rubygems