Created
January 8, 2015 16:44
-
-
Save gabebw/ae8aa9f00e0ab50116ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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