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.
I’ve tried changing the .env of the existing request,
but this doesn’t work.
When “I GET /organisations/”, “1” do |organisation_id|
request.env[‘HTTP_OUR_API_KEY’] = “craziness”
request.env[‘HTTPS’] = ‘on’
get “api/v1/organisations/#{organisation_id}”
end
and I’ve tried passing the extra headers as a 3 argument to “get”
When “I GET /organisations/”, “1” do |organisation_id|
get “api/v1/organisations/#{organisation_id}”, {}, {‘HTTPS’ => ‘on’,
‘HTTP_ASPIRE_API_KEY’ => ‘something’}
end
but neither of these work.
Anyone got any insight into this?
My version of rspec-rails is as follows;
module Spec
module Rails
module VERSION #:nodoc:
BUILD_TIME_UTC = 20080528130840
end
end
end
Thanks,
MatthewRudy
On Jun 24, 2008, at 10:22 AM, Matthew R. 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 F.ctionalTest, 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
David C. wrote:
On Jun 24, 2008, at 10:22 AM, Matthew R. 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 F.ctionalTest, 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
Oh really.
Cheers David…
so the “3rd argument” solution should be working.
Will have to take a closer look…
Thanks again
David C. wrote:
On Jun 24, 2008, at 10:22 AM, Matthew R. 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 F.ctionalTest, 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