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

@page.login(USERS[:invalid])

screenshot_embed

end

In the user.rb under env folder its as

USERS = {

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

}

The above works perfectly fine.

Now I need few more like valid, validwithusernameonly,
validwithpasswordonly.

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
|user_credential_identifier|

@page.login(USERS[:invalid])

screenshot_embed

end

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