Peter Havens
2010-Nov-15 22:51 UTC
[rspec-users] Trouble making rspec-rails 2 work with webrat.
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 webrat 0.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 include Webrat::Methods include Webrat::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 Thanks, Pete
David Chelimsky
2010-Nov-15 23:36 UTC
[rspec-users] Trouble making rspec-rails 2 work with webrat.
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 > webrat 0.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 > include Webrat::Methods > include Webrat::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 > endThis is actually a webrat issue, but it is reported to rspec-rails and webrat: https://github.com/rspec/rspec-rails/issues/140 https://webrat.lighthouseapp.com/projects/10503/tickets/398 https://webrat.lighthouseapp.com/projects/10503/tickets/400> > Thanks, > Pete > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Jim Morris
2010-Nov-29 10:51 UTC
[rspec-users] Trouble making rspec-rails 2 work with webrat.
I don''t get the stack level too deep but I do get undefined method `last_response'' for #<RSpec::Core::ExampleGroup::Nested_2:0x9da18cc> Which was supposed to be fixed ages ago. So did one fix break another? I have webrat using :rack config rspec 2.2.0, rspec-rails 2.2.0, webrat 0.7.2, rails 3.0.3 It looks to me like the webrat rack adapter is calling @session.last_response which is a rack/test call and should work, Should I report this on the webrat page or rspec??? 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
Jim Morris
2010-Nov-29 10:58 UTC
[rspec-users] Trouble making rspec-rails 2 work with webrat.
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 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
David Chelimsky
2010-Nov-29 15:18 UTC
[rspec-users] Trouble making rspec-rails 2 work with webrat.
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 failingI''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
Jim Morris
2010-Nov-29 21:28 UTC
[rspec-users] Trouble making rspec-rails 2 work with webrat.
Sorry I may have been unclear.... When using the default spec_helper as generated from a fresh script/rails generate rspec:install I get the error... undefined method `last_response'' for #<RSpec::Core::ExampleGroup::Nested_2:0x9da18cc> This means something is not seeing the Rack Test stuff. The second error is got when I add include Rack::Test::Methods It now sees last_response but doesn''t get a respnose from visit (That may be a different errror). So bottom line is using the latest rails/rspec/webrat does not work out of the box. On Nov 29, 7:18?am, David Chelimsky <dchelim... at gmail.com> wrote:> 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.lightho... > > >>> 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-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
Jim Morris
2010-Nov-29 21:32 UTC
[rspec-users] Trouble making rspec-rails 2 work with webrat.
BGTW the spec is very simple... require ''spec_helper'' describe "Logins" do describe "GET /login" do it "should be able to login" do get "/login" p response.body end end end the undefined method `last_response'' for #<RSpec::Core::ExampleGroup::Nested_2:0x9da18cc> comes from the p response.body On Nov 29, 7:18?am, David Chelimsky <dchelim... at gmail.com> wrote:> 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.lightho... > > >>> 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-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
David Chelimsky
2010-Nov-29 22:44 UTC
[rspec-users] Trouble making rspec-rails 2 work with webrat.
On Nov 29, 2010, at 3:28 PM, Jim Morris wrote:> Sorry I may have been unclear.... > > When using the default spec_helper as generated from a fresh > script/rails generate rspec:install > I get the error... > > undefined method `last_response'' for > #<RSpec::Core::ExampleGroup::Nested_2:0x9da18cc> > > This means something is not seeing the Rack Test stuff. > > The second error is got when I add > > include Rack::Test::Methods > > It now sees last_response but doesn''t get a respnose from visit (That > may be a different errror). > > So bottom line is using the latest rails/rspec/webrat does not work > out of the box.It does for me, so something is different between our configurations. Do you have webrat in the Gemfile? Is this a controller spec? If so is it in the spec/controllers directory?> > On Nov 29, 7:18 am, David Chelimsky <dchelim... at gmail.com> wrote: >> 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.lightho... >> >>>>> 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-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
David Chelimsky
2010-Nov-29 22:45 UTC
[rspec-users] Trouble making rspec-rails 2 work with webrat.
On Nov 29, 2010, at 4:44 PM, David Chelimsky wrote:> > On Nov 29, 2010, at 3:28 PM, Jim Morris wrote: > >> Sorry I may have been unclear.... >> >> When using the default spec_helper as generated from a fresh >> script/rails generate rspec:install >> I get the error... >> >> undefined method `last_response'' for >> #<RSpec::Core::ExampleGroup::Nested_2:0x9da18cc> >> >> This means something is not seeing the Rack Test stuff. >> >> The second error is got when I add >> >> include Rack::Test::Methods >> >> It now sees last_response but doesn''t get a respnose from visit (That >> may be a different errror). >> >> So bottom line is using the latest rails/rspec/webrat does not work >> out of the box. > > It does for me, so something is different between our configurations. > > Do you have webrat in the Gemfile? > Is this a controller spec? If so is it in the spec/controllers directory?Also, what version of rspec-rails are we talking about?> >> >> On Nov 29, 7:18 am, David Chelimsky <dchelim... at gmail.com> wrote: >>> 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.lightho... >>> >>>>>> 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-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 >
Jim Morris
2010-Nov-30 02:05 UTC
[rspec-users] Trouble making rspec-rails 2 work with webrat.
Hi David, I am using the current versions of everything rspec rspec (2.2.0,) rspec-core (2.2.1) rspec-expectations (2.2.0) rspec-mocks (2.2.0,) rspec-rails (2.2.0) webrat (0.7.2) rails(3.0.3) webrat is in Gemfile... group :test, :development do gem ''webrat'' gem ''rspec-rails'' end My spec is meant to be an integration test and as such is in spec/ requests I have a pretty simple setup, the full source is here... https://github.com/wolfmanjm/wolfmanblog_rails Thanks for the help, its odd so many people are having issues with webrat, should I cross post to their group or is this an rspec/webrat/ rails3 issue? On Nov 29, 2:45?pm, David Chelimsky <dchelim... at gmail.com> wrote:> On Nov 29, 2010, at 4:44 PM, David Chelimsky wrote: > > > > > > > On Nov 29, 2010, at 3:28 PM, Jim Morris wrote: > > >> Sorry I may have been unclear.... > > >> When using the default spec_helper as generated from a fresh > >> script/rails generate rspec:install > >> I get the error... > > >> undefined method `last_response'' for > >> #<RSpec::Core::ExampleGroup::Nested_2:0x9da18cc> > > >> This means something is not seeing the Rack Test stuff. > > >> The second error is got when I add > > >> include Rack::Test::Methods > > >> It now sees last_response but doesn''t get a respnose from visit (That > >> may be a different errror). > > >> So bottom line is using the latest rails/rspec/webrat does not work > >> out of the box. > > > It does for me, so something is different between our configurations. > > > Do you have webrat in the Gemfile? > > Is this a controller spec? If so is it in the spec/controllers directory? > > Also, what version of rspec-rails are we talking about? > > > > > > >> On Nov 29, 7:18 am, David Chelimsky <dchelim... at gmail.com> wrote: > >>> 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.lightho... > > >>>>>> 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-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-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
David Chelimsky
2010-Nov-30 14:34 UTC
[rspec-users] Trouble making rspec-rails 2 work with webrat.
On Nov 29, 2010, at 8:05 PM, Jim Morris wrote:> Hi David, > > I am using the current versions of everything rspec > rspec (2.2.0,) > rspec-core (2.2.1) > rspec-expectations (2.2.0) > rspec-mocks (2.2.0,) > rspec-rails (2.2.0) > webrat (0.7.2) > rails(3.0.3) > > webrat is in Gemfile... > > group :test, :development do > gem ''webrat'' > gem ''rspec-rails'' > end > > My spec is meant to be an integration test and as such is in spec/ > requests > > I have a pretty simple setup, the full source is here... > > https://github.com/wolfmanjm/wolfmanblog_rails > > > Thanks for the help, its odd so many people are having issues with > webrat, should I cross post to their group or is this an rspec/webrat/ > rails3 issue?I''m not sure where the issue is yet (most likely rspec), but I was able to see it by cloning your repo and running the specs. I was able to get things to work by moving "include Rack::Test::Methods" into the configure block: RSpec.configure do |config| config.include Rack::Test::Methods ... end You should _not_, however, have to do any such thing, so I''ll look into it and if I can address this in rspec-rails I will and have a bug-fix release out soon. Thanks! David> > On Nov 29, 2:45 pm, David Chelimsky <dchelim... at gmail.com> wrote: >> On Nov 29, 2010, at 4:44 PM, David Chelimsky wrote: >> >> >> >> >> >>> On Nov 29, 2010, at 3:28 PM, Jim Morris wrote: >> >>>> Sorry I may have been unclear.... >> >>>> When using the default spec_helper as generated from a fresh >>>> script/rails generate rspec:install >>>> I get the error... >> >>>> undefined method `last_response'' for >>>> #<RSpec::Core::ExampleGroup::Nested_2:0x9da18cc> >> >>>> This means something is not seeing the Rack Test stuff. >> >>>> The second error is got when I add >> >>>> include Rack::Test::Methods >> >>>> It now sees last_response but doesn''t get a respnose from visit (That >>>> may be a different errror). >> >>>> So bottom line is using the latest rails/rspec/webrat does not work >>>> out of the box. >> >>> It does for me, so something is different between our configurations. >> >>> Do you have webrat in the Gemfile? >>> Is this a controller spec? If so is it in the spec/controllers directory? >> >> Also, what version of rspec-rails are we talking about? >> >> >> >> >> >>>> On Nov 29, 7:18 am, David Chelimsky <dchelim... at gmail.com> wrote: >>>>> 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.lightho... >> >>>>>>>> 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-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-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
Jim Morris
2010-Nov-30 21:00 UTC
[rspec-users] Trouble making rspec-rails 2 work with webrat.
cool that did fix it. thanks On Nov 30, 6:34?am, David Chelimsky <dchelim... at gmail.com> wrote:> On Nov 29, 2010, at 8:05 PM, Jim Morris wrote: > > > > > Hi David, > > > I am using the current versions of everything rspec > > rspec (2.2.0,) > > rspec-core (2.2.1) > > rspec-expectations (2.2.0) > > rspec-mocks (2.2.0,) > > rspec-rails (2.2.0) > > webrat (0.7.2) > > rails(3.0.3) > > > webrat is in Gemfile... > > > group :test, :development do > > ?gem ''webrat'' > > ?gem ''rspec-rails'' > > end > > > My spec is meant to be an integration test and as such is in spec/ > > requests > > > I have a pretty simple setup, the full source is here... > > >https://github.com/wolfmanjm/wolfmanblog_rails > > > Thanks for the help, its odd so many people are having issues with > > webrat, should I cross post to their group or is this an rspec/webrat/ > > rails3 issue? > > I''m not sure where the issue is yet (most likely rspec), but I was able to see it by cloning your repo and running the specs. > > I was able to get things to work by moving "include Rack::Test::Methods" into the configure block: > > RSpec.configure do |config| > ? config.include Rack::Test::Methods > ? ... > end > > You should _not_, however, have to do any such thing, so I''ll look into it and if I can address this in rspec-rails I will and have a bug-fix release out soon. > > Thanks! > > David > > > > > > > On Nov 29, 2:45 pm, David Chelimsky <dchelim... at gmail.com> wrote: > >> On Nov 29, 2010, at 4:44 PM, David Chelimsky wrote: > > >>> On Nov 29, 2010, at 3:28 PM, Jim Morris wrote: > > >>>> Sorry I may have been unclear.... > > >>>> When using the default spec_helper as generated from a fresh > >>>> script/rails generate rspec:install > >>>> I get the error... > > >>>> undefined method `last_response'' for > >>>> #<RSpec::Core::ExampleGroup::Nested_2:0x9da18cc> > > >>>> This means something is not seeing the Rack Test stuff. > > >>>> The second error is got when I add > > >>>> include Rack::Test::Methods > > >>>> It now sees last_response but doesn''t get a respnose from visit (That > >>>> may be a different errror). > > >>>> So bottom line is using the latest rails/rspec/webrat does not work > >>>> out of the box. > > >>> It does for me, so something is different between our configurations. > > >>> Do you have webrat in the Gemfile? > >>> Is this a controller spec? If so is it in the spec/controllers directory? > > >> Also, what version of rspec-rails are we talking about? > > >>>> On Nov 29, 7:18 am, David Chelimsky <dchelim... at gmail.com> wrote: > >>>>> 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.lightho... > > >>>>>>>> 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-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-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-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
Rob Slifka
2011-Jan-09 22:24 UTC
[rspec-users] Trouble making rspec-rails 2 work with webrat.
> > I was able to get things to work by moving "include Rack::Test::Methods" > into the configure block: > > RSpec.configure do |config| > config.include Rack::Test::Methods > ... > end > > You should _not_, however, have to do any such thing, so I''ll look into > it and if I can address this in rspec-rails I will and have a bug-fix > release out soon.For others reading this, this was fixed. I was on rspec 2.1.0 and all I had to do was to upgrade to the latest (2.4.0) and no changes from the vanilla rspec install spec_helper are required to run Webrat. Hope to save everyone the 40 minutes I spent not realizing a simple upgrade fixed it :) Rob -- Posted via http://www.ruby-forum.com/.