Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove 'should' from example docstrings

- Closes #11.
  • Loading branch information...
commit 20194cf0fdaaf916b55a33fcc237f705e27f559a 1 parent 2d7bc36
@justinko justinko authored dchelimsky committed
Showing with 273 additions and 273 deletions.
  1. +4 −4 spec/rspec/mocks/any_number_of_times_spec.rb
  2. +2 −2 spec/rspec/mocks/argument_expectation_spec.rb
  3. +11 −11 spec/rspec/mocks/at_least_spec.rb
  4. +11 −11 spec/rspec/mocks/at_most_spec.rb
  5. +1 −1  spec/rspec/mocks/bug_report_10260_spec.rb
  6. +3 −3 spec/rspec/mocks/bug_report_11545_spec.rb
  7. +2 −2 spec/rspec/mocks/bug_report_15719_spec.rb
  8. +2 −2 spec/rspec/mocks/bug_report_600_spec.rb
  9. +1 −1  spec/rspec/mocks/bug_report_7611_spec.rb
  10. +2 −2 spec/rspec/mocks/bug_report_8165_spec.rb
  11. +2 −2 spec/rspec/mocks/bug_report_957_spec.rb
  12. +12 −12 spec/rspec/mocks/failing_argument_matchers_spec.rb
  13. +18 −18 spec/rspec/mocks/hash_including_matcher_spec.rb
  14. +13 −13 spec/rspec/mocks/hash_not_including_matcher_spec.rb
  15. +7 −7 spec/rspec/mocks/mock_ordering_spec.rb
  16. +4 −4 spec/rspec/mocks/mock_space_spec.rb
  17. +65 −65 spec/rspec/mocks/mock_spec.rb
  18. +11 −11 spec/rspec/mocks/multiple_return_value_spec.rb
  19. +4 −4 spec/rspec/mocks/nil_expectation_warning_spec.rb
  20. +7 −7 spec/rspec/mocks/null_object_mock_spec.rb
  21. +6 −6 spec/rspec/mocks/once_counts_spec.rb
  22. +3 −3 spec/rspec/mocks/options_hash_spec.rb
  23. +17 −17 spec/rspec/mocks/partial_mock_spec.rb
  24. +1 −1  spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb
  25. +20 −20 spec/rspec/mocks/passing_argument_matchers_spec.rb
  26. +5 −5 spec/rspec/mocks/precise_counts_spec.rb
  27. +4 −4 spec/rspec/mocks/record_messages_spec.rb
  28. +1 −1  spec/rspec/mocks/stash_spec.rb
  29. +4 −4 spec/rspec/mocks/stub_implementation_spec.rb
  30. +26 −26 spec/rspec/mocks/stub_spec.rb
  31. +2 −2 spec/spec_helper.rb
  32. +2 −2 spec/support/macros.rb
