Reputation:
I've been working on getting my tests to pass from Ch. 9.2 (User Edit test) and I traced back to some problem in the log_in_as method created in ch 8 in the test_helper.
I pored over my code and compared it with the sample and everything looked okay. I finally resorted to copying the code out of the book. This got the tests to pass...but I can see no differences between the code i originally wrote and the copied. So, my question is, what the hell is the difference between my code and his? This only thing I can fathom is whitespace. This has been a real stumper. Any insights would be most appreciated.
Mine:
30 def log_in_as(user, options = {})
31 password = options[:password] || 'password'
32 remember_me = options[:remember_me] || '1'
33 if integration_test?
34 post login_path, session: { email: user.email,
35 passsword: password,
36 remember_me: remember_me }
37 else
38 session[:user_id] = user.id
39 end
40 end
His:
def log_in_as(user, options = {})
password = options[:password] || 'password'
remember_me = options[:remember_me] || '1'
if integration_test?
post login_path, session: { email: user.email,
password: password,
remember_me: remember_me }
else
session[:user_id] = user.id
end
end
Upvotes: 0
Views: 121
Reputation: 146
Your code has 3*s in password on line 35:
post login_path, session: { email: user.email,
pass-s-word: password,
remember_me: remember_me }
should be
post login_path, session: { email: user.email,
password: password,
remember_me: remember_me }
Upvotes: 2