Skip to content
Browse files

Remove 'should' from example docstrings

- Closes #11.
  • Loading branch information...
1 parent 0f26a24 commit c1ce142fcd309eff6629c6bdc03d43f92a56dfc5 @justinko justinko committed with dchelimsky Aug 14, 2010
View
6 spec/rspec/expectations/differ_spec.rb
@@ -26,7 +26,7 @@ def inspect
@differ = RSpec::Expectations::Differ.new(@options)
end
- it "should output unified diff of two strings" do
+ it "outputs unified diff of two strings" do
expected="foo\nbar\nzap\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nline\n"
actual="foo\nzap\nbar\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nanother\nline\n"
expected_diff= <<'EOD'
@@ -52,7 +52,7 @@ def inspect
diff.should eql(expected_diff)
end
- it "should output unified diff message of two arrays" do
+ it "outputs unified diff message of two arrays" do
expected = [ :foo, 'bar', :baz, 'quux', :metasyntactic, 'variable', :delta, 'charlie', :width, 'quite wide' ]
actual = [ :foo, 'bar', :baz, 'quux', :metasyntactic, 'variable', :delta, 'tango' , :width, 'very wide' ]
@@ -75,7 +75,7 @@ def inspect
diff.should == expected_diff
end
- it "should output unified diff message of two objects" do
+ it "outputs unified diff message of two objects" do
expected = RSpec::Fixtures::Animal.new "bob", "giraffe"
actual = RSpec::Fixtures::Animal.new "bob", "tortoise"
View
4 spec/rspec/expectations/handler_spec.rb
@@ -184,7 +184,7 @@ module Expectations
describe PositiveExpectationHandler do
include ExampleExpectations
- it "should handle submitted args" do
+ it "handles submitted args" do
5.should arbitrary_matcher(:expected => 5)
5.should arbitrary_matcher(:expected => "wrong").with(5)
lambda { 5.should arbitrary_matcher(:expected => 4) }.should fail_with("expected 4, got 5")
@@ -195,7 +195,7 @@ module Expectations
lambda { 5.should_not arbitrary_matcher(:expected => 4).with(5) }.should fail_with("expected not 5, got 5")
end
- it "should handle the submitted block" do
+ it "handles the submitted block" do
5.should arbitrary_matcher { 5 }
5.should arbitrary_matcher(:expected => 4) { 5 }
5.should arbitrary_matcher(:expected => 4).with(5) { 3 }
View
136 spec/rspec/matchers/be_spec.rb
@@ -1,45 +1,45 @@
require 'spec_helper'
describe "should be_predicate" do
- it "should pass when actual returns true for :predicate?" do
+ it "passes when actual returns true for :predicate?" do
actual = stub("actual", :happy? => true)
actual.should be_happy
end
- it "should pass when actual returns true for :predicates? (present tense)" do
+ it "passes when actual returns true for :predicates? (present tense)" do
actual = stub("actual", :exists? => true, :exist? => true)
actual.should be_exist
end
- it "should fail when actual returns false for :predicate?" do
+ it "fails when actual returns false for :predicate?" do
actual = stub("actual", :happy? => false)
lambda {
actual.should be_happy
}.should fail_with("expected happy? to return true, got false")
end
- it "should fail when actual returns false for :predicate?" do
+ it "fails when actual returns false for :predicate?" do
actual = stub("actual", :happy? => nil)
lambda {
actual.should be_happy
}.should fail_with("expected happy? to return true, got nil")
end
- it "should fail when actual does not respond to :predicate?" do
+ it "fails when actual does not respond to :predicate?" do
lambda {
Object.new.should be_happy
}.should raise_error(NameError, /happy\?/)
end
- it "should fail on error other than NameError" do
+ it "fails on error other than NameError" do
actual = stub("actual")
actual.should_receive(:foo?).and_raise("aaaah")
lambda {
actual.should be_foo
}.should raise_error(/aaaah/)
end
- it "should fail on error other than NameError (with the present tense predicate)" do
+ it "fails on error other than NameError (with the present tense predicate)" do
actual = Object.new
actual.should_receive(:foos?).and_raise("aaaah")
lambda {
@@ -49,84 +49,84 @@
end
describe "should_not be_predicate" do
- it "should pass when actual returns false for :sym?" do
+ it "passes when actual returns false for :sym?" do
actual = stub("actual", :happy? => false)
actual.should_not be_happy
end
- it "should pass when actual returns nil for :sym?" do
+ it "passes when actual returns nil for :sym?" do
actual = stub("actual", :happy? => nil)
actual.should_not be_happy
end
- it "should fail when actual returns true for :sym?" do
+ it "fails when actual returns true for :sym?" do
actual = stub("actual", :happy? => true)
lambda {
actual.should_not be_happy
}.should fail_with("expected happy? to return false, got true")
end
- it "should fail when actual does not respond to :sym?" do
+ it "fails when actual does not respond to :sym?" do
lambda {
Object.new.should_not be_happy
}.should raise_error(NameError)
end
end
describe "should be_predicate(*args)" do
- it "should pass when actual returns true for :predicate?(*args)" do
+ it "passes when actual returns true for :predicate?(*args)" do
actual = mock("actual")
actual.should_receive(:older_than?).with(3).and_return(true)
actual.should be_older_than(3)
end
- it "should fail when actual returns false for :predicate?(*args)" do
+ it "fails when actual returns false for :predicate?(*args)" do
actual = mock("actual")
actual.should_receive(:older_than?).with(3).and_return(false)
lambda {
actual.should be_older_than(3)
}.should fail_with("expected older_than?(3) to return true, got false")
end
- it "should fail when actual does not respond to :predicate?" do
+ it "fails when actual does not respond to :predicate?" do
lambda {
Object.new.should be_older_than(3)
}.should raise_error(NameError)
end
end
describe "should_not be_predicate(*args)" do
- it "should pass when actual returns false for :predicate?(*args)" do
+ it "passes when actual returns false for :predicate?(*args)" do
actual = mock("actual")
actual.should_receive(:older_than?).with(3).and_return(false)
actual.should_not be_older_than(3)
end
- it "should fail when actual returns true for :predicate?(*args)" do
+ it "fails when actual returns true for :predicate?(*args)" do
actual = mock("actual")
actual.should_receive(:older_than?).with(3).and_return(true)
lambda {
actual.should_not be_older_than(3)
}.should fail_with("expected older_than?(3) to return false, got true")
end
- it "should fail when actual does not respond to :predicate?" do
+ it "fails when actual does not respond to :predicate?" do
lambda {
Object.new.should_not be_older_than(3)
}.should raise_error(NameError)
end
end
describe "should be_predicate(&block)" do
- it "should pass when actual returns true for :predicate?(&block)" do
+ it "passes when actual returns true for :predicate?(&block)" do
actual = mock("actual")
delegate = mock("delegate")
actual.should_receive(:happy?).and_yield
delegate.should_receive(:check_happy).and_return(true)
actual.should be_happy { delegate.check_happy }
end
- it "should fail when actual returns false for :predicate?(&block)" do
+ it "fails when actual returns false for :predicate?(&block)" do
actual = mock("actual")
delegate = mock("delegate")
actual.should_receive(:happy?).and_yield
@@ -136,7 +136,7 @@
}.should fail_with("expected happy? to return true, got false")
end
- it "should fail when actual does not respond to :predicate?" do
+ it "fails when actual does not respond to :predicate?" do
delegate = mock("delegate", :check_happy => true)
lambda {
Object.new.should be_happy { delegate.check_happy }
@@ -145,15 +145,15 @@
end
describe "should_not be_predicate(&block)" do
- it "should pass when actual returns false for :predicate?(&block)" do
+ it "passes when actual returns false for :predicate?(&block)" do
actual = mock("actual")
delegate = mock("delegate")
actual.should_receive(:happy?).and_yield
delegate.should_receive(:check_happy).and_return(false)
actual.should_not be_happy { delegate.check_happy }
end
- it "should fail when actual returns true for :predicate?(&block)" do
+ it "fails when actual returns true for :predicate?(&block)" do
actual = mock("actual")
delegate = mock("delegate")
actual.should_receive(:happy?).and_yield
@@ -163,7 +163,7 @@
}.should fail_with("expected happy? to return false, got true")
end
- it "should fail when actual does not respond to :predicate?" do
+ it "fails when actual does not respond to :predicate?" do
delegate = mock("delegate", :check_happy => true)
lambda {
Object.new.should_not be_happy { delegate.check_happy }
@@ -172,15 +172,15 @@
end
describe "should be_predicate(*args, &block)" do
- it "should pass when actual returns true for :predicate?(*args, &block)" do
+ it "passes when actual returns true for :predicate?(*args, &block)" do
actual = mock("actual")
delegate = mock("delegate")
actual.should_receive(:older_than?).with(3).and_yield(3)
delegate.should_receive(:check_older_than).with(3).and_return(true)
actual.should be_older_than(3) { |age| delegate.check_older_than(age) }
end
- it "should fail when actual returns false for :predicate?(*args, &block)" do
+ it "fails when actual returns false for :predicate?(*args, &block)" do
actual = mock("actual")
delegate = mock("delegate")
actual.should_receive(:older_than?).with(3).and_yield(3)
@@ -190,7 +190,7 @@
}.should fail_with("expected older_than?(3) to return true, got false")
end
- it "should fail when actual does not respond to :predicate?" do
+ it "fails when actual does not respond to :predicate?" do
delegate = mock("delegate", :check_older_than => true)
lambda {
Object.new.should be_older_than(3) { |age| delegate.check_older_than(age) }
@@ -199,15 +199,15 @@
end
describe "should_not be_predicate(*args, &block)" do
- it "should pass when actual returns false for :predicate?(*args, &block)" do
+ it "passes when actual returns false for :predicate?(*args, &block)" do
actual = mock("actual")
delegate = mock("delegate")
actual.should_receive(:older_than?).with(3).and_yield(3)
delegate.should_receive(:check_older_than).with(3).and_return(false)
actual.should_not be_older_than(3) { |age| delegate.check_older_than(age) }
end
- it "should fail when actual returns true for :predicate?(*args, &block)" do
+ it "fails when actual returns true for :predicate?(*args, &block)" do
actual = mock("actual")
delegate = mock("delegate")
actual.should_receive(:older_than?).with(3).and_yield(3)
@@ -217,7 +217,7 @@
}.should fail_with("expected older_than?(3) to return false, got true")
end
- it "should fail when actual does not respond to :predicate?" do
+ it "fails when actual does not respond to :predicate?" do
delegate = mock("delegate", :check_older_than => true)
lambda {
Object.new.should_not be_older_than(3) { |age| delegate.check_older_than(age) }
@@ -226,190 +226,190 @@
end
describe "should be_true" do
- it "should pass when actual equal?(true)" do
+ it "passes when actual equal?(true)" do
true.should be_true
end
- it "should pass when actual is 1" do
+ it "passes when actual is 1" do
1.should be_true
end
- it "should fail when actual equal?(false)" do
+ it "fails when actual equal?(false)" do
lambda {
false.should be_true
}.should fail_with("expected false to be true")
end
end
describe "should be_false" do
- it "should pass when actual equal?(false)" do
+ it "passes when actual equal?(false)" do
false.should be_false
end
- it "should pass when actual equal?(nil)" do
+ it "passes when actual equal?(nil)" do
nil.should be_false
end
- it "should fail when actual equal?(true)" do
+ it "fails when actual equal?(true)" do
lambda {
true.should be_false
}.should fail_with("expected true to be false")
end
end
describe "should be_nil" do
- it "should pass when actual is nil" do
+ it "passes when actual is nil" do
nil.should be_nil
end
- it "should fail when actual is not nil" do
+ it "fails when actual is not nil" do
lambda {
:not_nil.should be_nil
}.should fail_with("expected nil, got :not_nil")
end
end
describe "should_not be_nil" do
- it "should pass when actual is not nil" do
+ it "passes when actual is not nil" do
:not_nil.should_not be_nil
end
- it "should fail when actual is nil" do
+ it "fails when actual is nil" do
lambda {
nil.should_not be_nil
}.should fail_with("expected not nil, got nil")
end
end
describe "should be <" do
- it "should pass when < operator returns true" do
+ it "passes when < operator returns true" do
3.should be < 4
end
- it "should fail when < operator returns false" do
+ it "fails when < operator returns false" do
lambda { 3.should be < 3 }.should fail_with("expected < 3, got 3")
end
- it "should describe itself" do
+ it "describes itself" do
be.<(4).description.should == "be < 4"
end
end
describe "should be <=" do
- it "should pass when <= operator returns true" do
+ it "passes when <= operator returns true" do
3.should be <= 4
4.should be <= 4
end
- it "should fail when <= operator returns false" do
+ it "fails when <= operator returns false" do
lambda { 3.should be <= 2 }.should fail_with("expected <= 2, got 3")
end
end
describe "should be >=" do
- it "should pass when >= operator returns true" do
+ it "passes when >= operator returns true" do
4.should be >= 4
5.should be >= 4
end
- it "should fail when >= operator returns false" do
+ it "fails when >= operator returns false" do
lambda { 3.should be >= 4 }.should fail_with("expected >= 4, got 3")
end
end
describe "should be >" do
- it "should pass when > operator returns true" do
+ it "passes when > operator returns true" do
5.should be > 4
end
- it "should fail when > operator returns false" do
+ it "fails when > operator returns false" do
lambda { 3.should be > 4 }.should fail_with("expected > 4, got 3")
end
end
describe "should be ==" do
- it "should pass when == operator returns true" do
+ it "passes when == operator returns true" do
5.should be == 5
end
- it "should fail when == operator returns false" do
+ it "fails when == operator returns false" do
lambda { 3.should be == 4 }.should fail_with("expected == 4, got 3")
end
end
describe "should be ===" do
- it "should pass when === operator returns true" do
+ it "passes when === operator returns true" do
Hash.should be === Hash.new
end
- it "should fail when === operator returns false" do
+ it "fails when === operator returns false" do
lambda { Hash.should be === "not a hash" }.should fail_with(%[expected === not a hash, got Hash])
end
end
describe "should_not with operators" do
- it "should coach user to stop using operators with should_not" do
+ it "coaches user to stop using operators with should_not" do
lambda {
5.should_not be < 6
}.should raise_error(/not only FAILED,\nit is a bit confusing./m)
end
end
describe "should be" do
- it "should pass if actual is truthy" do
+ it "passes if actual is truthy" do
true.should be
1.should be
end
- it "should fail if actual is false" do
+ it "fails if actual is false" do
lambda {false.should be}.should fail_with("expected false to evaluate to true")
end
- it "should fail if actual is nil" do
+ it "fails if actual is nil" do
lambda {nil.should be}.should fail_with("expected nil to evaluate to true")
end
- it "should describe itself" do
+ it "describes itself" do
be.description.should == "be"
end
end
describe "should_not be" do
- it "should pass if actual is falsy" do
+ it "passes if actual is falsy" do
false.should_not be
nil.should_not be
end
- it "should fail on true" do
+ it "fails on true" do
lambda {true.should_not be}.should fail_with("expected true to evaluate to false")
end
end
describe "should be(value)" do
- it "should pass if actual.equal?(value)" do
+ it "passes if actual.equal?(value)" do
5.should be(5)
end
- it "should fail if !actual.equal?(value)" do
+ it "fails if !actual.equal?(value)" do
lambda { 5.should be(6) }.should fail_with("expected 6, got 5")
end
- it "should describe itself" do
+ it "describes itself" do
be(5).description.should == "be 5"
end
end
describe "should_not be(value)" do
- it "should pass if !actual.equal?(value)" do
+ it "passes if !actual.equal?(value)" do
5.should_not be(6)
end
- it "should fail if !actual.equal?(value)" do
+ it "fails if !actual.equal?(value)" do
lambda { 5.should_not be(5) }.should fail_with("expected not 5, got 5")
end
end
describe "'should be' with operator" do
- it "should include 'be' in the description" do
+ it "includes 'be' in the description" do
(be > 6).description.should =~ /be > 6/
(be >= 6).description.should =~ /be >= 6/
(be <= 6).description.should =~ /be <= 6/
@@ -419,7 +419,7 @@
describe "arbitrary predicate with DelegateClass" do
- it "should access methods defined in the delegating class (LH[#48])" do
+ it "accesses methods defined in the delegating class (LH[#48])" do
pending("this fails in 1.9.2-preview3") unless RUBY_VERSION.to_s =~ /^1.8/
require 'delegate'
class ArrayDelegate < DelegateClass(Array)
@@ -439,12 +439,12 @@ def large?
end
describe "be_a, be_an" do
- it "should pass when class matches" do
+ it "passes when class matches" do
"foobar".should be_a(String)
[1,2,3].should be_an(Array)
end
- it "should fail when class does not match" do
+ it "fails when class does not match" do
"foobar".should_not be_a(Hash)
[1,2,3].should_not be_an(Integer)
end
View
86 spec/rspec/matchers/change_spec.rb
@@ -11,11 +11,11 @@ class SomethingExpected
@instance.some_value = 5
end
- it "should pass when actual is modified by the block" do
+ it "passes when actual is modified by the block" do
expect {@instance.some_value = 6}.to change(@instance, :some_value)
end
- it "should fail when actual is not modified by the block" do
+ it "fails when actual is not modified by the block" do
expect do
expect {}.to change(@instance, :some_value)
end.to fail_with("some_value should have changed, but is still 5")
@@ -32,11 +32,11 @@ class SomethingExpected
@instance.some_value = 5
end
- it "should pass when actual is not modified by the block" do
+ it "passes when actual is not modified by the block" do
expect { }.to_not change(@instance, :some_value)
end
- it "should fail when actual is not modified by the block" do
+ it "fails when actual is not modified by the block" do
expect do
expect {@instance.some_value = 6}.to_not change(@instance, :some_value)
end.to fail_with("some_value should not have changed, but did change from 5 to 6")
@@ -49,17 +49,17 @@ class SomethingExpected
@instance.some_value = 5
end
- it "should pass when actual is modified by the block" do
+ it "passes when actual is modified by the block" do
expect {@instance.some_value = 6}.to change { @instance.some_value }
end
- it "should fail when actual is not modified by the block" do
+ it "fails when actual is not modified by the block" do
expect do
expect {}.to change{ @instance.some_value }
end.to fail_with("result should have changed, but is still 5")
end
- it "should warn if passed a block using do/end instead of {}" do
+ it "warns if passed a block using do/end instead of {}" do
expect do
expect {}.to change do; end
end.to raise_error(RSpec::Matchers::MatcherError, /block passed to should or should_not/)
@@ -76,17 +76,17 @@ class SomethingExpected
@instance.some_value = 5
end
- it "should pass when actual is modified by the block" do
+ it "passes when actual is modified by the block" do
expect {}.to_not change{ @instance.some_value }
end
- it "should fail when actual is not modified by the block" do
+ it "fails when actual is not modified by the block" do
expect do
expect {@instance.some_value = 6}.to_not change { @instance.some_value }
end.to fail_with("result should not have changed, but did change from 5 to 6")
end
- it "should warn if passed a block using do/end instead of {}" do
+ it "warns if passed a block using do/end instead of {}" do
expect do
expect {}.to_not change do; end
end.to raise_error(RSpec::Matchers::MatcherError, /block passed to should or should_not/)
@@ -99,17 +99,17 @@ class SomethingExpected
@instance.some_value = 5
end
- it "should pass when attribute is changed by expected amount" do
+ it "passes when attribute is changed by expected amount" do
expect { @instance.some_value += 1 }.to change(@instance, :some_value).by(1)
end
- it "should fail when the attribute is changed by unexpected amount" do
+ it "fails when the attribute is changed by unexpected amount" do
expect do
expect { @instance.some_value += 2 }.to change(@instance, :some_value).by(1)
end.to fail_with("some_value should have been changed by 1, but was changed by 2")
end
- it "should fail when the attribute is changed by unexpected amount in the opposite direction" do
+ it "fails when the attribute is changed by unexpected amount in the opposite direction" do
expect do
expect { @instance.some_value -= 1 }.to change(@instance, :some_value).by(1)
end.to fail_with("some_value should have been changed by 1, but was changed by -1")
@@ -122,17 +122,17 @@ class SomethingExpected
@instance.some_value = 5
end
- it "should pass when attribute is changed by expected amount" do
+ it "passes when attribute is changed by expected amount" do
expect { @instance.some_value += 1 }.to change{@instance.some_value}.by(1)
end
- it "should fail when the attribute is changed by unexpected amount" do
+ it "fails when the attribute is changed by unexpected amount" do
expect do
expect { @instance.some_value += 2 }.to change{@instance.some_value}.by(1)
end.to fail_with("result should have been changed by 1, but was changed by 2")
end
- it "should fail when the attribute is changed by unexpected amount in the opposite direction" do
+ it "fails when the attribute is changed by unexpected amount in the opposite direction" do
expect do
expect { @instance.some_value -= 1 }.to change{@instance.some_value}.by(1)
end.to fail_with("result should have been changed by 1, but was changed by -1")
@@ -145,15 +145,15 @@ class SomethingExpected
@instance.some_value = 5
end
- it "should pass when attribute is changed by greater than the expected amount" do
+ it "passes when attribute is changed by greater than the expected amount" do
expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_least(1)
end
- it "should pass when attribute is changed by the expected amount" do
+ it "passes when attribute is changed by the expected amount" do
expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_least(2)
end
- it "should fail when the attribute is changed by less than the expected amount" do
+ it "fails when the attribute is changed by less than the expected amount" do
expect do
expect { @instance.some_value += 1 }.to change(@instance, :some_value).by_at_least(2)
end.to fail_with("some_value should have been changed by at least 2, but was changed by 1")
@@ -167,15 +167,15 @@ class SomethingExpected
@instance.some_value = 5
end
- it "should pass when attribute is changed by greater than expected amount" do
+ it "passes when attribute is changed by greater than expected amount" do
expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_least(1)
end
- it "should pass when attribute is changed by the expected amount" do
+ it "passes when attribute is changed by the expected amount" do
expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_least(2)
end
- it "should fail when the attribute is changed by less than the unexpected amount" do
+ it "fails when the attribute is changed by less than the unexpected amount" do
expect do
expect { @instance.some_value += 1 }.to change{@instance.some_value}.by_at_least(2)
end.to fail_with("result should have been changed by at least 2, but was changed by 1")
@@ -189,15 +189,15 @@ class SomethingExpected
@instance.some_value = 5
end
- it "should pass when attribute is changed by less than the expected amount" do
+ it "passes when attribute is changed by less than the expected amount" do
expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_most(3)
end
- it "should pass when attribute is changed by the expected amount" do
+ it "passes when attribute is changed by the expected amount" do
expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_most(2)
end
- it "should fail when the attribute is changed by greater than the expected amount" do
+ it "fails when the attribute is changed by greater than the expected amount" do
expect do
expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_most(1)
end.to fail_with("some_value should have been changed by at most 1, but was changed by 2")
@@ -211,15 +211,15 @@ class SomethingExpected
@instance.some_value = 5
end
- it "should pass when attribute is changed by less than expected amount" do
+ it "passes when attribute is changed by less than expected amount" do
expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_most(3)
end
- it "should pass when attribute is changed by the expected amount" do
+ it "passes when attribute is changed by the expected amount" do
expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_most(2)
end
- it "should fail when the attribute is changed by greater than the unexpected amount" do
+ it "fails when the attribute is changed by greater than the unexpected amount" do
expect do
expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_most(1)
end.to fail_with("result should have been changed by at most 1, but was changed by 2")
@@ -232,11 +232,11 @@ class SomethingExpected
@instance.some_value = 'string'
end
- it "should pass when attribute is == to expected value before executing block" do
+ it "passes when attribute is == to expected value before executing block" do
expect { @instance.some_value = "astring" }.to change(@instance, :some_value).from("string")
end
- it "should fail when attribute is not == to expected value before executing block" do
+ it "fails when attribute is not == to expected value before executing block" do
expect do
expect { @instance.some_value = "knot" }.to change(@instance, :some_value).from("cat")
end.to fail_with("some_value should have initially been \"cat\", but was \"string\"")
@@ -249,11 +249,11 @@ class SomethingExpected
@instance.some_value = 'string'
end
- it "should pass when attribute is == to expected value before executing block" do
+ it "passes when attribute is == to expected value before executing block" do
expect { @instance.some_value = "astring" }.to change{@instance.some_value}.from("string")
end
- it "should fail when attribute is not == to expected value before executing block" do
+ it "fails when attribute is not == to expected value before executing block" do
expect do
expect { @instance.some_value = "knot" }.to change{@instance.some_value}.from("cat")
end.to fail_with("result should have initially been \"cat\", but was \"string\"")
@@ -266,11 +266,11 @@ class SomethingExpected
@instance.some_value = 'string'
end
- it "should pass when attribute is == to expected value after executing block" do
+ it "passes when attribute is == to expected value after executing block" do
expect { @instance.some_value = "cat" }.to change(@instance, :some_value).to("cat")
end
- it "should fail when attribute is not == to expected value after executing block" do
+ it "fails when attribute is not == to expected value after executing block" do
expect do
expect { @instance.some_value = "cat" }.to change(@instance, :some_value).from("string").to("dog")
end.to fail_with("some_value should have been changed to \"dog\", but is now \"cat\"")
@@ -283,11 +283,11 @@ class SomethingExpected
@instance.some_value = 'string'
end
- it "should pass when attribute is == to expected value after executing block" do
+ it "passes when attribute is == to expected value after executing block" do
expect { @instance.some_value = "cat" }.to change{@instance.some_value}.to("cat")
end
- it "should fail when attribute is not == to expected value after executing block" do
+ it "fails when attribute is not == to expected value after executing block" do
expect do
expect { @instance.some_value = "cat" }.to change{@instance.some_value}.from("string").to("dog")
end.to fail_with("result should have been changed to \"dog\", but is now \"cat\"")
@@ -300,21 +300,21 @@ class SomethingExpected
@instance.some_value = 'string'
end
- it "should pass when #to comes before #from" do
+ it "passes when #to comes before #from" do
expect { @instance.some_value = "cat" }.to change(@instance, :some_value).to("cat").from("string")
end
- it "should pass when #from comes before #to" do
+ it "passes when #from comes before #to" do
expect { @instance.some_value = "cat" }.to change(@instance, :some_value).from("string").to("cat")
end
- it "should show the correct messaging when #after and #to are different" do
+ it "shows the correct messaging when #after and #to are different" do
expect do
expect { @instance.some_value = "cat" }.to change(@instance, :some_value).from("string").to("dog")
end.to fail_with("some_value should have been changed to \"dog\", but is now \"cat\"")
end
- it "should show the correct messaging when #before and #from are different" do
+ it "shows the correct messaging when #before and #from are different" do
expect do
expect { @instance.some_value = "cat" }.to change(@instance, :some_value).from("not_string").to("cat")
end.to fail_with("some_value should have initially been \"not_string\", but was \"string\"")
@@ -327,17 +327,17 @@ class SomethingExpected
@instance.some_value = 'string'
end
- it "should pass when #to comes before #from" do
+ it "passes when #to comes before #from" do
expect { @instance.some_value = "cat" }.to change{@instance.some_value}.to("cat").from("string")
end
- it "should pass when #from comes before #to" do
+ it "passes when #from comes before #to" do
expect { @instance.some_value = "cat" }.to change{@instance.some_value}.from("string").to("cat")
end
end
describe RSpec::Matchers::Change do
- it "should work when the receiver has implemented #send" do
+ it "works when the receiver has implemented #send" do
@instance = SomethingExpected.new
@instance.some_value = "string"
def @instance.send(*args); raise "DOH! Library developers shouldn't use #send!" end
View
2 spec/rspec/matchers/description_generation_spec.rb
@@ -153,7 +153,7 @@ def failure_message; ""; end
end.new
end
- it "should provide a helpful message when used in a string-less example block" do
+ it "provides a helpful message when used in a string-less example block" do
5.should matcher
RSpec::Matchers.generated_description.should =~ /When you call.*description method/m
end
View
10 spec/rspec/matchers/eql_spec.rb
@@ -3,27 +3,27 @@
module RSpec
module Matchers
describe "eql" do
- it "should match when actual.eql?(expected)" do
+ it "matches when actual.eql?(expected)" do
1.should eql(1)
end
- it "should not match when !actual.eql?(expected)" do
+ it "does not match when !actual.eql?(expected)" do
1.should_not eql(2)
end
- it "should describe itself" do
+ it "describes itself" do
matcher = eql(1)
matcher.matches?(1)
matcher.description.should == "eql 1"
end
- it "should provide message, expected and actual on #failure_message" do
+ it "provides message, expected and actual on #failure_message" do
matcher = eql("1")
matcher.matches?(1)
matcher.failure_message_for_should.should == "\nexpected \"1\"\n got 1\n\n(compared using eql?)\n"
end
- it "should provide message, expected and actual on #negative_failure_message" do
+ it "provides message, expected and actual on #negative_failure_message" do
matcher = eql(1)
matcher.matches?(1)
matcher.failure_message_for_should_not.should == "\nexpected 1 not to equal 1\n\n(compared using eql?)\n"
View
10 spec/rspec/matchers/equal_spec.rb
@@ -7,21 +7,21 @@ def inspect_object(o)
"#<#{o.class}:#{o.object_id}> => #{o.inspect}"
end
- it "should match when actual.equal?(expected)" do
+ it "matches when actual.equal?(expected)" do
1.should equal(1)
end
- it "should not match when !actual.equal?(expected)" do
+ it "does not match when !actual.equal?(expected)" do
1.should_not equal("1")
end
- it "should describe itself" do
+ it "describes itself" do
matcher = equal(1)
matcher.matches?(1)
matcher.description.should == "equal 1"
end
- it "should provide message on #failure_message" do
+ it "provides message on #failure_message" do
expected, actual = "1", "1"
matcher = equal(expected)
matcher.matches?(actual)
@@ -39,7 +39,7 @@ def inspect_object(o)
MESSAGE
end
- it "should provide message on #negative_failure_message" do
+ it "provides message on #negative_failure_message" do
expected = actual = "1"
matcher = equal(expected)
matcher.matches?(actual)
View
2 spec/rspec/matchers/exist_spec.rb
@@ -55,7 +55,7 @@ def should_exist
describe "outside of an example group" do
- it "should pass if target exists" do
+ it "passes if target exists" do
real_tester = SubstanceTester.new @real
real_tester.should_exist
end
View
22 spec/rspec/matchers/has_spec.rb
@@ -1,17 +1,17 @@
require 'spec_helper'
describe "should have_sym(*args)" do
- it "should pass if #has_sym?(*args) returns true" do
+ it "passes if #has_sym?(*args) returns true" do
{:a => "A"}.should have_key(:a)
end
- it "should fail if #has_sym?(*args) returns false" do
+ it "fails if #has_sym?(*args) returns false" do
lambda {
{:b => "B"}.should have_key(:a)
}.should fail_with("expected #has_key?(:a) to return true, got false")
end
- it "should fail if #has_sym?(*args) returns nil" do
+ it "fails if #has_sym?(*args) returns nil" do
klass = Class.new do
def has_foo?
end
@@ -21,13 +21,13 @@ def has_foo?
}.should fail_with("expected #has_foo?(nil) to return true, got false")
end
- it "should fail if target does not respond to #has_sym?" do
+ it "fails if target does not respond to #has_sym?" do
lambda {
Object.new.should have_key(:a)
}.should raise_error(NoMethodError)
end
- it "should reraise an exception thrown in #has_sym?(*args)" do
+ it "reraises an exception thrown in #has_sym?(*args)" do
o = Object.new
def o.has_sym?(*args)
raise "Funky exception"
@@ -37,31 +37,31 @@ def o.has_sym?(*args)
end
describe "should_not have_sym(*args)" do
- it "should pass if #has_sym?(*args) returns false" do
+ it "passes if #has_sym?(*args) returns false" do
{:a => "A"}.should_not have_key(:b)
end
- it "should pass if #has_sym?(*args) returns nil" do
+ it "passes if #has_sym?(*args) returns nil" do
klass = Class.new do
def has_foo?
end
end
klass.new.should_not have_foo
end
- it "should fail if #has_sym?(*args) returns true" do
+ it "fails if #has_sym?(*args) returns true" do
lambda {
{:a => "A"}.should_not have_key(:a)
}.should fail_with("expected #has_key?(:a) to return false, got true")
end
- it "should fail if target does not respond to #has_sym?" do
+ it "fails if target does not respond to #has_sym?" do
lambda {
Object.new.should have_key(:a)
}.should raise_error(NoMethodError)
end
- it "should reraise an exception thrown in #has_sym?(*args)" do
+ it "reraises an exception thrown in #has_sym?(*args)" do
o = Object.new
def o.has_sym?(*args)
raise "Funky exception"
@@ -71,7 +71,7 @@ def o.has_sym?(*args)
end
describe "has" do
- it "should work when the target implements #send" do
+ it "works when the target implements #send" do
o = {:a => "A"}
def o.send(*args); raise "DOH! Library developers shouldn't use #send!" end
lambda {
View
78 spec/rspec/matchers/have_spec.rb
@@ -29,19 +29,19 @@ def self.pluralize(string)
describe "should have(n).items" do
include HaveSpecHelper
- it "should pass if target has a collection of items with n members" do
+ it "passes if target has a collection of items with n members" do
owner = create_collection_owner_with(3)
owner.should have(3).items_in_collection_with_length_method
owner.should have(3).items_in_collection_with_size_method
end
- it "should convert :no to 0" do
+ it "converts :no to 0" do
owner = create_collection_owner_with(0)
owner.should have(:no).items_in_collection_with_length_method
owner.should have(:no).items_in_collection_with_size_method
end
- it "should fail if target has a collection of items with < n members" do
+ it "fails if target has a collection of items with < n members" do
owner = create_collection_owner_with(3)
lambda {
owner.should have(4).items_in_collection_with_length_method
@@ -51,7 +51,7 @@ def self.pluralize(string)
}.should fail_with("expected 4 items_in_collection_with_size_method, got 3")
end
- it "should fail if target has a collection of items with > n members" do
+ it "fails if target has a collection of items with > n members" do
owner = create_collection_owner_with(3)
lambda {
owner.should have(2).items_in_collection_with_length_method
@@ -65,7 +65,7 @@ def self.pluralize(string)
describe 'should have(1).item when ActiveSupport::Inflector is defined' do
include HaveSpecHelper
- it 'should pluralize the collection name' do
+ it 'pluralizes the collection name' do
owner = create_collection_owner_with(1)
owner.should have(1).item
end
@@ -93,7 +93,7 @@ def self.pluralize(string)
end
end
- it 'should pluralize the collection name' do
+ it 'pluralizes the collection name' do
owner = create_collection_owner_with(1)
owner.should have(1).item
end
@@ -106,7 +106,7 @@ def self.pluralize(string)
end
describe "should have(n).items where result responds to items but returns something other than a collection" do
- it "should provide a meaningful error" do
+ it "provides a meaningful error" do
owner = Class.new do
def items
Object.new
@@ -121,19 +121,19 @@ def items
describe "should_not have(n).items" do
include HaveSpecHelper
- it "should pass if target has a collection of items with < n members" do
+ it "passes if target has a collection of items with < n members" do
owner = create_collection_owner_with(3)
owner.should_not have(4).items_in_collection_with_length_method
owner.should_not have(4).items_in_collection_with_size_method
end
- it "should pass if target has a collection of items with > n members" do
+ it "passes if target has a collection of items with > n members" do
owner = create_collection_owner_with(3)
owner.should_not have(2).items_in_collection_with_length_method
owner.should_not have(2).items_in_collection_with_size_method
end
- it "should fail if target has a collection of items with n members" do
+ it "fails if target has a collection of items with n members" do
owner = create_collection_owner_with(3)
lambda {
owner.should_not have(3).items_in_collection_with_length_method
@@ -147,19 +147,19 @@ def items
describe "should have_exactly(n).items" do
include HaveSpecHelper
- it "should pass if target has a collection of items with n members" do
+ it "passes if target has a collection of items with n members" do
owner = create_collection_owner_with(3)
owner.should have_exactly(3).items_in_collection_with_length_method
owner.should have_exactly(3).items_in_collection_with_size_method
end
- it "should convert :no to 0" do
+ it "converts :no to 0" do
owner = create_collection_owner_with(0)
owner.should have_exactly(:no).items_in_collection_with_length_method
owner.should have_exactly(:no).items_in_collection_with_size_method
end
- it "should fail if target has a collection of items with < n members" do
+ it "fails if target has a collection of items with < n members" do
owner = create_collection_owner_with(3)
lambda {
owner.should have_exactly(4).items_in_collection_with_length_method
@@ -169,7 +169,7 @@ def items
}.should fail_with("expected 4 items_in_collection_with_size_method, got 3")
end
- it "should fail if target has a collection of items with > n members" do
+ it "fails if target has a collection of items with > n members" do
owner = create_collection_owner_with(3)
lambda {
owner.should have_exactly(2).items_in_collection_with_length_method
@@ -183,19 +183,19 @@ def items
describe "should have_at_least(n).items" do
include HaveSpecHelper
- it "should pass if target has a collection of items with n members" do
+ it "passes if target has a collection of items with n members" do
owner = create_collection_owner_with(3)
owner.should have_at_least(3).items_in_collection_with_length_method
owner.should have_at_least(3).items_in_collection_with_size_method
end
- it "should pass if target has a collection of items with > n members" do
+ it "passes if target has a collection of items with > n members" do
owner = create_collection_owner_with(3)
owner.should have_at_least(2).items_in_collection_with_length_method
owner.should have_at_least(2).items_in_collection_with_size_method
end
- it "should fail if target has a collection of items with < n members" do
+ it "fails if target has a collection of items with < n members" do
owner = create_collection_owner_with(3)
lambda {
owner.should have_at_least(4).items_in_collection_with_length_method
@@ -205,7 +205,7 @@ def items
}.should fail_with("expected at least 4 items_in_collection_with_size_method, got 3")
end
- it "should provide educational negative failure messages" do
+ it "provides educational negative failure messages" do
#given
owner = create_collection_owner_with(3)
length_matcher = have_at_least(3).items_in_collection_with_length_method
@@ -237,13 +237,13 @@ def items
describe "should have_at_most(n).items" do
include HaveSpecHelper
- it "should pass if target has a collection of items with n members" do
+ it "passes if target has a collection of items with n members" do
owner = create_collection_owner_with(3)
owner.should have_at_most(3).items_in_collection_with_length_method
owner.should have_at_most(3).items_in_collection_with_size_method
end
- it "should fail if target has a collection of items with > n members" do
+ it "fails if target has a collection of items with > n members" do
owner = create_collection_owner_with(3)
lambda {
owner.should have_at_most(2).items_in_collection_with_length_method
@@ -253,13 +253,13 @@ def items
}.should fail_with("expected at most 2 items_in_collection_with_size_method, got 3")
end
- it "should pass if target has a collection of items with < n members" do
+ it "passes if target has a collection of items with < n members" do
owner = create_collection_owner_with(3)
owner.should have_at_most(4).items_in_collection_with_length_method
owner.should have_at_most(4).items_in_collection_with_size_method
end
- it "should provide educational negative failure messages" do
+ it "provides educational negative failure messages" do
#given
owner = create_collection_owner_with(3)
length_matcher = have_at_most(3).items_in_collection_with_length_method
@@ -289,13 +289,13 @@ def items
end
describe "have(n).items(args, block)" do
- it "should pass args to target" do
+ it "passes args to target" do
target = mock("target")
target.should_receive(:items).with("arg1","arg2").and_return([1,2,3])
target.should have(3).items("arg1","arg2")
end
- it "should pass block to target" do
+ it "passes block to target" do
target = mock("target")
block = lambda { 5 }
target.should_receive(:items).with("arg1","arg2", block).and_return([1,2,3])
@@ -304,27 +304,27 @@ def items
end
describe "have(n).items where target IS a collection" do
- it "should reference the number of items IN the collection" do
+ it "references the number of items IN the collection" do
[1,2,3].should have(3).items
end
- it "should fail when the number of items IN the collection is not as expected" do
+ it "fails when the number of items IN the collection is not as expected" do
lambda { [1,2,3].should have(7).items }.should fail_with("expected 7 items, got 3")
end
end
describe "have(n).characters where target IS a String" do
- it "should pass if the length is correct" do
+ it "passes if the length is correct" do
"this string".should have(11).characters
end
- it "should fail if the length is incorrect" do
+ it "fails if the length is incorrect" do
lambda { "this string".should have(12).characters }.should fail_with("expected 12 characters, got 11")
end
end
describe "have(n).things on an object which is not a collection nor contains one" do
- it "should fail" do
+ it "fails" do
lambda { Object.new.should have(2).things }.should raise_error(NoMethodError, /undefined method `things' for #<Object:/)
end
end
@@ -338,19 +338,19 @@ def @collection.floozles; [1,2] end
def @collection.send(*args); raise "DOH! Library developers shouldn't use #send!" end
end
- it "should work in the straightforward case" do
+ it "works in the straightforward case" do
lambda {
@collection.should have(2).floozles
}.should_not raise_error
end
- it "should work when doing automatic pluralization" do
+ it "works when doing automatic pluralization" do
lambda {
@collection.should have_at_least(1).floozle
}.should_not raise_error
end
- it "should blow up when the owner doesn't respond to that method" do
+ it "blows up when the owner doesn't respond to that method" do
lambda {
@collection.should have(99).problems
}.should raise_error(NoMethodError, /problems/)
@@ -360,7 +360,7 @@ def @collection.send(*args); raise "DOH! Library developers shouldn't use #send!
module RSpec
module Matchers
describe Have do
- it "should have method_missing as private" do
+ it "has method_missing as private" do
with_ruby 1.8 do
described_class.private_instance_methods.should include("method_missing")
end
@@ -369,7 +369,7 @@ module Matchers
end
end
- it "should not respond_to? method_missing (because it's private)" do
+ it "does not respond_to? method_missing (because it's private)" do
formatter = described_class.new({ }, StringIO.new)
formatter.should_not respond_to(:method_missing)
end
@@ -381,24 +381,24 @@ module Matchers
@a_method_which_object_defines = Object.instance_methods.first
end
- it "should be true for a method which Have defines" do
+ it "is true for a method which Have defines" do
@have.should respond_to(@a_method_which_have_defines)
end
- it "should be true for a method that it's superclass (Object) defines" do
+ it "is true for a method that it's superclass (Object) defines" do
@have.should respond_to(@a_method_which_object_defines)
end
- it "should be false for a method which neither Object nor nor Have defines" do
+ it "is false for a method which neither Object nor nor Have defines" do
@have.should_not respond_to(:foo_bar_baz)
end
- it "should be false if the owner doesn't respond to the method" do
+ it "is false if the owner doesn't respond to the method" do
have = Have.new(99)
have.should_not respond_to(:problems)
end
- it "should be true if the owner responds to the method" do
+ it "is true if the owner responds to the method" do
have = Have.new(:a_symbol)
have.should respond_to(:to_sym)
end
View
28 spec/rspec/matchers/include_spec.rb
@@ -1,16 +1,16 @@
require 'spec_helper'
describe "should include(expected)" do
- it "should pass if target includes expected" do
+ it "passes if target includes expected" do
[1,2,3].should include(3)
"abc".should include("a")
end
- it 'should pass if target is a Hash and has the expected as a key' do
+ it 'passes if target is a Hash and has the expected as a key' do
{:key => 'value'}.should include(:key)
end
- it "should fail if target does not include expected" do
+ it "fails if target does not include expected" do
lambda {
[1,2,3].should include(4)
}.should fail_with("expected [1, 2, 3] to include 4")
@@ -24,38 +24,38 @@
end
describe "should include(with, multiple, args)" do
- it "should pass if target includes all items" do
+ it "passes if target includes all items" do
[1,2,3].should include(1,2,3)
end
- it 'should pass if target is a Hash including all items as keys' do
+ it 'passes if target is a Hash including all items as keys' do
{:key => 'value', :other => 'value'}.should include(:key, :other)
end
- it "should fail if target does not include any one of the items" do
+ it "fails if target does not include any one of the items" do
lambda {
[1,2,3].should include(1,2,4)
}.should fail_with("expected [1, 2, 3] to include 1, 2, and 4")
end
- it 'should pass if target is a Hash missing any item as a key' do
+ it 'passes if target is a Hash missing any item as a key' do
lambda {
{:key => 'value'}.should include(:key, :other)
}.should fail_with(%Q|expected {:key=>"value"} to include :key and :other|)
end
end
describe "should_not include(expected)" do
- it "should pass if target does not include expected" do
+ it "passes if target does not include expected" do
[1,2,3].should_not include(4)
"abc".should_not include("d")
end
- it 'should pass if target is a Hash and does not have the expected as a key' do
+ it 'passes if target is a Hash and does not have the expected as a key' do
{:other => 'value'}.should_not include(:key)
end
- it "should fail if target includes expected" do
+ it "fails if target includes expected" do
lambda {
[1,2,3].should_not include(3)
}.should fail_with("expected [1, 2, 3] not to include 3")
@@ -69,18 +69,18 @@
end
describe "should include(:key => value)" do
- it "should pass if target is a Hash and includes the key/value pair" do
+ it "passes if target is a Hash and includes the key/value pair" do
{:key => 'value'}.should include(:key => 'value')
end
- it "should pass if target is a Hash and includes the key/value pair among others" do
+ it "passes if target is a Hash and includes the key/value pair among others" do
{:key => 'value', :other => 'different'}.should include(:key => 'value')
end
- it "should fail if target is a Hash and has a different value for key" do
+ it "fails if target is a Hash and has a different value for key" do
lambda {
{:key => 'different'}.should include(:key => 'value')
}.should fail_with(%Q|expected {:key=>"different"} to include {:key=>"value"}|)
end
- it "should fail if target is a Hash and has a different key" do
+ it "fails if target is a Hash and has a different key" do
lambda {
{:other => 'value'}.should include(:key => 'value')
}.should fail_with(%Q|expected {:other=>"value"} to include {:key=>"value"}|)
View
20 spec/rspec/matchers/match_array_spec.rb
@@ -18,15 +18,15 @@ def ==(other)
end
describe "array.should =~ other_array" do
- it "should pass if target contains all items" do
+ it "passes if target contains all items" do
[1,2,3].should =~ [1,2,3]
end
- it "should pass if target contains all items out of order" do
+ it "passes if target contains all items out of order" do
[1,3,2].should =~ [1,2,3]
end
- it "should fail if target includes extra items" do
+ it "fails if target includes extra items" do
lambda {
[1,2,3,4].should =~ [1,2,3]
}.should fail_with(<<-MESSAGE)
@@ -36,7 +36,7 @@ def ==(other)
MESSAGE
end
- it "should fail if target is missing items" do
+ it "fails if target is missing items" do
lambda {
[1,2].should =~ [1,2,3]
}.should fail_with(<<-MESSAGE)
@@ -46,7 +46,7 @@ def ==(other)
MESSAGE
end
- it "should fail if target is missing items and has extra items" do
+ it "fails if target is missing items and has extra items" do
lambda {
[1,2,4].should =~ [1,2,3]
@@ -58,7 +58,7 @@ def ==(other)
MESSAGE
end
- it "should sort items in the error message if they all respond to <=>" do
+ it "sorts items in the error message if they all respond to <=>" do
lambda {
[6,2,1,5].should =~ [4,1,2,3]
}.should fail_with(<<-MESSAGE)
@@ -69,7 +69,7 @@ def ==(other)
MESSAGE
end
- it "should not sort items in the error message if they don't all respond to <=>" do
+ it "does not sort items in the error message if they don't all respond to <=>" do
lambda {
[UnsortableObject.new(2), UnsortableObject.new(1)].should =~ [UnsortableObject.new(4), UnsortableObject.new(3)]
}.should fail_with(<<-MESSAGE)
@@ -80,7 +80,7 @@ def ==(other)
MESSAGE
end
- it "should accurately report extra elements when there are duplicates" do
+ it "accurately reports extra elements when there are duplicates" do
lambda {
[1,1,1,5].should =~ [1,5]
}.should fail_with(<<-MESSAGE)
@@ -90,7 +90,7 @@ def ==(other)
MESSAGE
end
- it "should accurately report missing elements when there are duplicates" do
+ it "accurately reports missing elements when there are duplicates" do
lambda {
[1,5].should =~ [1,1,5]
}.should fail_with(<<-MESSAGE)
@@ -103,7 +103,7 @@ def ==(other)
end
describe "should_not =~ [:with, :multiple, :args]" do
- it "should not be supported" do
+ it "is not supported" do
lambda {
[1,2,3].should_not =~ [1,2,3]
}.should fail_with(/Matcher does not support should_not/)
View
20 spec/rspec/matchers/match_spec.rb
@@ -1,55 +1,55 @@
require 'spec_helper'
describe "should match(expected)" do
- it "should pass when target (String) matches expected (Regexp)" do
+ it "passes when target (String) matches expected (Regexp)" do
"string".should match(/tri/)
end
- it "should pass when target (String) matches expected (String)" do
+ it "passes when target (String) matches expected (String)" do
"string".should match("tri")
end
- it "should fail when target (String) does not match expected (Regexp)" do
+ it "fails when target (String) does not match expected (Regexp)" do
lambda {
"string".should match(/rings/)
}.should fail
end
- it "should fail when target (String) does not match expected (String)" do
+ it "fails when target (String) does not match expected (String)" do
lambda {
"string".should match("rings")
}.should fail
end
- it "should provide message, expected and actual on failure" do
+ it "provides message, expected and actual on failure" do
matcher = match(/rings/)
matcher.matches?("string")
matcher.failure_message_for_should.should == "expected \"string\" to match /rings/"
end
end
describe "should_not match(expected)" do
- it "should pass when target (String) matches does not match (Regexp)" do
+ it "passes when target (String) matches does not match (Regexp)" do
"string".should_not match(/rings/)
end
- it "should pass when target (String) matches does not match (String)" do
+ it "passes when target (String) matches does not match (String)" do
"string".should_not match("rings")
end
- it "should fail when target (String) matches expected (Regexp)" do
+ it "fails when target (String) matches expected (Regexp)" do
lambda {
"string".should_not match(/tri/)
}.should fail
end
- it "should fail when target (String) matches expected (String)" do
+ it "fails when target (String) matches expected (String)" do
lambda {
"string".should_not match("tri")
}.should fail
end
- it "should provide message, expected and actual on failure" do
+ it "provides message, expected and actual on failure" do
matcher = match(/tri/)
matcher.matches?("string")
matcher.failure_message_for_should_not.should == "expected \"string\" not to match /tri/"
View
48 spec/rspec/matchers/operator_matcher_spec.rb
@@ -2,18 +2,18 @@
describe "should ==" do
- it "should delegate message to target" do
+ it "delegates message to target" do
subject = "apple"
subject.should_receive(:==).with("apple").and_return(true)
subject.should == "apple"
end
- it "should return true on success" do
+ it "returns true on success" do
subject = "apple"
(subject.should == "apple").should be_true
end
- it "should fail when target.==(actual) returns false" do
+ it "fails when target.==(actual) returns false" do
subject = "apple"
RSpec::Expectations.should_receive(:fail_with).with(%[expected: "orange",\n got: "apple" (using ==)], "orange", "apple")
subject.should == "orange"
@@ -23,18 +23,18 @@
describe "should_not ==" do
- it "should delegate message to target" do
+ it "delegates message to target" do
subject = "orange"
subject.should_receive(:==).with("apple").and_return(false)
subject.should_not == "apple"
end
- it "should return true on success" do
+ it "returns true on success" do
subject = "apple"
(subject.should_not == "orange").should be_false
end
- it "should fail when target.==(actual) returns false" do
+ it "fails when target.==(actual) returns false" do
subject = "apple"
RSpec::Expectations.should_receive(:fail_with).with(%[expected not: == "apple",\n got: "apple"], "apple", "apple")
subject.should_not == "apple"
@@ -44,13 +44,13 @@
describe "should ===" do
- it "should delegate message to target" do
+ it "delegates message to target" do
subject = "apple"
subject.should_receive(:===).with("apple").and_return(true)
subject.should === "apple"
end
- it "should fail when target.===(actual) returns false" do
+ it "fails when target.===(actual) returns false" do
subject = "apple"
subject.should_receive(:===).with("orange").and_return(false)
RSpec::Expectations.should_receive(:fail_with).with(%[expected: "orange",\n got: "apple" (using ===)], "orange", "apple")
@@ -61,13 +61,13 @@
describe "should_not ===" do
- it "should delegate message to target" do
+ it "delegates message to target" do
subject = "orange"
subject.should_receive(:===).with("apple").and_return(false)
subject.should_not === "apple"
end
- it "should fail when target.===(actual) returns false" do
+ it "fails when target.===(actual) returns false" do
subject = "apple"
subject.should_receive(:===).with("apple").and_return(true)
RSpec::Expectations.should_receive(:fail_with).with(%[expected not: === "apple",\n got: "apple"], "apple", "apple")
@@ -78,13 +78,13 @@
describe "should =~" do
- it "should delegate message to target" do
+ it "delegates message to target" do
subject = "foo"
subject.should_receive(:=~).with(/oo/).and_return(true)
subject.should =~ /oo/
end
- it "should fail when target.=~(actual) returns false" do
+ it "fails when target.=~(actual) returns false" do
subject = "fu"
subject.should_receive(:=~).with(/oo/).and_return(false)
RSpec::Expectations.should_receive(:fail_with).with(%[expected: /oo/,\n got: "fu" (using =~)], /oo/, "fu")
@@ -95,13 +95,13 @@
describe "should_not =~" do
- it "should delegate message to target" do
+ it "delegates message to target" do
subject = "fu"
subject.should_receive(:=~).with(/oo/).and_return(false)
subject.should_not =~ /oo/
end
- it "should fail when target.=~(actual) returns false" do
+ it "fails when target.=~(actual) returns false" do
subject = "foo"
subject.should_receive(:=~).with(/oo/).and_return(true)
RSpec::Expectations.should_receive(:fail_with).with(%[expected not: =~ /oo/,\n got: "foo"], /oo/, "foo")
@@ -112,11 +112,11 @@
describe "should >" do
- it "should pass if > passes" do
+ it "passes if > passes" do
4.should > 3
end
- it "should fail if > fails" do
+ it "fails if > fails" do
RSpec::Expectations.should_receive(:fail_with).with(%[expected: > 5,\n got: 4], 5, 4)
4.should > 5
end
@@ -125,12 +125,12 @@
describe "should >=" do
- it "should pass if >= passes" do
+ it "passes if >= passes" do
4.should > 3
4.should >= 4
end
- it "should fail if > fails" do
+ it "fails if > fails" do
RSpec::Expectations.should_receive(:fail_with).with(%[expected: >= 5,\n got: 4], 5, 4)
4.should >= 5
end
@@ -139,11 +139,11 @@
describe "should <" do
- it "should pass if < passes" do
+ it "passes if < passes" do
4.should < 5
end
- it "should fail if > fails" do
+ it "fails if > fails" do
RSpec::Expectations.should_receive(:fail_with).with(%[expected: < 3,\n got: 4], 3, 4)
4.should < 3
end
@@ -152,12 +152,12 @@
describe "should <=" do
- it "should pass if <= passes" do
+ it "passes if <= passes" do
4.should <= 5
4.should <= 4
end
- it "should fail if > fails" do
+ it "fails if > fails" do
RSpec::Expectations.should_receive(:fail_with).with(%[expected: <= 3,\n got: 4], 3, 4)
4.should <= 3
end
@@ -166,7 +166,7 @@
describe RSpec::Matchers::PositiveOperatorMatcher do
- it "should work when the target has implemented #send" do
+ it "works when the target has implemented #send" do
o = Object.new
def o.send(*args); raise "DOH! Library developers shouldn't use #send!" end
lambda {
@@ -178,7 +178,7 @@ def o.send(*args); raise "DOH! Library developers shouldn't use #send!" end
describe RSpec::Matchers::NegativeOperatorMatcher do
- it "should work when the target has implemented #send" do
+ it "works when the target has implemented #send" do
o = Object.new
def o.send(*args); raise "DOH! Library developers shouldn't use #send!" end
lambda {
View
92 spec/rspec/matchers/raise_error_spec.rb
@@ -1,19 +1,19 @@
require 'spec_helper'
describe "should raise_error" do
- it "should pass if anything is raised" do
+ it "passes if anything is raised" do
lambda {raise}.should raise_error
end
- it "should fail if nothing is raised" do
+ it "fails if nothing is raised" do
lambda {
lambda {}.should raise_error
}.should fail_with("expected Exception but nothing was raised")
end
end
describe "raise_exception aliased to raise_error" do
- it "should pass if anything is raised" do
+ it "passes if anything is raised" do
lambda {raise}.should raise_exception
end
end
@@ -37,124 +37,124 @@
end
describe "should_not raise_error" do
- it "should pass if nothing is raised" do
+ it "passes if nothing is raised" do
lambda {}.should_not raise_error
end
- it "should fail if anything is raised" do
+ it "fails if anything is raised" do
lambda {
lambda {raise}.should_not raise_error
}.should fail_with("expected no Exception, got RuntimeError")
end
end
describe "should raise_error(message)" do
- it "should pass if RuntimeError is raised with the right message" do
+ it "passes if RuntimeError is raised with the right message" do
lambda {raise 'blah'}.should raise_error('blah')
end
- it "should pass if RuntimeError is raised with a matching message" do
+ it "passes if RuntimeError is raised with a matching message" do
lambda {raise 'blah'}.should raise_error(/blah/)
end
- it "should pass if any other error is raised with the right message" do
+ it "passes if any other error is raised with the right message" do
lambda {raise NameError.new('blah')}.should raise_error('blah')
end
- it "should fail if RuntimeError error is raised with the wrong message" do
+ it "fails if RuntimeError error is raised with the wrong message" do
lambda do
lambda {raise 'blarg'}.should raise_error('blah')
end.should fail_with("expected Exception with \"blah\", got #<RuntimeError: blarg>")
end
- it "should fail if any other error is raised with the wrong message" do
+ it "fails if any other error is raised with the wrong message" do
lambda do
lambda {raise NameError.new('blarg')}.should raise_error('blah')
end.should fail_with("expected Exception with \"blah\", got #<NameError: blarg>")
end
end
describe "should_not raise_error(message)" do
- it "should pass if RuntimeError error is raised with the different message" do
+ it "passes if RuntimeError error is raised with the different message" do
lambda {raise 'blarg'}.should_not raise_error('blah')
end
- it "should pass if any other error is raised with the wrong message" do
+ it "passes if any other error is raised with the wrong message" do
lambda {raise NameError.new('blarg')}.should_not raise_error('blah')
end
- it "should fail if RuntimeError is raised with message" do
+ it "fails if RuntimeError is raised with message" do
lambda do
lambda {raise 'blah'}.should_not raise_e