#331 new
Bryan Helmkamp

Merb integration

Reported by Bryan Helmkamp | January 17th, 2010 @ 06:43 PM

Moved from GitHub issue # 16

Created 4 months ago by pk

I've run my features today with Webrat 0.5.1 and latest Cucumber 0.3.98 and found out that it just fails with strange:

      undefined method `visit' for # (NoMethodError)
      (eval):2:in `visit'
      /Volumes/Data/Users/Pavel/Sites/mujy/features/steps/webrat_steps.rb:5:in `/^I go to (.*)$/'
      features/activations.feature:15:in `When I go to /activate'

So I've tried to get Git version of Webrat and did this setup of world by myself support/env.rb:

require 'webrat'
require 'webrat/adapters/merb'
module Merb
  module Cucumber
    class World
      include ::Merb::Test::Matchers
      include ::Merb::Test::ControllerHelper
      include ::Merb::Test::RouteHelper
      include ::Merb::Test::ViewHelper
      include ::Webrat::Methods
    end
  end
end

World do
  Merb::Cucumber::World.new
end

Which fails again with:

undefined method `request' for # (NoMethodError)
      /Volumes/Data/Users/Pavel/Sites/mujy/features/steps/shared_steps.rb:19:in `/^I log in as (\w+)$/'
      features/activations.feature:22:in `Given I log in as Marcus'

I've also noticed that new version of Merb::Test::RequestHelper#request is much much slimmer than the original one in the Merb which results again in massive problems at least in my features.

Comments

pk August 26, 2009

Grr. That undefined methods are always for the MerbAdapter: Webrat::MerbAdapter:0x442c298, github eaten the markup.

pk August 26, 2009

OK I've some solution for this:
http://github.com/pk/webrat/commit/fc177e675214488ea83a7ec4384031a9...

Patch for merb_cucumber:
http://github.com/pk/merb_cucumber/commit/a42e179dfe19bfc369ad8dd52...

pk August 26, 2009

However switching to the Rack::MockResponse is good for standard stuff, it is missing url which was Merb addition. So all steps which has webrat_session.response.url will fail.

pk August 26, 2009

It seems that I like to talk to myself :-) The last issue with the webrat.response.url is easily solved by changing the steps to webrat.current_url. How easy when I read the source.

Just another question how does the webrat and rack/test works together? I tried to include Rack::Test::Methods to the cucumber world which resulted in just exceptions. So... with cucumber/webrat I don't use rack/test directly but with plain RSpec I do?

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket

Pages