View
8 spec/rspec/mocks/any_number_of_times_spec.rb
@@ -8,23 +8,23 @@ module Mocks
@mock = RSpec::Mocks::Mock.new("test mock")
end
- it "should pass if any number of times method is called many times" do
+ it "passes if any number of times method is called many times" do
@mock.should_receive(:random_call).any_number_of_times
(1..10).each do
@mock.random_call
end
end
- it "should pass if any number of times method is called once" do
+ it "passes if any number of times method is called once" do
@mock.should_receive(:random_call).any_number_of_times
@mock.random_call
end
- it "should pass if any number of times method is not called" do
+ it "passes if any number of times method is not called" do
@mock.should_receive(:random_call).any_number_of_times
end
- it "should return the mocked value when called after a similar stub" do
+ it "returns the mocked value when called after a similar stub" do
@mock.stub(:message).and_return :stub_value
@mock.should_receive(:message).any_number_of_times.and_return(:mock_value)
@mock.message.should == :mock_value
View
4 spec/rspec/mocks/argument_expectation_spec.rb
@@ -3,7 +3,7 @@
module RSpec
module Mocks
describe ArgumentExpectation do
- it "should consider an object that responds to #matches? and #description to be a matcher" do
+ it "considers an object that responds to #matches? and #description to be a matcher" do
argument_expecatation = RSpec::Mocks::ArgumentExpectation.new
obj = double("matcher")
obj.should_receive(:respond_to?).with(:matches?).and_return(true)
@@ -11,7 +11,7 @@ module Mocks
argument_expecatation.is_matcher?(obj).should be_true
end
- it "should NOT consider an object that only responds to #matches? to be a matcher" do
+ it "does NOT consider an object that only responds to #matches? to be a matcher" do
argument_expecatation = RSpec::Mocks::ArgumentExpectation.new
obj = double("matcher")
obj.should_receive(:respond_to?).with(:matches?).and_return(true)
View
22 spec/rspec/mocks/at_least_spec.rb
@@ -7,14 +7,14 @@ module Mocks
@mock = RSpec::Mocks::Mock.new("test mock")
end
- it "should fail if method is never called" do
+ it "fails if method is never called" do
@mock.should_receive(:random_call).at_least(4).times
lambda do
@mock.rspec_verify
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should fail when called less than n times" do
+ it "fails when called less than n times" do
@mock.should_receive(:random_call).at_least(4).times
@mock.random_call
@mock.random_call
@@ -24,14 +24,14 @@ module Mocks
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should fail when at least once method is never called" do
+ it "fails when at least once method is never called" do
@mock.should_receive(:random_call).at_least(:once)
lambda do
@mock.rspec_verify
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should fail when at least twice method is called once" do
+ it "fails when at least twice method is called once" do
@mock.should_receive(:random_call).at_least(:twice)
@mock.random_call
lambda do
@@ -39,14 +39,14 @@ module Mocks
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should fail when at least twice method is never called" do
+ it "fails when at least twice method is never called" do
@mock.should_receive(:random_call).at_least(:twice)
lambda do
@mock.rspec_verify
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should pass when at least n times method is called exactly n times" do
+ it "passes when at least n times method is called exactly n times" do
@mock.should_receive(:random_call).at_least(4).times
@mock.random_call
@mock.random_call
@@ -55,7 +55,7 @@ module Mocks
@mock.rspec_verify
end
- it "should pass when at least n times method is called n plus 1 times" do
+ it "passes when at least n times method is called n plus 1 times" do
@mock.should_receive(:random_call).at_least(4).times
@mock.random_call
@mock.random_call
@@ -65,20 +65,20 @@ module Mocks
@mock.rspec_verify
end
- it "should pass when at least once method is called once" do
+ it "passes when at least once method is called once" do
@mock.should_receive(:random_call).at_least(:once)
@mock.random_call
@mock.rspec_verify
end
- it "should pass when at least once method is called twice" do
+ it "passes when at least once method is called twice" do
@mock.should_receive(:random_call).at_least(:once)
@mock.random_call
@mock.random_call
@mock.rspec_verify
end
- it "should pass when at least twice method is called three times" do
+ it "passes when at least twice method is called three times" do
@mock.should_receive(:random_call).at_least(:twice)
@mock.random_call
@mock.random_call
@@ -86,7 +86,7 @@ module Mocks
@mock.rspec_verify
end
- it "should pass when at least twice method is called twice" do
+ it "passes when at least twice method is called twice" do
@mock.should_receive(:random_call).at_least(:twice)
@mock.random_call
@mock.random_call
View
22 spec/rspec/mocks/at_most_spec.rb
@@ -7,7 +7,7 @@ module Mocks
@mock = RSpec::Mocks::Mock.new("test mock")
end
- it "should fail when at most n times method is called n plus 1 times" do
+ it "fails when at most n times method is called n plus 1 times" do
@mock.should_receive(:random_call).at_most(4).times
@mock.random_call
@mock.random_call
@@ -19,7 +19,7 @@ module Mocks
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should fail when at most once method is called twice" do
+ it "fails when at most once method is called twice" do
@mock.should_receive(:random_call).at_most(:once)
@mock.random_call
@mock.random_call
@@ -28,7 +28,7 @@ module Mocks
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should fail when at most twice method is called three times" do
+ it "fails when at most twice method is called three times" do
@mock.should_receive(:random_call).at_most(:twice)
@mock.random_call
@mock.random_call
@@ -38,7 +38,7 @@ module Mocks
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should pass when at most n times method is called exactly n times" do
+ it "passes when at most n times method is called exactly n times" do
@mock.should_receive(:random_call).at_most(4).times
@mock.random_call
@mock.random_call
@@ -47,7 +47,7 @@ module Mocks
@mock.rspec_verify
end
- it "should pass when at most n times method is called less than n times" do
+ it "passes when at most n times method is called less than n times" do
@mock.should_receive(:random_call).at_most(4).times
@mock.random_call
@mock.random_call
@@ -55,36 +55,36 @@ module Mocks
@mock.rspec_verify
end
- it "should pass when at most n times method is never called" do
+ it "passes when at most n times method is never called" do
@mock.should_receive(:random_call).at_most(4).times
@mock.rspec_verify
end
- it "should pass when at most once method is called once" do
+ it "passes when at most once method is called once" do
@mock.should_receive(:random_call).at_most(:once)
@mock.random_call
@mock.rspec_verify
end
- it "should pass when at most once method is never called" do
+ it "passes when at most once method is never called" do
@mock.should_receive(:random_call).at_most(:once)
@mock.rspec_verify
end
- it "should pass when at most twice method is called once" do
+ it "passes when at most twice method is called once" do
@mock.should_receive(:random_call).at_most(:twice)
@mock.random_call
@mock.rspec_verify
end
- it "should pass when at most twice method is called twice" do
+ it "passes when at most twice method is called twice" do
@mock.should_receive(:random_call).at_most(:twice)
@mock.random_call
@mock.random_call
@mock.rspec_verify
end
- it "should pass when at most twice method is never called" do
+ it "passes when at most twice method is never called" do
@mock.should_receive(:random_call).at_most(:twice)
@mock.rspec_verify
end
View
2  spec/rspec/mocks/bug_report_10260_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "An RSpec Mock" do
- it "should hide internals in its inspect representation" do
+ it "hides internals in its inspect representation" do
m = double('cup')
m.inspect.should =~ /#<RSpec::Mocks::Mock:0x[a-f0-9.]+ @name="cup">/
end
View
6 spec/rspec/mocks/bug_report_11545_spec.rb
@@ -15,17 +15,17 @@ def self.respond_to?(sym, incl_private=false)
@liar = LiarLiarPantsOnFire.new
end
- it "should work when object lies about responding to a method" do
+ it "works when object lies about responding to a method" do
@liar.should_receive(:something)
@liar.something
end
- it 'should work when class lies about responding to a method' do
+ it 'works when class lies about responding to a method' do
LiarLiarPantsOnFire.should_receive(:something)
LiarLiarPantsOnFire.something
end
- it 'should cleanup after itself' do
+ it 'cleans up after itself' do
(class << LiarLiarPantsOnFire; self; end).instance_methods.should_not include("something")
end
end
View
4 spec/rspec/mocks/bug_report_15719_spec.rb
@@ -4,7 +4,7 @@ module RSpec
module Mocks
describe "mock failure" do
- it "should tell you when it receives the right message with the wrong args" do
+ it "tells you when it receives the right message with the wrong args" do
double = double("foo")
double.should_receive(:bar).with("message")
lambda {
@@ -13,7 +13,7 @@ module Mocks
double.rspec_reset # so the example doesn't fail
end
- pending "should tell you when it receives the right message with the wrong args if you stub the method (fix bug 15719)" do
+ pending "tells you when it receives the right message with the wrong args if you stub the method (fix bug 15719)" do
# NOTE - for whatever reason, if you use a the block style of pending here,
# rcov gets unhappy. Don't know why yet.
double = double("foo")
View
4 spec/rspec/mocks/bug_report_600_spec.rb
@@ -10,12 +10,12 @@ def self.method_that_uses_define_method
end
end
- it "should work" do
+ it "works" do
ExampleClass.should_receive(:define_method).with("defined_method")
ExampleClass.method_that_uses_define_method
end
- it "should restore the original method" do
+ it "restores the original method" do
ExampleClass.method_that_uses_define_method
end
end
View
2  spec/rspec/mocks/bug_report_7611_spec.rb
@@ -7,7 +7,7 @@ class Foo
class Bar < Foo
end
- it "should respect subclasses" do
+ it "respects subclasses" do
Foo.stub(:new).and_return(Object.new)
end
View
4 spec/rspec/mocks/bug_report_8165_spec.rb
@@ -12,7 +12,7 @@
# The fix was to keep track of whether :respond_to? had been proxied and, if
# so, call the munged copy of :respond_to? on the object.
- it "should not raise an exception for Object" do
+ it "does not raise an exception for Object" do
obj = Object.new
obj.should_receive(:respond_to?).with(:foobar).and_return(true)
obj.should_receive(:foobar).and_return(:baz)
@@ -20,7 +20,7 @@
obj.foobar.should == :baz
end
- it "should not raise an exception for mock" do
+ it "does not raise an exception for mock" do
obj = double("obj")
obj.should_receive(:respond_to?).with(:foobar).and_return(true)
obj.should_receive(:foobar).and_return(:baz)
View
4 spec/rspec/mocks/bug_report_957_spec.rb
@@ -10,11 +10,11 @@ module Mocks
@base_class.stub(:find).and_return "stubbed_value"
end
- it "should return the value for the stub on the base class" do
+ it "returns the value for the stub on the base class" do
@base_class.find.should == "stubbed_value"
end
- it "should return the value for the descendent class" do
+ it "returns the value for the descendent class" do
@concrete_class.find.should == "stubbed_value"
end
end
View
24 spec/rspec/mocks/failing_argument_matchers_spec.rb
@@ -12,78 +12,78 @@ module Mocks
@mock.rspec_reset
end
- it "should reject non boolean" do
+ it "rejects non boolean" do
@mock.should_receive(:random_call).with(boolean())
lambda do
@mock.random_call("false")
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should reject non numeric" do
+ it "rejects non numeric" do
@mock.should_receive(:random_call).with(an_instance_of(Numeric))
lambda do
@mock.random_call("1")
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should reject non string" do
+ it "rejects non string" do
@mock.should_receive(:random_call).with(an_instance_of(String))
lambda do
@mock.random_call(123)
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should reject goose when expecting a duck" do
+ it "rejects goose when expecting a duck" do
@mock.should_receive(:random_call).with(duck_type(:abs, :div))
lambda { @mock.random_call("I don't respond to :abs or :div") }.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should fail if regexp does not match submitted string" do
+ it "fails if regexp does not match submitted string" do
@mock.should_receive(:random_call).with(/bcd/)
lambda { @mock.random_call("abc") }.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should fail if regexp does not match submitted regexp" do
+ it "fails if regexp does not match submitted regexp" do
@mock.should_receive(:random_call).with(/bcd/)
lambda { @mock.random_call(/bcde/) }.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should fail for a hash w/ wrong values" do
+ it "fails for a hash w/ wrong values" do
@mock.should_receive(:random_call).with(:a => "b", :c => "d")
lambda do
@mock.random_call(:a => "b", :c => "e")
end.should raise_error(RSpec::Mocks::MockExpectationError, /Double "test double" received :random_call with unexpected arguments\n expected: \(\{(:a=>\"b\", :c=>\"d\"|:c=>\"d\", :a=>\"b\")\}\)\n got: \(\{(:a=>\"b\", :c=>\"e\"|:c=>\"e\", :a=>\"b\")\}\)/)
end
- it "should fail for a hash w/ wrong keys" do
+ it "fails for a hash w/ wrong keys" do
@mock.should_receive(:random_call).with(:a => "b", :c => "d")
lambda do
@mock.random_call("a" => "b", "c" => "d")
end.should raise_error(RSpec::Mocks::MockExpectationError, /Double "test double" received :random_call with unexpected arguments\n expected: \(\{(:a=>\"b\", :c=>\"d\"|:c=>\"d\", :a=>\"b\")\}\)\n got: \(\{(\"a\"=>\"b\", \"c\"=>\"d\"|\"c\"=>\"d\", \"a\"=>\"b\")\}\)/)
end
- it "should match against a Matcher" do
+ it "matches against a Matcher" do
lambda do
@mock.should_receive(:msg).with(equal(3))
@mock.msg(37)
end.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :msg with unexpected arguments\n expected: (equal 3)\n got: (37)")
end
- it "should fail no_args with one arg" do
+ it "fails no_args with one arg" do
lambda do
@mock.should_receive(:msg).with(no_args)
@mock.msg(37)
end.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :msg with unexpected arguments\n expected: (no args)\n got: (37)")
end
- it "should fail hash_including with missing key" do
+ it "fails hash_including with missing key" do
lambda do
@mock.should_receive(:msg).with(hash_including(:a => 1))
@mock.msg({})
end.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :msg with unexpected arguments\n expected: (hash_including(:a=>1))\n got: ({})")
end
- it "should fail with block matchers" do
+ it "fails with block matchers" do
lambda do
@mock.should_receive(:msg).with {|arg| arg.should == :received }
@mock.msg :no_msg_for_you
View
36 spec/rspec/mocks/hash_including_matcher_spec.rb
@@ -5,82 +5,82 @@ module Mocks
module ArgumentMatchers
describe HashIncludingMatcher do
- it "should describe itself properly" do
+ it "describes itself properly" do
HashIncludingMatcher.new(:a => 1).description.should == "hash_including(:a=>1)"
end
describe "passing" do
- it "should match the same hash" do
+ it "matches the same hash" do
hash_including(:a => 1).should == {:a => 1}
end
- it "should match a hash with extra stuff" do
+ it "matches a hash with extra stuff" do
hash_including(:a => 1).should == {:a => 1, :b => 2}
end
describe "when matching against other matchers" do
- it "should match an int against anything()" do
+ it "matches an int against anything()" do
hash_including(:a => anything, :b => 2).should == {:a => 1, :b => 2}
end
- it "should match a string against anything()" do
+ it "matches a string against anything()" do
hash_including(:a => anything, :b => 2).should == {:a => "1", :b => 2}
end
end
describe "when passed only keys or keys mixed with key/value pairs" do
- it "should match if the key is present" do
+ it "matches if the key is present" do
hash_including(:a).should == {:a => 1, :b => 2}
end
- it "should match if more keys are present" do
+ it "matches if more keys are present" do
hash_including(:a, :b).should == {:a => 1, :b => 2, :c => 3}
end
- it "should match a string against a given key" do
+ it "matches a string against a given key" do
hash_including(:a).should == {:a => "1", :b => 2}
end
- it "should match if passed one key and one key/value pair" do
+ it "matches if passed one key and one key/value pair" do
hash_including(:a, :b => 2).should == {:a => 1, :b => 2}
end
- it "should match if passed many keys and one key/value pair" do
+ it "matches if passed many keys and one key/value pair" do
hash_including(:a, :b, :c => 3).should == {:a => 1, :b => 2, :c => 3, :d => 4}
end
- it "should match if passed many keys and many key/value pairs" do
+ it "matches if passed many keys and many key/value pairs" do
hash_including(:a, :b, :c => 3, :e => 5).should == {:a => 1, :b => 2, :c => 3, :d => 4, :e => 5}
end
end
end
describe "failing" do
- it "should not match a non-hash" do
+ it "does not match a non-hash" do
hash_including(:a => 1).should_not == 1
end
- it "should not match a hash with a missing key" do
+ it "does not match a hash with a missing key" do
hash_including(:a => 1).should_not == {:b => 2}
end
- it "should not match a hash with a missing key" do
+ it "does not match a hash with a missing key" do
hash_including(:a).should_not == {:b => 2}
end
- it "should not match an empty hash with a given key" do
+ it "does not match an empty hash with a given key" do
hash_including(:a).should_not == {}
end
- it "should not match a hash with a missing key when one pair is matching" do
+ it "does not match a hash with a missing key when one pair is matching" do
hash_including(:a, :b => 2).should_not == {:b => 2}
end
- it "should not match a hash with an incorrect value" do
+ it "does not match a hash with an incorrect value" do
hash_including(:a => 1, :b => 2).should_not == {:a => 1, :b => 3}
end
- it "should not match when values are nil but keys are different" do
+ it "does not match when values are nil but keys are different" do
hash_including(:a => nil).should_not == {:b => nil}
end
end
View
26 spec/rspec/mocks/hash_not_including_matcher_spec.rb
@@ -5,59 +5,59 @@ module Mocks
module ArgumentMatchers
describe HashNotIncludingMatcher do
- it "should describe itself properly" do
+ it "describes itself properly" do
HashNotIncludingMatcher.new(:a => 5).description.should == "hash_not_including(:a=>5)"
end
describe "passing" do
- it "should match a hash without the specified key" do
+ it "matches a hash without the specified key" do
hash_not_including(:c).should == {:a => 1, :b => 2}
end
- it "should match a hash with the specified key, but different value" do
+ it "matches a hash with the specified key, but different value" do
hash_not_including(:b => 3).should == {:a => 1, :b => 2}
end
- it "should match a hash without the specified key, given as anything()" do
+ it "matches a hash without the specified key, given as anything()" do
hash_not_including(:c => anything).should == {:a => 1, :b => 2}
end
- it "should match an empty hash" do
+ it "matches an empty hash" do
hash_not_including(:a).should == {}
end
- it "should match a hash without any of the specified keys" do
+ it "matches a hash without any of the specified keys" do
hash_not_including(:a, :b, :c).should == { :d => 7}
end
end
describe "failing" do
- it "should not match a non-hash" do
+ it "does not match a non-hash" do
hash_not_including(:a => 1).should_not == 1
end
- it "should not match a hash with a specified key" do
+ it "does not match a hash with a specified key" do
hash_not_including(:b).should_not == {:b => 2}
end
- it "should not match a hash with the specified key/value pair" do
+ it "does not match a hash with the specified key/value pair" do
hash_not_including(:b => 2).should_not == {:a => 1, :b => 2}
end
- it "should not match a hash with the specified key" do
+ it "does not match a hash with the specified key" do
hash_not_including(:a, :b => 3).should_not == {:a => 1, :b => 2}
end
- it "should not match a hash with one of the specified keys" do
+ it "does not match a hash with one of the specified keys" do
hash_not_including(:a, :b).should_not == {:b => 2}
end
- it "should not match a hash with some of the specified keys" do
+ it "does not match a hash with some of the specified keys" do
hash_not_including(:a, :b, :c).should_not == {:a => 1, :b => 2}
end
- it "should not match a hash with one key/value pair included" do
+ it "does not match a hash with one key/value pair included" do
hash_not_including(:a, :b, :c, :d => 7).should_not == { :d => 7}
end
end
View
14 spec/rspec/mocks/mock_ordering_spec.rb
@@ -13,7 +13,7 @@ module Mocks
@double.rspec_reset
end
- it "should pass two calls in order" do
+ it "passes two calls in order" do
@double.should_receive(:one).ordered
@double.should_receive(:two).ordered
@double.one
@@ -21,7 +21,7 @@ module Mocks
@double.rspec_verify
end
- it "should pass three calls in order" do
+ it "passes three calls in order" do
@double.should_receive(:one).ordered
@double.should_receive(:two).ordered
@double.should_receive(:three).ordered
@@ -31,7 +31,7 @@ module Mocks
@double.rspec_verify
end
- it "should fail if second call comes first" do
+ it "fails if second call comes first" do
@double.should_receive(:one).ordered
@double.should_receive(:two).ordered
lambda do
@@ -39,7 +39,7 @@ module Mocks
end.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :two out of order")
end
- it "should fail if third call comes first" do
+ it "fails if third call comes first" do
@double.should_receive(:one).ordered
@double.should_receive(:two).ordered
@double.should_receive(:three).ordered
@@ -49,7 +49,7 @@ module Mocks
end.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :three out of order")
end
- it "should fail if third call comes second" do
+ it "fails if third call comes second" do
@double.should_receive(:one).ordered
@double.should_receive(:two).ordered
@double.should_receive(:three).ordered
@@ -59,7 +59,7 @@ module Mocks
end.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :three out of order")
end
- it "should ignore order of non ordered calls" do
+ it "ignores order of non ordered calls" do
@double.should_receive(:ignored_0)
@double.should_receive(:ordered_1).ordered
@double.should_receive(:ignored_1)
@@ -79,7 +79,7 @@ module Mocks
@double.rspec_verify
end
- it "should pass when duplicates exist" do
+ it "passes when duplicates exist" do
@double.should_receive(:a).ordered
@double.should_receive(:b).ordered
@double.should_receive(:a).ordered
View
8 spec/rspec/mocks/mock_space_spec.rb
@@ -23,26 +23,26 @@ def reset?
@m1 = klazz.new
@m2 = klazz.new
end
- it "should verify all mocks within" do
+ it "verifies all mocks within" do
@space.add(@m1)
@space.add(@m2)
@space.verify_all
@m1.should be_verified
@m2.should be_verified
end
- it "should reset all mocks within" do
+ it "resets all mocks within" do
@space.add(m1 = double("mock1"))
@space.add(m2 = double("mock2"))
m1.should_receive(:rspec_reset)
m2.should_receive(:rspec_reset)
@space.reset_all
end
- it "should clear internal mocks on reset_all" do
+ it "clears internal mocks on reset_all" do
@space.add(m = double("mock"))
@space.reset_all
@space.instance_eval { mocks.empty? }.should be_true
end
- it "should only add an instance once" do
+ it "only adds an instance once" do
@space.add(m1 = double("mock1"))
@space.add(m1)
m1.should_receive(:rspec_verify)
View
130 spec/rspec/mocks/mock_spec.rb
@@ -13,7 +13,7 @@ module Mocks
@mock.rspec_reset
end
- it "should report line number of expectation of unreceived message" do
+ it "reports line number of expectation of unreceived message" do
expected_error_line = __LINE__; @mock.should_receive(:wont_happen).with("x", 3)
begin
@mock.rspec_verify
@@ -24,7 +24,7 @@ module Mocks
end
end
- it "should report line number of expectation of unreceived message after #should_receive after similar stub" do
+ it "reports line number of expectation of unreceived message after #should_receive after similar stub" do
@mock.stub(:wont_happen)
expected_error_line = __LINE__; @mock.should_receive(:wont_happen).with("x", 3)
begin
@@ -36,19 +36,19 @@ module Mocks
end
end
- it "should pass when not receiving message specified as not to be received" do
+ it "passes when not receiving message specified as not to be received" do
@mock.should_not_receive(:not_expected)
@mock.rspec_verify
end
- it "should pass when receiving message specified as not to be received with different args" do
+ it "passes when receiving message specified as not to be received with different args" do
@mock.should_not_receive(:message).with("unwanted text")
@mock.should_receive(:message).with("other text")
@mock.message "other text"
@mock.rspec_verify
end
- it "should fail when receiving message specified as not to be received" do
+ it "fails when receiving message specified as not to be received" do
@mock.should_not_receive(:not_expected)
expect {
@mock.not_expected
@@ -59,7 +59,7 @@ module Mocks
)
end
- it "should fail when receiving message specified as not to be received with args" do
+ it "fails when receiving message specified as not to be received with args" do
@mock.should_not_receive(:not_expected).with("unexpected text")
expect {
@mock.not_expected("unexpected text")
@@ -70,31 +70,31 @@ module Mocks
)
end
- it "should pass when receiving message specified as not to be received with wrong args" do
+ it "passes when receiving message specified as not to be received with wrong args" do
@mock.should_not_receive(:not_expected).with("unexpected text")
@mock.not_expected "really unexpected text"
@mock.rspec_verify
end
- it "should allow block to calculate return values" do
+ it "allows block to calculate return values" do
@mock.should_receive(:something).with("a","b","c").and_return { |a,b,c| c+b+a }
@mock.something("a","b","c").should == "cba"
@mock.rspec_verify
end
- it "should allow parameter as return value" do
+ it "allows parameter as return value" do
@mock.should_receive(:something).with("a","b","c").and_return("booh")
@mock.something("a","b","c").should == "booh"
@mock.rspec_verify
end
- it "should return nil if no return value set" do
+ it "returns nil if no return value set" do
@mock.should_receive(:something).with("a","b","c")
@mock.something("a","b","c").should be_nil
@mock.rspec_verify
end
- it "should raise exception if args don't match when method called" do
+ it "raises exception if args don't match when method called" do
@mock.should_receive(:something).with("a","b","c").and_return("booh")
lambda {
@mock.something("a","d","c")
@@ -102,7 +102,7 @@ module Mocks
}.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n expected: (\"a\", \"b\", \"c\")\n got: (\"a\", \"d\", \"c\")")
end
- it "should raise exception if args don't match when method called even when the method is stubbed" do
+ it "raises exception if args don't match when method called even when the method is stubbed" do
@mock.stub(:something)
@mock.should_receive(:something).with("a","b","c")
lambda {
@@ -111,7 +111,7 @@ module Mocks
}.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n expected: (\"a\", \"b\", \"c\")\n got: (\"a\", \"d\", \"c\")")
end
- it "should raise exception if args don't match when method called even when using null_object" do
+ it "raises exception if args don't match when method called even when using null_object" do
@mock = double("test double").as_null_object
@mock.should_receive(:something).with("a","b","c")
lambda {
@@ -120,14 +120,14 @@ module Mocks
}.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n expected: (\"a\", \"b\", \"c\")\n got: (\"a\", \"d\", \"c\")")
end
- it "should fail if unexpected method called" do
+ it "fails if unexpected method called" do
lambda {
@mock.something("a","b","c")
violated
}.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received unexpected message :something with (\"a\", \"b\", \"c\")")
end
- it "should use block for expectation if provided" do
+ it "uses block for expectation if provided" do
@mock.should_receive(:something) do | a, b |
a.should == "a"
b.should == "b"
@@ -137,14 +137,14 @@ module Mocks
@mock.rspec_verify
end
- it "should fail if expectation block fails" do
+ it "fails if expectation block fails" do
@mock.should_receive(:something) {| bool | bool.should be_true}
expect {
@mock.something false
}.to raise_error(RSpec::Mocks::MockExpectationError, /Double \"test double\" received :something but passed block failed with: expected false to be true/)
end
- it "should fail right away when method defined as never is received" do
+ it "fails right away when method defined as never is received" do
@mock.should_receive(:not_expected).never
expect { @mock.not_expected }.to raise_error(
RSpec::Mocks::MockExpectationError,
@@ -152,7 +152,7 @@ module Mocks
)
end
- it "should eventually fail when method defined as never is received" do
+ it "eventually fails when method defined as never is received" do
@mock.should_receive(:not_expected).never
expect { @mock.not_expected }.to raise_error(
RSpec::Mocks::MockExpectationError,
@@ -160,14 +160,14 @@ module Mocks
)
end
- it "should raise when told to" do
+ it "raises when told to" do
@mock.should_receive(:something).and_raise(RuntimeError)
lambda do
@mock.something
end.should raise_error(RuntimeError)
end
- it "should raise passed an Exception instance" do
+ it "raises passed an Exception instance" do
error = RuntimeError.new("error message")
@mock.should_receive(:something).and_raise(error)
lambda {
@@ -175,28 +175,28 @@ module Mocks
}.should raise_error(RuntimeError, "error message")
end
- it "should raise RuntimeError with passed message" do
+ it "raises RuntimeError with passed message" do
@mock.should_receive(:something).and_raise("error message")
lambda {
@mock.something
}.should raise_error(RuntimeError, "error message")
end
- it "should not raise when told to if args dont match" do
+ it "does not raise when told to if args dont match" do
@mock.should_receive(:something).with(2).and_raise(RuntimeError)
lambda {
@mock.something 1
}.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should throw when told to" do
+ it "throws when told to" do
@mock.should_receive(:something).and_throw(:blech)
lambda {
@mock.something
}.should throw_symbol(:blech)
end
- it "should raise when explicit return and block constrained" do
+ it "raises when explicit return and block constrained" do
lambda {
@mock.should_receive(:fruit) do |colour|
:strawberry
@@ -204,7 +204,7 @@ module Mocks
}.should raise_error(RSpec::Mocks::AmbiguousReturnError)
end
- it "should ignore args on any args" do
+ it "ignores args on any args" do
@mock.should_receive(:something).at_least(:once).with(any_args)
@mock.something
@mock.something 1
@@ -213,27 +213,27 @@ module Mocks
@mock.rspec_verify
end
- it "should fail on no args if any args received" do
+ it "fails on no args if any args received" do
@mock.should_receive(:something).with(no_args())
lambda {
@mock.something 1
}.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n expected: (no args)\n got: (1)")
end
- it "should fail when args are expected but none are received" do
+ it "fails when args are expected but none are received" do
@mock.should_receive(:something).with(1)
lambda {
@mock.something
}.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n expected: (1)\n got: (no args)")
end
- it "should return value from block by default" do
+ it "returns value from block by default" do
@mock.stub(:method_that_yields).and_yield
@mock.method_that_yields { :returned_obj }.should == :returned_obj
@mock.rspec_verify
end
- it "should yield 0 args to blocks that take a variable number of arguments" do
+ it "yields 0 args to blocks that take a variable number of arguments" do
@mock.should_receive(:yield_back).with(no_args()).once.and_yield
a = nil
@mock.yield_back {|*x| a = x}
@@ -241,7 +241,7 @@ module Mocks
@mock.rspec_verify
end
- it "should yield 0 args multiple times to blocks that take a variable number of arguments" do
+ it "yields 0 args multiple times to blocks that take a variable number of arguments" do
@mock.should_receive(:yield_back).once.with(no_args()).once.and_yield.
and_yield
a = nil
@@ -251,7 +251,7 @@ module Mocks
@mock.rspec_verify
end
- it "should yield one arg to blocks that take a variable number of arguments" do
+ it "yields one arg to blocks that take a variable number of arguments" do
@mock.should_receive(:yield_back).with(no_args()).once.and_yield(99)
a = nil
@mock.yield_back {|*x| a = x}
@@ -259,7 +259,7 @@ module Mocks
@mock.rspec_verify
end
- it "should yield one arg 3 times consecutively to blocks that take a variable number of arguments" do
+ it "yields one arg 3 times consecutively to blocks that take a variable number of arguments" do
@mock.should_receive(:yield_back).once.with(no_args()).once.and_yield(99).
and_yield(43).
and_yield("something fruity")
@@ -270,7 +270,7 @@ module Mocks
@mock.rspec_verify
end
- it "should yield many args to blocks that take a variable number of arguments" do
+ it "yields many args to blocks that take a variable number of arguments" do
@mock.should_receive(:yield_back).with(no_args()).once.and_yield(99, 27, "go")
a = nil
@mock.yield_back {|*x| a = x}
@@ -278,7 +278,7 @@ module Mocks
@mock.rspec_verify
end
- it "should yield many args 3 times consecutively to blocks that take a variable number of arguments" do
+ it "yields many args 3 times consecutively to blocks that take a variable number of arguments" do
@mock.should_receive(:yield_back).once.with(no_args()).once.and_yield(99, :green, "go").
and_yield("wait", :amber).
and_yield("stop", 12, :red)
@@ -289,7 +289,7 @@ module Mocks
@mock.rspec_verify
end
- it "should yield single value" do
+ it "yields single value" do
@mock.should_receive(:yield_back).with(no_args()).once.and_yield(99)
a = nil
@mock.yield_back {|x| a = x}
@@ -297,7 +297,7 @@ module Mocks
@mock.rspec_verify
end
- it "should yield single value 3 times consecutively" do
+ it "yields single value 3 times consecutively" do
@mock.should_receive(:yield_back).once.with(no_args()).once.and_yield(99).
and_yield(43).
and_yield("something fruity")
@@ -308,7 +308,7 @@ module Mocks
@mock.rspec_verify
end
- it "should yield two values" do
+ it "yields two values" do
@mock.should_receive(:yield_back).with(no_args()).once.and_yield('wha', 'zup')
a, b = nil
@mock.yield_back {|x,y| a=x; b=y}
@@ -317,7 +317,7 @@ module Mocks
@mock.rspec_verify
end
- it "should yield two values 3 times consecutively" do
+ it "yields two values 3 times consecutively" do
@mock.should_receive(:yield_back).once.with(no_args()).once.and_yield('wha', 'zup').
and_yield('not', 'down').
and_yield(14, 65)
@@ -328,14 +328,14 @@ module Mocks
@mock.rspec_verify
end
- it "should fail when calling yielding method with wrong arity" do
+ it "fails when calling yielding method with wrong arity" do
@mock.should_receive(:yield_back).with(no_args()).once.and_yield('wha', 'zup')
lambda {
@mock.yield_back {|a|}
}.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" yielded |\"wha\", \"zup\"| to block with arity of 1")
end
- it "should fail when calling yielding method consecutively with wrong arity" do
+ it "fails when calling yielding method consecutively with wrong arity" do
@mock.should_receive(:yield_back).once.with(no_args()).once.and_yield('wha', 'zup').
and_yield('down').
and_yield(14, 65)
@@ -346,20 +346,20 @@ module Mocks
}.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" yielded |\"down\"| to block with arity of 2")
end
- it "should fail when calling yielding method without block" do
+ it "fails when calling yielding method without block" do
@mock.should_receive(:yield_back).with(no_args()).once.and_yield('wha', 'zup')
lambda {
@mock.yield_back
}.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" asked to yield |[\"wha\", \"zup\"]| but no block was passed")
end
- it "should be able to mock send" do
+ it "is able to mock send" do
@mock.should_receive(:send).with(any_args)
@mock.send 'hi'
@mock.rspec_verify
end
- it "should be able to raise from method calling yielding mock" do
+ it "is able to raise from method calling yielding mock" do
@mock.should_receive(:yield_me).and_yield 44
lambda {
@@ -371,7 +371,7 @@ module Mocks
@mock.rspec_verify
end
- it "should clear expectations after verify" do
+ it "clears expectations after verify" do
@mock.should_receive(:foobar)
@mock.foobar
@mock.rspec_verify
@@ -380,14 +380,14 @@ module Mocks
}.should raise_error(RSpec::Mocks::MockExpectationError, %q|Double "test double" received unexpected message :foobar with (no args)|)
end
- it "should restore objects to their original state on rspec_reset" do
+ it "restores objects to their original state on rspec_reset" do
mock = double("this is a mock")
mock.should_receive(:blah)
mock.rspec_reset
mock.rspec_verify #should throw if reset didn't work
end
- it "should work even after method_missing starts raising NameErrors instead of NoMethodErrors" do
+ it "works even after method_missing starts raising NameErrors instead of NoMethodErrors" do
# Object#method_missing throws either NameErrors or NoMethodErrors.
#
# On a fresh ruby program Object#method_missing:
@@ -416,7 +416,7 @@ module Mocks
lambda { @mock.foobar }.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should temporarily replace a method stub on a mock" do
+ it "temporarily replaces a method stub on a mock" do
@mock.stub(:msg).and_return(:stub_value)
@mock.should_receive(:msg).with(:arg).and_return(:mock_value)
@mock.msg(:arg).should equal(:mock_value)
@@ -425,7 +425,7 @@ module Mocks
@mock.rspec_verify
end
- it "should not require a different signature to replace a method stub" do
+ it "does not require a different signature to replace a method stub" do
@mock.stub(:msg).and_return(:stub_value)
@mock.should_receive(:msg).and_return(:mock_value)
@mock.msg(:arg).should equal(:mock_value)
@@ -434,13 +434,13 @@ module Mocks
@mock.rspec_verify
end
- it "should raise an error when a previously stubbed method has a negative expectation" do
+ it "raises an error when a previously stubbed method has a negative expectation" do
@mock.stub(:msg).and_return(:stub_value)
@mock.should_not_receive(:msg).and_return(:mock_value)
lambda {@mock.msg(:arg)}.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should temporarily replace a method stub on a non-mock" do
+ it "temporarily replaces a method stub on a non-mock" do
non_mock = Object.new
non_mock.stub(:msg).and_return(:stub_value)
non_mock.should_receive(:msg).with(:arg).and_return(:mock_value)
@@ -450,21 +450,21 @@ module Mocks
non_mock.rspec_verify
end
- it "should return the stubbed value when no new value specified" do
+ it "returns the stubbed value when no new value specified" do
@mock.stub(:msg).and_return(:stub_value)
@mock.should_receive(:msg)
@mock.msg.should equal(:stub_value)
@mock.rspec_verify
end
- it "should return the stubbed value when stubbed with args and no new value specified" do
+ it "returns the stubbed value when stubbed with args and no new value specified" do
@mock.stub(:msg).with(:arg).and_return(:stub_value)
@mock.should_receive(:msg).with(:arg)
@mock.msg(:arg).should equal(:stub_value)
@mock.rspec_verify
end
- it "should not mess with the stub's yielded values when also mocked" do
+ it "does not mess with the stub's yielded values when also mocked" do
@mock.stub(:yield_back).and_yield(:stub_value)
@mock.should_receive(:yield_back).and_yield(:mock_value)
@mock.yield_back{|v| v.should == :mock_value }
@@ -472,7 +472,7 @@ module Mocks
@mock.rspec_verify
end
- it "should yield multiple values after a similar stub" do
+ it "yields multiple values after a similar stub" do
File.stub(:open).and_yield(:stub_value)
File.should_receive(:open).and_yield(:first_call).and_yield(:second_call)
yielded_args = []
@@ -482,7 +482,7 @@ module Mocks
File.rspec_verify
end
- it "should assign stub return values" do
+ it "assigns stub return values" do
mock = RSpec::Mocks::Mock.new('name', :message => :response)
mock.message.should == :response
end
@@ -499,7 +499,7 @@ def add_call
@calls = @calls + 1
end
- it "should call the block after #should_receive" do
+ it "calls the block after #should_receive" do
@mock.should_receive(:foo) { add_call }
@mock.foo
@@ -507,7 +507,7 @@ def add_call
@calls.should == 1
end
- it "should call the block after #should_receive after a similar stub" do
+ it "calls the block after #should_receive after a similar stub" do
@mock.stub(:foo).and_return(:bar)
@mock.should_receive(:foo) { add_call }
@@ -516,7 +516,7 @@ def add_call
@calls.should == 1
end
- it "should call the block after #once" do
+ it "calls the block after #once" do
@mock.should_receive(:foo).once { add_call }
@mock.foo
@@ -524,7 +524,7 @@ def add_call
@calls.should == 1
end
- it "should call the block after #twice" do
+ it "calls the block after #twice" do
@mock.should_receive(:foo).twice { add_call }
@mock.foo
@@ -533,7 +533,7 @@ def add_call
@calls.should == 2
end
- it "should call the block after #times" do
+ it "calls the block after #times" do
@mock.should_receive(:foo).exactly(10).times { add_call }
(1..10).each { @mock.foo }
@@ -541,7 +541,7 @@ def add_call
@calls.should == 10
end
- it "should call the block after #any_number_of_times" do
+ it "calls the block after #any_number_of_times" do
@mock.should_receive(:foo).any_number_of_times { add_call }
(1..7).each { @mock.foo }
@@ -549,7 +549,7 @@ def add_call
@calls.should == 7
end
- it "should call the block after #ordered" do
+ it "calls the block after #ordered" do
@mock.should_receive(:foo).ordered { add_call }
@mock.should_receive(:bar).ordered { add_call }
@@ -561,7 +561,7 @@ def add_call
end
describe 'string representation generated by #to_s' do
- it 'should not contain < because that might lead to invalid HTML in some situations' do
+ it 'does not contain < because that might lead to invalid HTML in some situations' do
mock = double("Dog")
valid_html_str = "#{mock}"
valid_html_str.should_not include('<')
@@ -576,12 +576,12 @@ def add_call
end
describe "mock created with no name" do
- it "should not use a name in a failure message" do
+ it "does not use a name in a failure message" do
mock = double()
expect {mock.foo}.to raise_error(/Double received/)
end
- it "should respond to initially stubbed methods" do
+ it "does respond to initially stubbed methods" do
double = double(:foo => "woo", :bar => "car")
double.foo.should == "woo"
double.bar.should == "car"
View
22 spec/rspec/mocks/multiple_return_value_spec.rb
@@ -9,14 +9,14 @@ module Mocks
@mock.should_receive(:message).and_return(@return_values[0],@return_values[1],@return_values[2])
end
- it "should return values in order to consecutive calls" do
+ it "returns values in order to consecutive calls" do
@mock.message.should == @return_values[0]
@mock.message.should == @return_values[1]
@mock.message.should == @return_values[2]
@mock.rspec_verify
end
- it "should complain when there are too few calls" do
+ it "complains when there are too few calls" do
@mock.message.should == @return_values[0]
@mock.message.should == @return_values[1]
expect { @mock.rspec_verify }.to raise_error(
@@ -25,7 +25,7 @@ module Mocks
)
end
- it "should complain when there are too many calls" do
+ it "complains when there are too many calls" do
@mock.message.should == @return_values[0]
@mock.message.should == @return_values[1]
@mock.message.should == @return_values[2]
@@ -44,14 +44,14 @@ module Mocks
@mock.should_receive(:message).exactly(3).times.and_return(@return_values[0],@return_values[1],@return_values[2])
end
- it "should return values in order to consecutive calls" do
+ it "returns values in order to consecutive calls" do
@mock.message.should == @return_values[0]
@mock.message.should == @return_values[1]
@mock.message.should == @return_values[2]
@mock.rspec_verify
end
- it "should complain when there are too few calls" do
+ it "complains when there are too few calls" do
third = Object.new
@mock.message.should == @return_values[0]
@mock.message.should == @return_values[1]
@@ -61,7 +61,7 @@ module Mocks
)
end
- it "should complain when there are too many calls" do
+ it "complains when there are too many calls" do
third = Object.new
@mock.message.should == @return_values[0]
@mock.message.should == @return_values[1]
@@ -80,14 +80,14 @@ module Mocks
@mock.should_receive(:message).at_least(:twice).with(no_args).and_return(11, 22)
end
- it "should use last return value for subsequent calls" do
+ it "uses the last return value for subsequent calls" do
@mock.message.should equal(11)
@mock.message.should equal(22)
@mock.message.should equal(22)
@mock.rspec_verify
end
- it "should fail when called less than the specified number" do
+ it "fails when called less than the specified number" do
@mock.message.should equal(11)
expect { @mock.rspec_verify }.to raise_error(
RSpec::Mocks::MockExpectationError,
@@ -102,14 +102,14 @@ module Mocks
@mock.should_receive(:message).exactly(3).times.and_return(11, 22)
end
- it "should use last return value for subsequent calls" do
+ it "uses the last return value for subsequent calls" do
@mock.message.should equal(11)
@mock.message.should equal(22)
@mock.message.should equal(22)
@mock.rspec_verify
end
- it "should fail when called less than the specified number" do
+ it "fails when called less than the specified number" do
@mock.message.should equal(11)
expect { @mock.rspec_verify }.to raise_error(
RSpec::Mocks::MockExpectationError,
@@ -117,7 +117,7 @@ module Mocks
)
end
- it "should fail when called greater than the specified number" do
+ it "fails when called greater than the specified number" do
@mock.message.should equal(11)
@mock.message.should equal(22)
@mock.message.should equal(22)
View
8 spec/rspec/mocks/nil_expectation_warning_spec.rb
@@ -14,7 +14,7 @@ module Mocks
describe "an expectation set on nil" do
- it "should issue a warning with file and line number information" do
+ it "issues a warning with file and line number information" do
expected_warning = %r%An expectation of :foo was set on nil. Called from #{__FILE__}:#{__LINE__+3}(:in `block \(2 levels\) in <module:Mocks>')?. Use allow_message_expectations_on_nil to disable warnings.%
Kernel.should_receive(:warn).with(expected_warning)
@@ -22,13 +22,13 @@ module Mocks
nil.foo
end
- it "should issue a warning when the expectation is negative" do
+ it "issues a warning when the expectation is negative" do
Kernel.should_receive(:warn)
nil.should_not_receive(:foo)
end
- it "should not issue a warning when expectations are set to be allowed" do
+ it "does not issue a warning when expectations are set to be allowed" do
allow_message_expectations_on_nil
Kernel.should_not_receive(:warn)
@@ -42,7 +42,7 @@ module Mocks
describe "#allow_message_expectations_on_nil" do
- it "should not effect subsequent examples" do
+ it "does not effect subsequent examples" do
example_group = empty_example_group
example_group.it("when called in one example that doesn't end up setting an expectation on nil") do
allow_message_expectations_on_nil
View
14 spec/rspec/mocks/null_object_mock_spec.rb
@@ -7,30 +7,30 @@ module Mocks
@mock = RSpec::Mocks::Mock.new("null_object").as_null_object
end
- it "should allow explicit expectation" do
+ it "allows explicit expectation" do
@mock.should_receive(:something)
@mock.something
end
- it "should fail verification when explicit exception not met" do
+ it "fails verification when explicit exception not met" do
lambda do
@mock.should_receive(:something)
@mock.rspec_verify
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should ignore unexpected methods" do
+ it "ignores unexpected methods" do
@mock.random_call("a", "d", "c")
@mock.rspec_verify
end
- it "should expected message with different args first" do
+ it "allows expected message with different args first" do
@mock.should_receive(:message).with(:expected_arg)
@mock.message(:unexpected_arg)
@mock.message(:expected_arg)
end
- it "should expected message with different args second" do
+ it "allows expected message with different args second" do
@mock.should_receive(:message).with(:expected_arg)
@mock.message(:expected_arg)
@mock.message(:unexpected_arg)
@@ -38,14 +38,14 @@ module Mocks
end
describe "#null_object?" do
- it "should default to false" do
+ it "defaults to false" do
obj = double('anything')
obj.should_not be_null_object
end
end
describe "#as_null_object" do
- it "should set the object to null_object" do
+ it "sets the object to null_object" do
obj = double('anything').as_null_object
obj.should be_null_object
end
View
12 spec/rspec/mocks/once_counts_spec.rb
@@ -7,7 +7,7 @@ module Mocks
@mock = double("test mock")
end
- it "once should fail when called once with wrong args" do
+ it "once fails when called once with wrong args" do
@mock.should_receive(:random_call).once.with("a", "b", "c")
lambda do
@mock.random_call("d", "e", "f")
@@ -15,7 +15,7 @@ module Mocks
@mock.rspec_reset
end
- it "once should fail when called twice" do
+ it "once fails when called twice" do
@mock.should_receive(:random_call).once
@mock.random_call
@mock.random_call
@@ -24,26 +24,26 @@ module Mocks
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "once should fail when not called" do
+ it "once fails when not called" do
@mock.should_receive(:random_call).once
lambda do
@mock.rspec_verify
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "once should pass when called once" do
+ it "once passes when called once" do
@mock.should_receive(:random_call).once
@mock.random_call
@mock.rspec_verify
end
- it "once should pass when called once with specified args" do
+ it "once passes when called once with specified args" do
@mock.should_receive(:random_call).once.with("a", "b", "c")
@mock.random_call("a", "b", "c")
@mock.rspec_verify
end
- it "once should pass when called once with unspecified args" do
+ it "once passes when called once with unspecified args" do
@mock.should_receive(:random_call).once
@mock.random_call("a", "b", "c")
@mock.rspec_verify
View
6 spec/rspec/mocks/options_hash_spec.rb
@@ -3,7 +3,7 @@
module RSpec
module Mocks
describe "calling :should_receive with an options hash" do
- it "should report the file and line submitted with :expected_from" do
+ it "reports the file and line submitted with :expected_from" do
begin
mock = RSpec::Mocks::Mock.new("a mock")
mock.should_receive(:message, :expected_from => "/path/to/blah.ext:37")
@@ -14,7 +14,7 @@ module Mocks
end
end
- it "should use the message supplied with :message" do
+ it "uses the message supplied with :message" do
lambda {
m = RSpec::Mocks::Mock.new("a mock")
m.should_receive(:message, :message => "recebi nada")
@@ -22,7 +22,7 @@ module Mocks
}.should raise_error("recebi nada")
end
- it "should use the message supplied with :message after a similar stub" do
+ it "uses the message supplied with :message after a similar stub" do
lambda {
m = RSpec::Mocks::Mock.new("a mock")
m.stub(:message)
View
34 spec/rspec/mocks/partial_mock_spec.rb
@@ -7,27 +7,27 @@ module Mocks
@object = Object.new
end
- it "should name the class in the failure message" do
+ it "names the class in the failure message" do
@object.should_receive(:foo)
expect do
@object.rspec_verify
end.to raise_error(RSpec::Mocks::MockExpectationError, /\(#<Object:.*>\).foo/)
end
- it "should name the class in the failure message when expectation is on class" do
+ it "names the class in the failure message when expectation is on class" do
Object.should_receive(:foo)
lambda do
Object.rspec_verify
end.should raise_error(RSpec::Mocks::MockExpectationError, /<Object \(class\)>/)
end
- it "should not conflict with @options in the object" do
+ it "does not conflict with @options in the object" do
@object.instance_eval { @options = Object.new }
@object.should_receive(:blah)
@object.blah
end
- it "should_not_receive should mock out the method" do
+ it "should_not_receive mocks out the method" do
@object.should_not_receive(:fuhbar)
expect {
@object.fuhbar
@@ -37,51 +37,51 @@ module Mocks
)
end
- it "should_not_receive should return a negative message expectation" do
+ it "should_not_receive returns a negative message expectation" do
@object.should_not_receive(:foobar).should be_kind_of(RSpec::Mocks::NegativeMessageExpectation)
end
- it "should_receive should mock out the method" do
+ it "should_receive mocks out the method" do
@object.should_receive(:foobar).with(:test_param).and_return(1)
@object.foobar(:test_param).should equal(1)
end
- it "should_receive should handle a hash" do
+ it "should_receive handles a hash" do
@object.should_receive(:foobar).with(:key => "value").and_return(1)
@object.foobar(:key => "value").should equal(1)
end
- it "should_receive should handle an inner hash" do
+ it "should_receive handles an inner hash" do
hash = {:a => {:key => "value"}}
@object.should_receive(:foobar).with(:key => "value").and_return(1)
@object.foobar(hash[:a]).should equal(1)
end
- it "should_receive should return a message expectation" do
+ it "should_receive returns a message expectation" do
@object.should_receive(:foobar).should be_kind_of(RSpec::Mocks::MessageExpectation)
@object.foobar
end
- it "should_receive should verify method was called" do
+ it "should_receive verifies method was called" do
@object.should_receive(:foobar).with(:test_param).and_return(1)
lambda do
@object.rspec_verify
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should_receive should also take a String argument" do
+ it "should_receive also takes a String argument" do
@object.should_receive('foobar')
@object.foobar
end
- it "should_not_receive should also take a String argument" do
+ it "should_not_receive also takes a String argument" do
@object.should_not_receive('foobar')
lambda do
@object.foobar
end.should raise_error(RSpec::Mocks::MockExpectationError)
end
- it "should use report nil in the error message" do
+ it "uses reports nil in the error message" do
allow_message_expectations_on_nil
@this_will_resolve_to_nil.should_receive(:foobar)
@@ -110,7 +110,7 @@ def ==(other)
end
end
- it "should not raise an error when stubbing the object" do
+ it "does not raise an error when stubbing the object" do
o = PartiallyMockedEquals.new :foo
lambda { o.stub(:bar) }.should_not raise_error(NoMethodError)
end
@@ -132,7 +132,7 @@ def private_method; end
@object = MockableClass.new
end
- it 'should keep public methods public' do
+ it 'keeps public methods public' do
@object.should_receive(:public_method)
with_ruby('1.9') do
@object.public_methods.should include(:public_method)
@@ -143,7 +143,7 @@ def private_method; end
@object.public_method
end
- it 'should keep private methods private' do
+ it 'keeps private methods private' do
@object.should_receive(:private_method)
with_ruby('1.9') do
@object.private_methods.should include(:private_method)
@@ -154,7 +154,7 @@ def private_method; end
@object.public_method
end
- it 'should keep protected methods protected' do
+ it 'keeps protected methods protected' do
@object.should_receive(:protected_method)
with_ruby('1.9') do
@object.protected_methods.should include(:protected_method)
View
2  spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb
@@ -63,7 +63,7 @@ def existing_method
obj.rspec_verify
end
- it "should restore original method if existed" do
+ it "restores the original method if it existed" do
obj.existing_method.should equal(:original_value)
obj.should_receive(:existing_method).and_return(:mock_value)
obj.existing_method.should equal(:mock_value)
View
40 spec/rspec/mocks/passing_argument_matchers_spec.rb
@@ -16,22 +16,22 @@ module Mocks
describe Methods, "handling argument matchers" do
include_mock_argument_matchers
- it "should accept true as boolean()" do
+ it "accepts true as boolean()" do
@mock.should_receive(:random_call).with(boolean())
@mock.random_call(true)
end
- it "should accept false as boolean()" do
+ it "accepts false as boolean()" do
@mock.should_receive(:random_call).with(boolean())
@mock.random_call(false)
end
- it "should accept fixnum as kind_of(Numeric)" do
+ it "accepts fixnum as kind_of(Numeric)" do
@mock.should_receive(:random_call).with(kind_of(Numeric))
@mock.random_call(1)
end
- it "should accept float as an_instance_of(Numeric)" do
+ it "accepts float as an_instance_of(Numeric)" do
@mock.should_receive(:random_call).with(kind_of(Numeric))
@mock.random_call(1.5)
end
@@ -41,47 +41,47 @@ module Mocks
@mock.random_call(1)
end
- it "should NOT accept fixnum as instance_of(Numeric)" do
+ it "does NOT accept fixnum as instance_of(Numeric)" do
@mock.should_not_receive(:random_call).with(instance_of(Numeric))
@mock.random_call(1)
end
- it "should NOT accept float as instance_of(Numeric)" do
+ it "does NOT accept float as instance_of(Numeric)" do
@mock.should_not_receive(:random_call).with(instance_of(Numeric))
@mock.random_call(1.5)
end
- it "should accept string as anything()" do
+ it "accepts string as anything()" do
@mock.should_receive(:random_call).with("a", anything(), "c")
@mock.random_call("a", "whatever", "c")
end
- it "should match duck type with one method" do
+ it "matches duck type with one method" do
@mock.should_receive(:random_call).with(duck_type(:length))
@mock.random_call([])
end
- it "should match duck type with two methods" do
+ it "matches duck type with two methods" do
@mock.should_receive(:random_call).with(duck_type(:abs, :div))
@mock.random_call(1)
end
- it "should match no args against any_args()" do
+ it "matches no args against any_args()" do
@mock.should_receive(:random_call).with(any_args)
@mock.random_call()
end
- it "should match one arg against any_args()" do
+ it "matches one arg against any_args()" do
@mock.should_receive(:random_call).with(any_args)
@mock.random_call("a string")
end
- it "should match no args against no_args()" do
+ it "matches no args against no_args()" do
@mock.should_receive(:random_call).with(no_args)
@mock.random_call()
end
- it "should match hash with hash_including same hash" do
+ it "matches hash with hash_including same hash" do
@mock.should_receive(:random_call).with(hash_including(:a => 1))
@mock.random_call(:a => 1)
end
@@ -91,7 +91,7 @@ module Mocks
describe Methods, "handling block matchers" do
include_mock_argument_matchers
- it "should match arguments against RSpec expectations" do
+ it "matches arguments against RSpec expectations" do
@mock.should_receive(:random_call).with {|arg1, arg2, arr, *rest|
arg1.should == 5
arg2.should have_at_least(3).characters
@@ -109,33 +109,33 @@ module Mocks
@mock = RSpec::Mocks::Mock.new("test mock")
end
- it "should match non special symbol (can be removed when deprecated symbols are removed)" do
+ it "matches non special symbol (can be removed when deprecated symbols are removed)" do
@mock.should_receive(:random_call).with(:some_symbol)
@mock.random_call(:some_symbol)
end
- it "should match string against regexp" do
+ it "matches string against regexp" do
@mock.should_receive(:random_call).with(/bcd/)
@mock.random_call("abcde")
end
- it "should match regexp against regexp" do
+ it "matches regexp against regexp" do
@mock.should_receive(:random_call).with(/bcd/)
@mock.random_call(/bcd/)
end
- it "should match against a hash submitted and received by value" do
+ it "matches against a hash submitted and received by value" do
@mock.should_receive(:random_call).with(:a => "a", :b => "b")
@mock.random_call(:a => "a", :b => "b")
end
- it "should match against a hash submitted by reference and received by value" do
+ it "matches against a hash submitted by reference and received by value" do
opts = {:a => "a", :b => "b"}
@mock.should_receive(:random_call).with(opts)
@mock.random_call(:a => "a", :b => "b")
end
- it "should match against a hash submitted by value and received by reference" do
+ it "matches against a hash submitted by value and received by reference" do
opts = {:a => "a", :b => "b"}
@mock.should_receive(:random_call).with(:a => "a", :b => "b")
@mock.random_call(opts)