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'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
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to