Browse files

docs

  • Loading branch information...
1 parent 9a0d207 commit 2431a2afc9caef6961a1d1bfc93e376e64f3a42f @dchelimsky dchelimsky committed May 12, 2011
Showing with 26 additions and 5 deletions.
  1. +12 −5 features/helper_specs/helper_spec.feature
  2. +14 −0 features/matchers/README.md
View
17 features/helper_specs/helper_spec.feature
@@ -1,18 +1,25 @@
Feature: helper spec
Helper specs live in `spec/helpers`, or any example group with `:type =>
- :helper`. In order to access the helper methods you can call them on the
- `helper` object.
+ :helper`.
+
+ Helper specs expose a `helper` object, which includes the helper module being
+ specified, the `ApplicationHelper` module (if there is one) and all of the
+ helpers built into Rails. It does not include the other helper modules in
+ your app.
+
+ To access the helper methods you're specifying, simply call them directly
+ on the `helper` object.
- Scenario: helper method that returns true
+ Scenario: helper method that returns a value
Given a file named "spec/helpers/application_helper_spec.rb" with:
"""
require "spec_helper"
describe ApplicationHelper do
describe "#page_title" do
it "returns true" do
@myronmarston
RSpec member

The doc string doesn't match now.

@dchelimsky
RSpec member

Fixed in next commit. Thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- helper.page_title.should be_true
+ helper.page_title.should eq("RSpec is your friend")
end
end
end
@@ -21,7 +28,7 @@ Feature: helper spec
"""
module ApplicationHelper
def page_title
- true
+ "RSpec is your friend"
end
end
"""
View
14 features/matchers/README.md
@@ -1,4 +1,18 @@
rspec-rails offers a number of custom matchers, most of which are
rspec-compatible wrappers for Rails' assertions.
+### redirects
+ # delegates to assert_redirected_to
+ response.should redirect_to(path)
+
+### templates
+
+ # delegates to assert_template
+ response.should render_template(template_name)
+
+### assigned objects
+
+ # passes if assigns(:widget) is an instance of Widget
+ # and it is not persisted
+ assigns(:widget).should be_a_new(Widget)

0 comments on commit 2431a2a

Please sign in to comment.