Re: [rspec-users] Controller spec gives strange error

2008-07-03 Thread Damian Terentiev
Bryan Ray wrote: > I believe the problem is that you're not telling the Language model > what to stub/mock when it calls the find method inside of > set_site_language. > > I'm not entirely sure, but I would imagine that the TestUnit test is > passing, because it's using the full Rails stack to run

Re: [rspec-users] Controller spec gives strange error

2008-07-03 Thread Bryan Ray
I believe the problem is that you're not telling the Language model what to stub/mock when it calls the find method inside of set_site_language. I'm not entirely sure, but I would imagine that the TestUnit test is passing, because it's using the full Rails stack to run the test. Try doing

Re: [rspec-users] Controller spec gives strange error

2008-07-03 Thread Damian Terentiev
David Chelimsky wrote: > On Jul 3, 2008, at 2:24 AM, Damian Terentiev wrote: > >> def set_site_language >>@site_language = cookie['lang'] ? >> Language.find_by_code(cookie['lang']) : >> Language.find(:first) > > Shouldn't this be cookies, not cookie? Doesn't explain why the test >

Re: [rspec-users] Controller spec gives strange error

2008-07-03 Thread David Chelimsky
On Jul 3, 2008, at 2:24 AM, Damian Terentiev wrote: Good day! I have a Rails app with a controller that sets an instance variable in a before_filter, like this: class PostsController < ApplicationController before_filter :set_site_language def set_site_language @site_language = cooki

[rspec-users] Controller spec gives strange error

2008-07-03 Thread Damian Terentiev
Good day! I have a Rails app with a controller that sets an instance variable in a before_filter, like this: class PostsController < ApplicationController before_filter :set_site_language def set_site_language @site_language = cookie['lang'] ? Language.find_by_code(cookie['lang'])