Skip to content
This repository

attempted_record and Cucumber #171

Open
tomekw opened this Issue · 0 comments

1 participant

Tomek Wałkuski
Tomek Wałkuski

I wanted to validate UserSession to only permit users with status "enabled" to sign in.

In user_session.rb:

validate :check_if_enabled

private
def check_if_enabled
errors.add(:base, 'You are not allowed to sign in') unless attempted_record && attempted_record.enabled?

end

In unit test everything is working fine (UserSession for disabled user is invalid), in Click Driven Development only enabled users can sign in, but when I am trying to run Cucumber scenario use is able to sign in (attempted_record is always nil).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.