Hi,

I'm testing for action caching via RSpec. Currently the method that is
cached is in a controller. I'm able to call this method using
`subject.send(:method_name)` Thanks to this
http://stackoverflow.com/questions/5200326/rspec-testing-calling-controller-method-received-nomethoderror.

I want to test a scenario to check if action caching is perfectly
working. My test case goes something like this:-

**Step 1** : Call the action which is cached. This action has an
instance variable which stores queried results of user specific stats
like number of users belonging to each of the areas out of a number of
areas within a city. I need to fetch the initial set of results some how
from the controller to my spec file.( **The question is how do I do that
?**)

**Step 2**: Update an area for a single user. This would change the
overall stats wrt this area(if it already exists) or would add a new
area if its completely unique.

**Step 3**: Recall the cached action, and check If I am still able to
end up with the old results, not the latest changes as of what was done
in step 2; in terms area stats for the users. Now to do this, I need to
use the instance variable result as in Step 1, with an instance variable
result I obtain after recalling the cached action this very Step.

**Step 4**: Finally , comparing both results, they should be same. This
would pass my test case.

The **BIG** Question again, how do I access the local variable(s) of a
controller method in my spec file?

Thanks.

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to