#359 new

Raisl 3 cucumber integration problem - certain web steps

Reported by kmandrup | February 22nd, 2010 @ 05:43 PM

We almost have a cucumber-rails for Rails 3 working:


Scenario: Register new person # features/manage_people.feature:6

Given I am on the new person page # features/step_definitions/web_steps.rb:13
When I fill in "Name" with "name 1" # features/step_definitions/web_steps.rb:33
And I press "Create" # features/step_definitions/web_steps.rb:21
Then I should see "name 1" # features/step_definitions/web_steps.rb:141
expected the following element's content to include "name 1": You are being redirected. is not true. (Test::Unit::AssertionFailedError) ./features/step_definitions/web_steps.rb:146:in /^(?:|I )should see "([^\"]*)"$/' features/manage_people.feature:10:inThen I should see "name 1"'


Then /^(?:|I )should see \/([^\/])\/ within "([^"])"$/ do |regexp, selector|
within(selector) do |content|

regexp = Regexp.new(regexp)
if defined?(Spec::Rails::Matchers)
  content.should contain(regexp)
  assert_match(regexp, content)

end end

Is Spec::Rails::Matchers called something different in Rails 3? or how do we include it?
The assert doesn't seem to work either... ?

If we run the app manually in a browser, it works as expected and "name 1" is displayed after creating a new person by pressing the submit button.

Thanks for any assistance!

Comments and changes to this ticket

  • kmandrup

    kmandrup February 22nd, 2010 @ 06:11 PM

    .feature fix

    Then I should see "name 1" on the index page


    when /the index page/


    Then /^(?:|I )should see "([^"]*)" on (.+)$/ do |text, page_name|
    visit path_to(page_name) if defined?(Spec::Rails::Matchers)

    response.should contain(text)


    assert_contain text

    end end

    I think there should be a new web_steps.rb file for Rails 3

  • Louis Rose

    Louis Rose February 24th, 2010 @ 10:26 AM

    I'm not sure if this is the cause of the problem, but in the current version of Rspec 2.0, it seems that Spec modules have been renamed to Rspec.

    Does the following change fix the problem?

    if defined?(Spec::Rails::Matchers)


    if defined?(Rspec::Rails::Matchers)
  • xinuc

    xinuc August 31st, 2010 @ 04:25 AM

    • Milestone order changed from “0” to “0”

    for me, the problem is webrat not following redirect, and just return "You are being redirected"

    I use webrat 0.7.2.beta.1

  • lminaudier

    lminaudier October 18th, 2010 @ 10:56 AM

    Hi guys,

    Was in that case too with webrat 0.7.2.beta.2
    Webrat doesn't follow controller's redirect_to calls and just return "You are being redirected"

    Google finally points me to Stack Overflow

    The solution of 'justsee' to patch 'lib/webrat/core/session.rb' works well for me.

    #starting at line 288
    def current_host
    - URI.parse(current_url).host || @custom_headers["Host"] || "www.example.com"
    + URI.parse(current_url).host || @custom_headers["Host"] || default_current_host
    + def default_current_host
    +   adapter.class==Webrat::RackAdapter ? "example.org" : "www.example.com"
    + end
  • mostpha mostpha
  • JamesCosta

    JamesCosta December 16th, 2020 @ 01:49 AM

    Tickets and all plan is fit for the references for the shows. Plant of the fish and assignment help assigned for the mutual way. Port is fit for the authentic items for the surfaces for the worldwide items for humans.

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