I want to create a custom variable similar to response
object that should only be available in controller specs
. I noticed that rspec supports filters which are before/after hooks which means I can create instance variables with them to be used later. But response
object feels and works more like a let
variable that is lazily evaluated. Also, controller specs support assign
method that can accept arguments.
Does rspec support any way to create similar methods to be used with a specific type of spec?
Note: I don't need to support anything below rspec 3.0.