[rspec-users] Need some help with a simple

chris anderson lists at ruby-forum.com
Mon Apr 7 17:54:48 EDT 2008

Glenn Ford wrote:
> I'm guessing the key is inside "find_account_by_subdomain_or_url".  Do
> you have that defined somewhere?  It probably calls something like:
> @account = Account.find_by_subdomain(blah) or Account.find_by_url(blah)
> In which case that's probably what you need to stub.  Nothing is
> actually checking for the return value of the controller method or
> assigning it to @account.  In other words, you probably should do
> Account.stub! instead of controller.stub!  Check what's in that method
> and see if that gets you closer to the solution.
> Good luck!
> Glenn

That worked.

I was under the impression that there would be no subdomain available 
when testing, which is why I was stubbing the controller method.  After 
it working I actually checked what the request.domain was and saw that 
it is test.host :)

Thanks Glenn
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list