Cucumbers and clearances: current_user in steps

What I have to do is use (rely on) the method current_userin determining the steps of the cucumber. I use Clearance in my project.

First of all, I tried to use it sign_in, but it did not work (I think Cucumber World does not know about design methods ...).

So, how do I get Cuckes to recognize methods current_userand sign_in/ sign_out?

+5
source share
2 answers

Cucumber functions should launch your application through the public user interface. Sort of:

Given /^I am signed in as "([^\"]*)"%/ do |username|
  visit 'sign_in'
  fill_in 'Username', :with => username
  click 'Sign In'
end

current_user , .

, @current_user , .

+6

, ( ) . , , Clearance , .

user = create(:user)
visit posts_path(as: user)

, , ui , , .

+1

All Articles