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

  • Home
  • SEARCH
  • 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 3431382
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:19:09+00:00 2026-05-18T07:19:09+00:00

I have the following table in an application I am developing using ruby on

  • 0

I have the following table in an application I am developing using ruby on rails:
alt text

I want to create a test in cucumber where I select a user from the table and delete it or edit it.

I don’t know what is the step definition for that.

I’d like to be able to do something like:

Feature: User Manegement
         In order to manage users
         As an admin 
         I want to see a users list and change user properties

Background:
Given the following activated users exists
  | name         | email                    | 
  | Alice Hunter | alice.hunter@example.com |
  | Bob Hunter   | bob.hunter@example.com   |
And the following user records
  | name     | email                    | 
  | Jonh Doe | jonh.doe@example.com     |

    Scenario: I delete a user from the table
      Given I am logged in as admin
      When I follow "Administration"
      And I follow "User Management"
      And I delete "Alice Hunter"
      Then I should not see "Alice Hunter"`

Can anyone help?
Thank you.

@brad

The error returned:

  wrong number of arguments (2 for 1) (ArgumentError)
  ./features/step_definitions/table_steps.rb:26:in `within'
  ./features/step_definitions/table_steps.rb:26:in `/^I delete "(.*)"$/'


  • 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-18T07:19:10+00:00Added an answer on May 18, 2026 at 7:19 am

    After some extensive searching and minor refactoring, I managed to solve the problem.

    I have used the following step:

    When /^as admin I (press|follow|check|uncheck|choose) "([^\"]*)" for (.*) whose (.*) is "([^\"]*)"$/ do |action, whatyouclick, class_name, var_name, value|
      unless var_name == "id" then
        id = eval("\"#{class_name}\".classify.constantize.find_by_#{var_name}(\"#{value}\").id.to_s")
      else
        id = value
      end
      within("tr[id=as_admin__#{class_name}-list-#{id}-row]") do
        case action
          when "press"
            click_button(whatyouclick)
          when "follow"
            click_link(whatyouclick)
          when "check"
            check(whatyouclick)
          when "uncheck"
            uncheck(whatyouclick)
          when "choose"
            uncheck(whatyouclick)
        end
      end
    end
    

    I am also insterested in webrat’s RDoc, but everything I find seems out of order.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following table schema; CREATE TABLE `db1`.`sms_queue` ( `Id` INTEGER UNSIGNED NOT
I have the following table structure CREATE TABLE `table` ( `id` int(11) NOT NULL
I have the following table and data in SQL Server 2005: create table LogEntries
I have following table structure: Table: Plant PlantID: Primary Key PlantName: String Table: Party
I have the following table relationship in my database: Parent / \ Child1 Child2
I have the following table in MySQL (version 5): id int(10) UNSIGNED No auto_increment
I have the following table custid ordid qty datesold 1 A2 12 2008-01-05 2
I have the following table: 'committee' table commname profname ======================== commA bill commA jack
I have the following table in MSSQL2005 id | business_key | result 1 |
I have the following table containing the winning numbers of 6/49 lottery. +-----+------------+----+----+----+----+----+----+-------+ |

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.