Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Dec 2, 2010
1 parent c89a5ac commit e0f80df
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 35 deletions.
17 changes: 0 additions & 17 deletions features/README.markdown

This file was deleted.

25 changes: 25 additions & 0 deletions features/controller_specs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
A controller spec is an RSpec wrapper for a Rails functional test. It allows
you to simulate a single http request in each example, and then specify
expected outcomes, such as:

* templates that are rendered by the action
* instance variables that are assigned in the controller to be shared with
the view
* cookies that get sent back with the response

To specify outcomes, you can use:

* standard rspec matchers (response.code.should eq(200))
* standard test/unit assertions (assert_equal 200, response.code)
* rails assertions (assert_response 200)
* rails-specific matchers:
* response.should render_template (wraps assert_template)
* response.should redirect_to (wraps assert_redirected_to)
* assigns(:widget).should be_a_new(Widget)

Conventions:

* pass the controller being spec'd to the describe method
* this is only necessary for the outermost example group
* by default, views are not rendered. See "isolation from views" and
"render_views" for details
19 changes: 19 additions & 0 deletions features/controller_specs/controller_spec.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Feature: controller spec


Scenario: simple passing example
Given a file named "spec/controllers/widgets_controller_spec.rb" with:
"""
require "spec_helper"
describe WidgetsController do
describe "GET index" do
it "has a 200 status code" do
get :index
response.code.should eq("200")
end
end
end
"""
When I run "rspec spec"
Then the example should pass
18 changes: 0 additions & 18 deletions features/controller_specs/readers.feature

This file was deleted.

4 changes: 4 additions & 0 deletions features/matchers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rspec-rails offers a number of custom matchers, most of which are
rspec-compatible wrappers for Rails' assertions.


5 changes: 5 additions & 0 deletions features/step_definitions/rspec_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Then /^the example(s)? should( all)? pass$/ do |*|
Then %q{the exit status should be 0}
Then %q{the output should contain "0 failures"}
end

0 comments on commit e0f80df

Please sign in to comment.