Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing authentication #10

Open
jergason opened this issue Jan 23, 2011 · 1 comment
Open

Testing authentication #10

jergason opened this issue Jan 23, 2011 · 1 comment

Comments

@jergason
Copy link

I am struggling with how to test authentication using RSpec 2.0. I can verify that authentication and signup works manually, but in my spec I run in to some problems. I create users in the database, and try to manually assign my create user id to the session variable, like so:

session[:user] = @user.id

I have verified that @user exists and is valid. However, I get the following error:

NameError:
undefined local variable or method `session' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x000001019967c0>

How can I log users in programatically in my tests? I am including my "app.rb" file that includes sinatra-authentication and the rest of my gems, so I don't know why "session" doesn't exist.

@huboard:{"order":10.75}

@ghost ghost assigned cmhobbs Jul 13, 2011
@cmhobbs
Copy link
Collaborator

cmhobbs commented Jul 13, 2011

I'm taking a look at this and I'm going to try to build up a set of specs for sinatra-authentication itself. I'll bump the issue when I'm done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants