Permalink
Browse files

Cleanup based on PR feedback

  • Loading branch information...
1 parent 80b75a0 commit 107c5d57e4fb0926c04170c70eafabe24e4eb91d @soulcutter soulcutter committed Feb 20, 2014
Showing with 10 additions and 12 deletions.
  1. +1 −1 lib/rspec/collection_matchers.rb
  2. +9 −11 spec/rspec/collection_matchers/rails/have_extensions_spec.rb
@@ -1,4 +1,4 @@
require 'rspec/collection_matchers/version'
require 'rspec/collection_matchers/matchers'
require 'rspec/collection_matchers/have'
-require 'rspec/collection_matchers/rails' if defined? Rails
+require 'rspec/collection_matchers/rails' if defined? Rails && respond_to?(:alias_method_chain)
@@ -5,40 +5,38 @@ module RSpec::CollectionMatchers::Rails
describe HaveExtensions do
describe "error_on" do
it "provides a description including the name of what the error is on" do
- have(1).error_on(:whatever).description.should == "have 1 error on :whatever"
+ expect(have(1).error_on(:whatever).description).to eq "have 1 error on :whatever"
end
it "provides a failure message including the number actually given" do
- lambda {
+ expect {
[].should have(1).error_on(:whatever)
- }.should raise_error("expected 1 error on :whatever, got 0")
+ }.to raise_error("expected 1 error on :whatever, got 0")
end
end
describe "errors_on" do
it "provides a description including the name of what the error is on" do
- have(2).errors_on(:whatever).description.should == "have 2 errors on :whatever"
+ expect(have(2).errors_on(:whatever).description).to eq "have 2 errors on :whatever"
end
it "provides a failure message including the number actually given" do
- lambda {
+ expect {
[1].should have(3).errors_on(:whatever)
- }.should raise_error("expected 3 errors on :whatever, got 1")
+ }.to 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 {
+ expect {
[1,2,3].should have(2).elements
- }.should raise_error("expected 2 elements, got 3")
+ }.to raise_error("expected 2 elements, got 3")
end
it "has a standard rspec description" do
- RSpec::CollectionMatchers::Have
- have(2).elements.description.should == "have 2 elements"
+ expect(have(2).elements.description).to eq "have 2 elements"
end
end
end
end
-

0 comments on commit 107c5d5

Please sign in to comment.