Skip to content

Commit

Permalink
words
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Jun 18, 2010
1 parent 1ad69b7 commit f504614
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.markdown
Expand Up @@ -167,6 +167,33 @@ This represents the rendered view.

`rendered` replaces `response` from rspec-rails-1.3

# Routing specs

Routing specs live in spec/routing.

describe "routing to profiles" do
it "routes /profile/:username to profile#show for username" do
{ :get => "/profiles/jsmith" }.should route_to(
:controller => "profiles",
:action => "show",
:username => "jsmith"
)
end

it "does not expose a list of profiles" do
{ :get => "/profiles" }.should_not be_routable
end
end

## `route_to`

Delegates to Rails' assert_routing.

## `be_routable`

Passes if the path is recognized by Rails' routing. This is primarily intended
to be used with `should_not` to specify routes that should not be routable.

# Helper specs

Helper specs live in spec/helpers, and mix in ActionView::TestCase::Behavior.
Expand Down
1 change: 1 addition & 0 deletions lib/rspec/rails/example/controller_example_group.rb
Expand Up @@ -36,6 +36,7 @@ module RSpec::Rails
# describe WidgetsController do
# describe "GET index" do
# fixtures :widgets
#
# it "assigns all widgets to @widgets" do
# get :index
# assigns(:widgets).should eq(Widget.all)
Expand Down
12 changes: 12 additions & 0 deletions lib/rspec/rails/example/request_example_group.rb
Expand Up @@ -2,6 +2,18 @@
require 'webrat'

module RSpec::Rails
# Extends ActionDispatch::Integration::Runner to work with RSpec.
#
# == Matchers
#
# In addition to the stock matchers from rspec-expectations, request
# specs add these matchers, which delegate to rails' assertions:
#
# response.should render_template(*args)
# => delegates to assert_template(*args)
#
# response.should redirect_to(destination)
# => delegates to assert_redirected_to(destination)
module RequestExampleGroup
extend ActiveSupport::Concern

Expand Down

0 comments on commit f504614

Please sign in to comment.