ruby on rails - Accessing controller in Cucumber to test sign-in -


first off - know horrible practice, because cucumber meant test outputs. want 1 veryveryvery specific case.

i have app handles user authentication using cookie set app maintain. i'd write simple integration test authentication:

given have logged "some_user" on sso server when visit page should logged in "some_user" 

my current step definition follows:

then /^i should logged in "([^"]*)"$/ |username|   user = user.find_by_username(username)   assert_equal @controller.current_user, user end 

obviously, failing "undefined method 'current_user' nil:nilclass".

in case it's not obvious - applicationcontroller#current_user returns either user logged in or nil.

you can visit page logged on user's name displayed.
like:
when go account page
then should see "welcome user" within "div#login"


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -