[rspec-users] Problem with testing Rails action that uses return keyword
dchelimsky at gmail.com
Wed May 27 04:23:55 EDT 2009
On Tue, May 19, 2009 at 5:13 PM, szimek <szimek at gmail.com> wrote:
> I'm trying to test Rails action that looks like this:
> def create
> unless facebook_session
> authentication_failed and return
> @facebook_user = facebook_session.user
> authentication_failed method redirects to '/'.
> The test looks like this:
> it 'should call authentication_failed' do
> get :create
If you're using facebooker, you should use facebook_get instead of get:
Also - shouldn't this be a post?
> The problem is that in the test, despite the fact that
> facebook_session is nil and the authentication_failed method is
> called, the action does not return and I got error in
> facebook_session.user line, because facebook_session is nil.
> If I move the return keyword to the next line, the test complains then
> about missing create.erb template.
> Any ideas how to solve it?
More information about the rspec-users