Sha256: 695c295f18f9680a83ae66cde54bd64db9591a8d21cfb28c487f1fb1d99aa456

Contents?: true

Size: 1.15 KB

Versions: 17

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe "error_on" do
  it "should provide a description including the name of what the error is on" do
    have(1).error_on(:whatever).description.should == "have 1 error on :whatever"
  end
  
  it "should provide a failure message including the number actually given" do
    lambda {
      [].should have(1).error_on(:whatever)
    }.should fail_with("expected 1 error on :whatever, got 0")
  end
end

describe "errors_on" do
  it "should provide a description including the name of what the error is on" do
    have(2).errors_on(:whatever).description.should == "have 2 errors on :whatever"
  end
  
  it "should provide a failure message including the number actually given" do
    lambda {
      [1].should have(3).errors_on(:whatever)
    }.should fail_with("expected 3 errors on :whatever, got 1")
  end
end

describe "have something other than error_on or errors_on" do
  it "has a standard rspec failure message" do
    lambda {
      [1,2,3].should have(2).elements
    }.should fail_with("expected 2 elements, got 3")
  end

  it "has a standard rspec description" do
    have(2).elements.description.should == "have 2 elements"
  end
end

Version data entries

17 entries across 17 versions & 6 rubygems

Version Path
radiant-1.0.0 ruby-debug/ruby/1.8/gems/rspec-rails-1.3.4/spec/spec/rails/matchers/errors_on_spec.rb
richzhou-rspec-rails-1.3.4 spec/spec/rails/matchers/errors_on_spec.rb
rspec-rails-1.3.4 spec/spec/rails/matchers/errors_on_spec.rb
rspec-rails-1.3.3 spec/spec/rails/matchers/errors_on_spec.rb
rspec-rails-1.3.3.rc spec/spec/rails/matchers/errors_on_spec.rb
exception2db-0.0.1 test/rspec-rails/spec/spec/rails/matchers/errors_on_spec.rb
rspec-rails-w-factory_girl-1.3.2.1 spec/spec/rails/matchers/errors_on_spec.rb
rspec-rails-w-factory_girl-1.3.2 spec/spec/rails/matchers/errors_on_spec.rb
rspec-rails-1.3.2 spec/spec/rails/matchers/errors_on_spec.rb
rspec-rails-1.3.1 spec/spec/rails/matchers/errors_on_spec.rb
rspec-rails-1.3.0 spec/spec/rails/matchers/errors_on_spec.rb
hubbub-0.0.11 lib/vendor/plugins/rspec-rails/spec/spec/rails/matchers/errors_on_spec.rb
hubbub-0.0.10 lib/vendor/plugins/rspec-rails/spec/spec/rails/matchers/errors_on_spec.rb
hubbub-0.0.9 lib/vendor/plugins/rspec-rails/spec/spec/rails/matchers/errors_on_spec.rb
hubbub-0.0.8 lib/vendor/plugins/rspec-rails/spec/spec/rails/matchers/errors_on_spec.rb
hubbub-0.0.6 lib/vendor/plugins/rspec-rails/spec/spec/rails/matchers/errors_on_spec.rb
rspec-rails-1.2.9 spec/spec/rails/matchers/errors_on_spec.rb