Sha256: f8976ce8e8b81098db1a2861b3bb89309a0f5b2ef06f9bc26b1c475ee48fa76d

Contents?: true

Size: 1.15 KB

Versions: 10

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 raise_error("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 raise_error("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 raise_error("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

10 entries across 10 versions & 1 rubygems

Version Path
rspec-rails-2.0.0.beta.17 spec/rspec/rails/matchers/errors_on_spec.rb
rspec-rails-2.0.0.beta.16 spec/rspec/rails/matchers/errors_on_spec.rb
rspec-rails-2.0.0.beta.15 spec/rspec/rails/matchers/errors_on_spec.rb
rspec-rails-2.0.0.beta.14.2 spec/rspec/rails/matchers/errors_on_spec.rb
rspec-rails-2.0.0.beta.14.1 spec/rspec/rails/matchers/errors_on_spec.rb
rspec-rails-2.0.0.beta.13 spec/rspec/rails/matchers/errors_on_spec.rb
rspec-rails-2.0.0.beta.12 spec/rspec/rails/matchers/errors_on_spec.rb
rspec-rails-2.0.0.beta.11 spec/rspec/rails/matchers/errors_on_spec.rb
rspec-rails-2.0.0.beta.10 spec/rspec/rails/matchers/errors_on_spec.rb
rspec-rails-2.0.0.beta.9.1 spec/rspec/rails/matchers/errors_on_spec.rb