[rspec-users] Rspec-Rails setting a header in stories?

Matthew Rudy Jacobs lists at ruby-forum.com
Tue Jun 24 12:34:06 EDT 2008


David Chelimsky wrote:
> On Jun 24, 2008, at 10:22 AM, Matthew Rudy Jacobs wrote:
> 
>> Hi there,
>>
>> For my api controllers I need the following;
>> request.ssl? == true
>> and
>> an api key "request.env['HTTP_OUR_API_KEY']"
>>
>> In my spec/controllers I just stub out the required code
>> but in stories I don't want any stubs.
> 
> Stories wrap Rails IntegrationTest, not Rails FunctionalTest, so what
> you have access to is different. The methods look the same, but they
> actually go through routing and work a little differently.
> 
> Check out: 
> http://api.rubyonrails.org/classes/ActionController/Integration/Session.html
> 
> Cheers,
> David

I think much of my problem was not quite understanding how stories were 
supposed to work,
(notably I was trying to redefine "When I call the api" in two different 
scenarios, but only one of these gets used in both cases)

But I think I've got an agreeable end-product.
http://pastie.org/221205

Thanks once more.
MatthewRudy

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


More information about the rspec-users mailing list