Permalink
Browse files

Merge pull request #244 from JonRowe/cleanup_whitespace

Cleanup stray whitespace
  • Loading branch information...
myronmarston committed Mar 19, 2013
2 parents 1461794 + 6ac50f2 commit 42a175e1b932a14958c005501fe98a599a0ef3ca
View
@@ -19,10 +19,10 @@ Or ...
bundle install --binstubs
bin/rspec
-
+
## Customize the dev enviroment
The Gemfile includes the gems you'll need to be able to run specs. If you want
to customize your dev enviroment with additional tools like guard or
ruby-debug, add any additional gem declarations to Gemfile-custom (see
-Gemfile-custom.sample for some examples).
+Gemfile-custom.sample for some examples).
@@ -15,7 +15,7 @@ Argument matchers can be used:
#create a double
obj = double()
-
+
#expect a message with given args
obj.should_receive(:message).with('an argument')
@@ -24,4 +24,4 @@ If more control is needed, one can use a block
obj.should_receive(:message) do |arg1, arg2|
# set expectations about the args in this block
# and optionally set a return value
- end
+ end
@@ -46,7 +46,7 @@ Feature: explicit arguments
object.foo(:this).should eq("got this")
object.foo(:this, :that).should eq("got this and that")
end
-
+
it "works on mocks" do
object = double('foo')
object.should_receive(:foo).with(:this, :that)
@@ -56,5 +56,4 @@ Feature: explicit arguments
end
"""
When I run `rspec stub_multiple_explicit_args_spec.rb`
- Then the output should contain "2 examples, 0 failures"
-
+ Then the output should contain "2 examples, 0 failures"
@@ -1,6 +1,6 @@
Feature: General matchers
- The `anything`, `any_args`, and `no_args` matchers can be used to require the method
+ The `anything`, `any_args`, and `no_args` matchers can be used to require the method
to have arguments (or not) without constraining the details of the argument, such as its
type, pattern or value. The `anything` matcher only reflects a single argument, while
the `any_args` matcher matches any arity.
@@ -82,4 +82,4 @@ Feature: General matchers
end
"""
When I run `rspec stub_no_args_expectations_spec.rb`
- Then the output should contain "2 examples, 1 failure"
+ Then the output should contain "2 examples, 1 failure"
@@ -1,9 +1,9 @@
Feature: stub with argument constraints
You can further specify the behavior by constraining the type,
- format and/or number of arguments with the `#with()` method
+ format and/or number of arguments with the `#with()` method
chained off of `#stub()`
-
+
Scenario: an_instance_of argument matcher
Given a file named "stub_an_instance_of_args_spec.rb" with:
"""ruby
@@ -23,5 +23,4 @@ Feature: stub with argument constraints
end
"""
When I run `rspec stub_an_instance_of_args_spec.rb`
- Then the output should contain "1 example, 0 failures"
-
+ Then the output should contain "1 example, 0 failures"
@@ -37,7 +37,7 @@ You can also use the block format:
obj.should_receive(:message) { throw :this_symbol }
### Argument constraints
-
+
#### Explicit arguments
obj.should_receive(:message).with('an argument')
@@ -53,7 +53,7 @@ You can also use the block format:
obj.should_receive(:message).with(/abc/)
-### Counts
+### Counts
obj.should_receive(:message).once
obj.should_receive(:message).twice
@@ -2,7 +2,7 @@ Feature: expect a message on any instance of a class
Use `any_instance.should_receive` to set an expectation that one (and only
one) instance of a class receives a message before the example is completed.
-
+
The spec will fail if no instance receives a message.
Scenario: expect a message on any instance of a class
@@ -18,4 +18,4 @@ Feature: expect a message on any instance of a class
end
"""
When I run `rspec example_spec.rb`
- Then the examples should all pass
+ Then the examples should all pass
@@ -32,9 +32,9 @@ Feature: block local expectations
"""
When I run `rspec spec/account_spec.rb`
Then the output should contain "1 example, 0 failures"
-
+
Scenario: failing example
-
+
Given a file named "spec/account_spec.rb" with:
"""
require 'account'
@@ -52,4 +52,4 @@ Feature: block local expectations
"""
When I run `rspec spec/account_spec.rb`
- Then the output should contain "1 example, 1 failure"
+ Then the output should contain "1 example, 1 failure"
@@ -30,7 +30,7 @@ You can also use the block format:
obj.stub(:message) { throw :this_symbol }
### Argument constraints
-
+
#### Explicit arguments
obj.stub(:message).with('an argument') { ... }
@@ -20,7 +20,7 @@ Feature: stub on any instance of a class
"""
When I run `rspec example_spec.rb`
Then the examples should all pass
-
+
Scenario: any_instance stub with a hash
Given a file named "example_spec.rb" with:
"""ruby
@@ -37,8 +37,8 @@ Feature: stub on any instance of a class
end
"""
When I run `rspec example_spec.rb`
- Then the examples should all pass
-
+ Then the examples should all pass
+
Scenario: any_instance stub with specific arguments matchers
Given a file named "example_spec.rb" with:
"""ruby
@@ -47,7 +47,7 @@ Feature: stub on any instance of a class
it "returns the stubbed value when arguments match" do
Object.any_instance.stub(:foo).with(:param_one, :param_two).and_return(:result_one)
Object.any_instance.stub(:foo).with(:param_three, :param_four).and_return(:result_two)
-
+
o = Object.new
o.foo(:param_one, :param_two).should eq(:result_one)
o.foo(:param_three, :param_four).should eq(:result_two)
@@ -57,7 +57,7 @@ Feature: stub on any instance of a class
"""
When I run `rspec example_spec.rb`
Then the examples should all pass
-
+
Scenario: any_instance unstub
Given a file named "example_spec.rb" with:
"""ruby
@@ -68,7 +68,7 @@ Feature: stub on any instance of a class
:foo
end
end
-
+
Object.any_instance.stub(:foo)
Object.any_instance.unstub(:foo)
@@ -77,8 +77,8 @@ Feature: stub on any instance of a class
end
"""
When I run `rspec example_spec.rb`
- Then the examples should all pass
-
+ Then the examples should all pass
+
Scenario: any_instance unstub
Given a file named "example_spec.rb" with:
"""ruby
@@ -93,15 +93,15 @@ Feature: stub on any instance of a class
Object.any_instance.should_receive(:foo).and_return(:bar)
Object.any_instance.stub(:foo)
Object.any_instance.unstub(:foo)
-
+
Object.new.foo.should eq(:bar)
end
end
end
"""
When I run `rspec example_spec.rb`
Then the examples should all pass
-
+
Scenario: stub a chain of methods an any instance
Given a file named "stub_chain_spec.rb" with:
"""ruby
@@ -129,4 +129,4 @@ Feature: stub on any instance of a class
end
"""
When I run `rspec stub_chain_spec.rb`
- Then the examples should all pass
+ Then the examples should all pass
@@ -6,7 +6,7 @@ Feature: as_null_object
EXCEPTION: `to_ary` will raise a NoMethodError unless explicitly stubbed in
order to support `flatten` on an Array containing a double.
- Scenario: double acting as_null_object
+ Scenario: double acting as_null_object
Given a file named "as_null_object_spec.rb" with:
"""ruby
describe "a double with as_null_object called" do
@@ -2,7 +2,7 @@ Feature: stub with substitute implementation
You can stub an implementation of a method (a.k.a. fake) by passing a block
to the `stub` method.
-
+
Scenario: stub implementation
Given a file named "stub_implementation_spec.rb" with:
"""ruby
@@ -16,7 +16,7 @@ Feature: stub with substitute implementation
"got that"
end
end
-
+
object.foo(:this).should eq("got this")
object.foo(:that).should eq("got that")
end
@@ -15,10 +15,10 @@ Feature: configure any test framework to use rspec-mocks
should_receive
should_not_receive
stub
-
+
In order to give control to the consuming framework, none of these facilities
are added until RSpec::Mocks::setup(self) is called. Simply requiring
- 'rspec/mocks' is not sufficient.
+ 'rspec/mocks' is not sufficient.
NOTICE: the stub() method that is added to the object passed to setup is not
the same stub() method that is added to every other object.
@@ -30,7 +30,7 @@ class ArgumentListMatcher
# @api public
# @param [Array] *expected_args a list of expected literals and/or argument matchers
- # @param [Block] block a block with arity matching the expected
+ # @param [Block] block a block with arity matching the expected
#
# Initializes an `ArgumentListMatcher` with a collection of literal
# values and/or argument matchers, or a block that handles the evaluation
@@ -116,5 +116,4 @@ def pretty_print(count)
end
end
-end
-
+end
@@ -3,7 +3,7 @@ module Mocks
# @private
class MockExpectationError < Exception
end
-
+
# @private
class AmbiguousReturnError < StandardError
end
@@ -255,7 +255,7 @@ def warn_if_nil_class
# @private
def raise_method_not_stubbed_error
- raise MockExpectationError, "The method `#{method_name}` was not stubbed or was already unstubbed"
+ raise MockExpectationError, "The method `#{method_name}` was not stubbed or was already unstubbed"
end
# @private
@@ -411,5 +411,4 @@ def self.raise_on_invalid_const
# of both stubbing and hiding.
ConstantStubber = ConstantMutator
end
-end
-
+end
@@ -4,17 +4,17 @@ class LiarLiarPantsOnFire
def respond_to?(message, incl_private=false)
true
end
-
+
def self.respond_to?(message, incl_private=false)
true
end
end
-
+
describe 'should_receive' do
before(:each) do
@liar = LiarLiarPantsOnFire.new
end
-
+
it "works when object lies about responding to a method" do
@liar.should_receive(:something)
@liar.something
@@ -24,7 +24,7 @@ def self.respond_to?(message, incl_private=false)
LiarLiarPantsOnFire.should_receive(:something)
LiarLiarPantsOnFire.something
end
-
+
it 'cleans up after itself' do
expect((class << LiarLiarPantsOnFire; self; end).instance_methods).not_to include("something")
end
@@ -9,7 +9,7 @@ def self.method_that_uses_define_method
end
end
end
-
+
it "works" do
ExampleClass.should_receive(:define_method).with("defined_method")
ExampleClass.method_that_uses_define_method
@@ -11,6 +11,6 @@ class Bar < Foo; end
it "should" do
expect(Bar.new.class).to eq Bar
- end
+ end
end
end
Oops, something went wrong.

0 comments on commit 42a175e

Please sign in to comment.