Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

reorganize the nav for relish

  • Loading branch information...
commit 3c9bf802804bb92aabc2b00fefa2eb86c92deaaf 1 parent ec53f43
@dchelimsky dchelimsky authored
View
11 features/.nav
@@ -0,0 +1,11 @@
+- method_stubs:
+ - simple_return_value.feature
+ - stub_implementation.feature
+ - stub_chain.feature
+- message_expectations:
+ - expect_message.feature
+ - block_local_expectations.feature.pending
+ - warn_when_expectation_is_set_on_nil.feature
+- outside_rspec:
+ - configuration.feature
+ - standalone.feature
View
7 features/README.markdown
@@ -1,6 +1,6 @@
rspec-mocks is used to create dynamic "doubles", which stand in for real
-objects in examples. You can set message expectations on them (i.e. mock
-methods), and/or stub return values for arbitrary messages:
+objects in examples. You can stub return values and/or set message
+expectations:
describe Account do
context "when closed" do
@@ -16,9 +16,6 @@ methods), and/or stub return values for arbitrary messages:
end
end
-Message expectations like the one in the example above are verified at
-the end of each example.
-
## Issues
The documentation for rspec-mocks is a work in progress. We'll be adding
View
2  features/message_expectations/expect_message.feature
@@ -1,4 +1,4 @@
-Feature: Expect a message
+Feature: expect a message
Use should_receive() to set an expectation that a receiver should receive a
message before the example is completed.
View
2  features/message_expectations/warn_when_expectation_is_set_on_nil.feature
@@ -1,4 +1,4 @@
-Feature: Warn when expectation is set on nil
+Feature: warn when expectation is set on nil
Scenario: nil instance variable
Given a file named "example_spec.rb" with:
View
4 features/stubs/simple_return_value.feature → .../method_stubs/simple_return_value.feature
@@ -1,6 +1,6 @@
-Feature: Stub with simple return value
+Feature: stub with a simple return value
- Use the stub() method on a test double or a real object to tell the object to
+ Use the `stub` method on a test double or a real object to tell the object to
return a value (or values) in response to a given message. If the message is
never received, nothing happens.
View
16 features/stubs/stub_chain.feature → features/method_stubs/stub_chain.feature
@@ -1,23 +1,23 @@
-Feature: Stub a chain of methods
+Feature: stub a chain of methods
- The stub_chain method lets you to stub a chain of methods in one statement.
+ The `stub_chain` method lets you to stub a chain of methods in one statement.
Method chains are considered a design smell, but it's not really the method
chain that is the problem - it's the dependency chain represented by a chain
of messages to different objects:
- foo.get_bar.get_baz
+ foo.get_bar.get_baz
- This is a Law of Demeter violation if get_bar() returns an object other than
- foo, and get_baz() returns yet another object.
+ This is a Law of Demeter violation if `get_bar` returns an object other than
+ `foo`, and `get_baz` returns yet another object.
Fluent interfaces look similar from a caller's perspective, but don't
represent a dependency chain (the caller depends only on the object it is
calling). Consider this common example from Ruby on Rails:
- Article.recent.by(current_user)
+ Article.recent.by(current_user)
- The recent() and by() methods return the same object, so this is not
- a Law of Demeter violation.
+ The `recent` and `by` methods return the same object, so this is not a Law of
+ Demeter violation.
Scenario: stub a chain of methods
Given a file named "stub_chain_spec.rb" with:
View
2  features/stubs/stub_implementation.feature → .../method_stubs/stub_implementation.feature
@@ -1,4 +1,4 @@
-Feature: Stub with substitute implementation
+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.
View
2  features/outside_rspec/configuration.feature
@@ -1,4 +1,4 @@
-Feature: Configure any test framework to use rspec-mocks
+Feature: configure any test framework to use rspec-mocks
Test frameworks that want to use rspec-mocks can use
RSpec::Mocks::setup(self) to hook into rspec-mocks. Doing so adds the
View
2  features/outside_rspec/standalone.feature
@@ -4,7 +4,7 @@ Feature: standalone
outside the RSpec environment. This is especially useful for
exploring rspec-mocks in irb.
- Scenario: stub outside rspec
+ Scenario: method stub outside rspec
Given a file named "example.rb" with:
"""
require "rspec/mocks/standalone"
Please sign in to comment.
Something went wrong with that request. Please try again.