Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6564565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:58:59+00:00 2026-05-25T13:58:59+00:00

I have defined this step: Then /^the ([^]*) field(?: within (.*))? should be empty$/

  • 0

I have defined this step:

Then /^the "([^"]*)" field(?: within (.*))? should be empty$/ do |field, parent|
  with_scope(parent) do
    field = find_field(field)
    field_value = (field.tag_name == 'textarea') ? field.text : field.value
    if field_value.respond_to? :should
      field_value.to_s.should == ''
    else
      assert_equal('', field_value.to_s)
    end
  end
end

and when I run my scenario it raise the following error:

Then the “City” field within the “Buying a House” form should be empty # Ambiguous match of “the “City” field within the “Buying a House” form should be empty”:

  features/step_definitions/my_steps.rb:1:in `/^the "([^"]*)" field(?: within (.*))? should be empty$/'
  features/step_definitions/web_steps.rb:35:in `/^(.*) within (.*[^:])$/'

The step mentioned is as following:

When /^(.*) within (.*[^:])$/ do |step, parent|
  with_scope(parent) { When step }
end

So, I have a lot questions…

  • How could a possible define my step without matching that? When /^(.*) within (.*[^:])$/ seems absolutely inevitable.

  • However, this step doesn’t cause ambiguity:

features/step_definitions/web_steps.rb:141

Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
  with_scope(parent) do
    field = find_field(field)
    field_value = (field.tag_name == 'textarea') ? field.text : field.value
    if field_value.respond_to? :should
      field_value.should =~ /#{value}/
    else
      assert_match(/#{value}/, field_value)
    end
  end
end
  • Couldn’t I just remove the When /^(.*) within (.*[^:])$/ step? Is it part of “the system”? I mean, it IS into /step_definitions/web_steps.rb, and it comes with rake cucumber:install.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:59:00+00:00Added an answer on May 25, 2026 at 1:59 pm

    If fine to edit web_steps.rb. In fact, the latest version Cucumber suggests deleting it entirely:

    # TL;DR: YOU SHOULD DELETE THIS FILE
    #
    # This file was generated by Cucumber-Rails and is only here to get you a head start
    # These step definitions are thin wrappers around the Capybara/Webrat API that lets you
    # visit pages, interact with widgets and make assertions about page content.
    # If you use these step definitions as basis for your features you will quickly end up
    # with features that are:
    #
    # * Hard to maintain
    # * Verbose to read
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Cucumber, I'm trying to create a step like this: Then I should see
I have a service which has one endpoint , I have defined this endpoint
I have a model defined this way class Lga < ActiveRecord::Base validates_uniqueness_of :code validates_presence_of
I have defined my Enums like this. public enum UserType { RESELLER(Reseller), SERVICE_MANAGER(Manager), HOST(Host);
I have a GridView defined like this: <asp:GridView ID=myGridView ruant=server> <asp:BoundField DataField=myField /> <asp:CommandField
I have a map defined like this std::map<some_key_type, std::string::iterator> mIteratorMap; And a huge string
I have a Popup defined like this: <Popup Name=myPopup StaysOpen=True Placement=Bottom PlacementRectangle=0,20,0,20 PlacementTarget={Binding ElementName=myPopupAnchor}>
I have a function defined like this: public static void ShowAbout(Point location, bool stripSystemAssemblies
i have a code like this i have defined the method goNext but still
I have a web page with swf file defined this way <object width=600 height=400

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.