How to convert local variable to attr_accessor

Hi All,

I’ve cucumber feature file as

When I login with invalid credentials

The corresponding step defination as

When(/^I login with invalid credentials$/) do




In the user.rb under env folder its as


:valid => {
    :username => "peterpan",
    :password => "xyz"
:invalid => {
    :username => "invalidusername",
    :password => "testtest"


The above works perfectly fine.

Now I need few more like valid, validwithusernameonly,

When I login with invalid credentials
When I login with valid credentials
When I login with validwithusernameonly credentials

Assume that these credentials are in user.rb

What I need to do in the step_defination to pass the
user_credential_identifier to USERS.

When(/^I login with ‘(.+)’ credentials$/) do




Got the answer. Silly mistake from my side. only to use .to_sym

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs