I’m using the Clearance gem to replace an old, home-grown login system. I’ve got most of it working (still can’t get all the specs to pass) but so far mostly so good.
My old system requires both a user (login) name as well as an email address, whereas Clearance only requires the email address. I’ve overridden the Clearance Sessions and Sessions controller classes to add what I need, but there’s one method – sign_up_with – that I need to override in the Clearance helpers’ file:
./spec/support/features/clearance_helpers.rb
by adding a third parameter for the login name. That’s easily done and works just fine.
My question: How can I override that method so that even if I apply a Clearance gem upgrade, my override still works?
So I just added the overrides to spec/spec_helper.rb and that seems to work, e.g., after the config block I put:
module Features
module ClearanceHelpers
def sign_up_with(email, password, login='joe')
....
end
end
end
and that actually seemed to work (I added a default value to the new parameter so that I wouldn’t have to go in and modify the Clearance specs themselves). I’d like to know if there’s a better, more “standard” way to address something like this?