Skip to content

Instantly share code, notes, and snippets.

@gabebw
Created January 8, 2015 16:44
Show Gist options
  • Save gabebw/ae8aa9f00e0ab50116ca to your computer and use it in GitHub Desktop.
Save gabebw/ae8aa9f00e0ab50116ca to your computer and use it in GitHub Desktop.
it "returns a list of available cities" do
create(:city, name: "Boston")
get_index
expect(json_body).to eq({ cities: %w(Boston) })
end
def get_index
get "/api/cities", {}.to_json, default_headers.merge("HTTP_AUTHORIZATION" => token_header_value, "Authorization" => token_header_value)
end
def token_header_value
ActionController::HttpAuthentication::Token.encode_credentials(token)
end
def token
create(:user).token
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment