Permalink
Browse files

request_spec.feature - Closes #186

  • Loading branch information...
1 parent 5d2dd10 commit 646c00e62ce6e2b5f936d6d898e7019ac469e3c5 @justinko justinko committed Apr 21, 2011
Showing with 41 additions and 1 deletion.
  1. +0 −1 features/controller_specs/controller_spec.feature
  2. +41 −0 features/request_specs/request_spec.feature
@@ -1,6 +1,5 @@
Feature: controller spec
-
Scenario: simple passing example
Given a file named "spec/controllers/widgets_controller_spec.rb" with:
"""
@@ -0,0 +1,41 @@
+Feature: request spec
+
+ Request specs allow you to spec the interaction of your
+ Rails application across multiple controllers. This is generally
+ known as "full stack" testing.
+
+ RSpec provides two matchers that delegate to Rails assertion methods:
+
+ `render_template` (delegated to `assert_template`)
+ `redirect_to` (delegated to `assert_redirected_to`)
+
+ Please check the Rails documentation for options on these methods.
+
+ Also, if you would like to use webrat or capybara with your request
+ specs, all you have to do is include one of them in your Gemfile and
+ RSpec will automatically load them.
+
+ Scenario: specify managing a Widget with Rails integration methods
+ Given a file named "spec/requests/widget_management_spec.rb" with:
+ """
+ require "spec_helper"
+
+ describe "Widget management" do
+
+ it "creates a Widget and redirects to the Widget's page" do
+ get "/widgets/new"
+ response.should render_template(:new)
+
+ post "/widgets", :widget => {:name => "My Widget"}
+
+ response.should redirect_to(assigns(:widget))
+ follow_redirect!
+
+ response.should render_template(:show)
+ response.body.should include("Widget was successfully created.")
+ end
+
+ end
+ """
+ When I run `rspec spec/requests/widget_management_spec.rb`
+ Then the example should pass

0 comments on commit 646c00e

Please sign in to comment.