[rspec-users] Trouble making rspec-rails 2 work with webrat.

David Chelimsky dchelimsky at gmail.com
Mon Nov 29 10:18:11 EST 2010


On Nov 29, 2010, at 4:58 AM, Jim Morris wrote:

> Ok adding
> 
> include Rack::Test::Methods
> 
> to my spec_helper changed the error to
> 
>    Failure/Error: visit "/"
>     No response yet. Request a page first.
>     # /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rack-
> test-0.5.6/lib/rack/mock_session.rb:51:in `last_response'
>     # /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
> webrat-0.7.2/lib/webrat/adapters/rack.rb:26:in `response'
>     # /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
> webrat-0.7.2/lib/webrat/adapters/rack.rb:14:in `response_body'
>     # /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
> webrat-0.7.2/lib/webrat/core/session.rb:176:in `exception_caught?'
>     # /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
> webrat-0.7.2/lib/webrat/core/session.rb:121:in `request_page'
>     # /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
> webrat-0.7.2/lib/webrat/core/session.rb:217:in `visit'
>     # /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/
> webrat-0.7.2/lib/webrat/core/methods.rb:7:in `visit'
>     # ./spec/requests/basics_spec.rb:5
> 
> So someone is not including the rack test stuff, however still don;t
> know why it is failing

I'd get rid of all of that stuff from spec_helper. It was guidance from a cucumber-rails issue, not an rspec issue, and is unnecessary with rspec. I'd just re-generate it with "script/rails generate rspec:install"

HTH,
David

> 
> On Nov 15, 3:36 pm, David Chelimsky <dchelim... at gmail.com> wrote:
>> On Nov 15, 2010, at 4:51 PM, Peter Havens wrote:
>> 
>> 
>> 
>>> I'm having problems getting rspec-rails 2 request specs to work with
>>> webrat. Any help would be appreciated. Here's my setup:
>> 
>>> ruby 1.9.2p0
>>> rails 3.0.1
>>> rspec-rails 2.1.0
>>> webrat0.7.2
>> 
>>> Here's the error I'm getting:
>> 
>>> $ rspec --backtrace spec/requests/ssl_certificate_requests_spec.rb
>>> F
>> 
>>> Failures:
>>>  1) <text>
>>>     Failure/Error: Unable to find matching line from backtrace
>>>     stack level too deep
>>>     # /opt/local/lib/ruby1.9/1.9.1/forwardable.rb:185
>> 
>>> Finished in 0.49825 seconds
>>> 1 example, 1 failure
>> 
>>> Here are snippets of my files:
>> 
>>> # spec/spec_helper.rb
>>> #
>>> # The following is based on  some tips from a cucumber-rails ticket:
>>> require "webrat"
>>> require "webrat/core/matchers"
>> 
>>> include Rack::Test::Methods
>>> includeWebrat::Methods
>>> includeWebrat::Matchers
>> 
>>> Webrat.configure do |config|
>>>  config.mode = :rack
>>>  config.open_error_files = false
>>> end
>> 
>>> # spec/requests/<file>_spec.rb
>>> require "spec_helper"
>> 
>>> describe "<text>" do
>>>  it "<text>" do
>>>    visit <text>_path
>> 
>>>    # The following works when uncommented:
>>>    #
>>>    # get <text>_path
>>>    # assert_template '<text>/<text>'
>>>  end
>>> end
>> 
>> This is actually awebratissue, but it is reported to rspec-rails andwebrat:
>> 
>> https://github.com/rspec/rspec-rails/issues/140https://webrat.lighthouseapp.com/projects/10503/tickets/398https://webrat.lighthouseapp.com/projects/10503/tickets/400
>> 
>> 
>> 
>>> Thanks,
>>> Pete
>>> _______________________________________________
>>> rspec-users mailing list
>>> rspec-us... at rubyforge.org
>>> http://rubyforge.org/mailman/listinfo/rspec-users
>> 
>> _______________________________________________
>> rspec-users mailing list
>> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list