Skip to content

Commit

Permalink
Make Rack::Test methods available when using Capybara. Relates to GH-26
Browse files Browse the repository at this point in the history
  • Loading branch information
cavalle committed Nov 21, 2010
1 parent f95cb1c commit e79bd3c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions lib/rspec-2/rails/generators/templates/acceptance_helper.rb
Expand Up @@ -13,7 +13,7 @@ module Steak::Webrat
include Webrat::Matchers
def app
Rails.application
::Rails.application
end
end
Expand All @@ -22,7 +22,16 @@ def app
<%- else -%>
require 'capybara/rails'
RSpec.configuration.include Capybara, :type => :acceptance
module Steak::Capybara
include Rack::Test::Methods
include Capybara
def app
::Rails.application
end
end
RSpec.configuration.include Steak::Capybara, :type => :acceptance
<%- end -%>
# Put your acceptance spec helpers inside /spec/acceptance/support
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/rspec-2/rails_spec.rb
Expand Up @@ -30,12 +30,12 @@
feature "Minimal spec" do
scenario "First scenario" do
get "/"
response.should contain(/No route matches/)
last_response.body.should =~ /Not Found/
end
end
SPEC
output = run_spec spec_file, File.join(File.dirname(spec_file), '../..')
output.should =~ /1 example, 1 failure/
output.should =~ /1 example, 0 failures/
end

scenario "Path helpers are available" do
Expand Down

0 comments on commit e79bd3c

Please sign in to comment.