Skip to content

Instantly share code, notes, and snippets.

@stevo
Created May 8, 2018 09:31
Show Gist options
  • Save stevo/fc649b26b114431d664309fdd658862f to your computer and use it in GitHub Desktop.
Save stevo/fc649b26b114431d664309fdd658862f to your computer and use it in GitHub Desktop.
An opinionated guide to readable RSpec (part 2 of 2)
allow(ENV).to receive(:fetch).with('API_KEY') { '123' }
get '/v1/days', { 'Content-Type' => 'application/json', 'X-Api-Key' => api_key }
expect(JSON.parse(response.body)['data']).to include(
{ 'date' => '2018-04-20', 'sunset_at' => '19:47' },
{ 'date' => '2018-04-21', 'sunset_at' => '19:48' },
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment