Re: [rspec-users] mimicking a logged in user

2012-03-03 Thread S Ahmed
thanks. but I have to stub the call that hits the database also. how can I wrap this up in a function so I can use it everywhere in my tests where I require a logged in user? where should I put this? in spec_helper? On Sat, Mar 3, 2012 at 5:21 PM, Justin Ko wrote: > > On Mar 3, 2012, at 12:35

Re: [rspec-users] mimicking a logged in user

2012-03-03 Thread Justin Ko
On Mar 3, 2012, at 12:35 PM, S Ahmed wrote: > I'm testing my controller, and confirming that a logged-in user can view the > page. > > I have a session_helper that does this: > > def signed_in? > !current_user.nil? > end > > And the current_user is set with: > > def user_from_remember_to

Re: [rspec-users] what RSpec approach could I use for this.

2012-03-03 Thread Justin Ko
On Mar 3, 2012, at 2:55 PM, Greg C. wrote: > Background: So I have roughly: > > class A > def calculate_input_datetimes > # do stuff to calculate datetimes - then for each one identified > process_datetimes(my_datetime_start, my_datetime_end) > end > > def process_datetimes(inp

[rspec-users] what RSpec approach could I use for this.

2012-03-03 Thread Greg C.
Background: So I have roughly: class A def calculate_input_datetimes # do stuff to calculate datetimes - then for each one identified process_datetimes(my_datetime_start, my_datetime_end) end def process_datetimes(input_datetime_start, input_datetime_end) # do stuff

[rspec-users] mimicking a logged in user

2012-03-03 Thread S Ahmed
I'm testing my controller, and confirming that a logged-in user can view the page. I have a session_helper that does this: def signed_in? !current_user.nil? end And the current_user is set with: def user_from_remember_token remember_token = cookies[:remember_token] User.find_by_reme