I’d like to test if my Rails controller sets a valid options (in this case path) for cookie. How could I do it with RSpec?
My code:
#Controller
def action
#(...)
cookies[:name] = { value:cookie_data,
path: cookie_path }
#(...)
end
#spec
it "sets cookie path" do
get 'action'
#I'd like do to something like that
response.cookies['name'].path.should == '/some/path'
end
I’ve found a solution, but it seems to be a kind of hacking. I wonder if there is a cleaner way to do it.