Skip to content

Instantly share code, notes, and snippets.

@sbwoodside
Created October 2, 2015 03:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbwoodside/19d3e033076de2bd1194 to your computer and use it in GitHub Desktop.
Save sbwoodside/19d3e033076de2bd1194 to your computer and use it in GitHub Desktop.
require 'acceptance_helper'
resource "Measurements" do
fixtures :users
let(:client) { RspecApiDocumentation::RackTestClient.new(self, :headers => { "HTTP_ACCEPT" => "application/json" }) }
post "/users/sign_in" do
let(:email) { "cam@cam.cam" }
let(:password) { "cam@cam.cam" }
example "Authenticate with login and password" do
do_request
status.should == 200
$session_cookie = response_headers['Set-Cookie']
end
end
get "/measurements" do
let(:client) { RspecApiDocumentation::RackTestClient.new(self, :headers => { "HTTP_ACCEPT" => "application/json", 'Cookie' => $session_cookie }) }
puts '$session_cookie: ' + $session_cookie.to_s # This is coming out nil because this spec is running first
example "Listing measurements" do
do_request
status.should == 200
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment