Passing authentication in header from rspec tests

307 views
Skip to first unread message

Donald French

unread,
May 5, 2014, 10:31:37 PM5/5/14
to ruby-...@googlegroups.com
I am attempting to put my authentication information in the header from my rspec tests.  I would like to set it in a before each so I do not have to do it on each call. I am getting an odd error to me.

     Failure/Error: request.env['HTTP_AUTHORIZATION'] =   partner.api_key
     ArgumentError:
       wrong number of arguments (0 for 1..2)

the code that gives it is:
      request.env['HTTP_AUTHORIZATION'] =   partner.api_key
      get "/v1/accounts/#{account.uuid}"

I have attempted to put other information in the header and get the same error. I know I am doing something wrong, however I have not found anything pointing me in the right direction.

Any help would be great.

Don

Donald French

unread,
May 6, 2014, 12:16:22 AM5/6/14
to ruby-...@googlegroups.com
Found the answer finally after searching for hours.  
I can now place this in a helper to make passing the information in the header:

head 'HTTP_AUTHORIZATION', partner.api_key

and it works like a charm. I can put any key/value in that way.
Reply all
Reply to author
Forward
0 new messages