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

Matthew Rudy Jacobs lists at ruby-forum.com
Tue Jun 24 11:22:29 EDT 2008


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
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list