On Wed, Feb 20, 2013 at 4:34 PM, Bruce <[email protected]> wrote: > Hi, > > So I'm writing an api controller for my app's api and I'm getting an error > in my spec: Failure/Error: assigns(:some_response).should_not be_empty > NoMethodError: undefined method `assigns'.... I am checking to see that > @some_response got set in a before filter called before the create action of > the api - I know the filter is getting called and @some_response is getting > set in the before_filter in the controller. I don't know why the "assigns" > method is not being found though. My guess is I need to define a path other > than the rspec defaults, but I'm not sure if this is the issue or how to go > about doing it. Any help would be greatly appreciated. > > Here is a link to the setup/code: http://pastie.org/6260383
Two problems: 1. rspec doesn't know about the apis directory. Try api instead (e.g. spec/api/v1/some_spec.rb) 2. even if that works, assigns is really a controller spec concept. I wouldn't recommend it for an api spec, which should (IMO) be more black-boxy. HTH, David > > Thank you in advance, > > -- > You received this message because you are subscribed to the Google Groups > "rspec" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msg/rspec/-/EJZ0JIgDvv4J. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
