Skip to content

Instantly share code, notes, and snippets.

@andriy-baran
Last active April 26, 2018 11:50
Show Gist options
  • Save andriy-baran/ec1e28ad50c4da8034b3124b6d41ef15 to your computer and use it in GitHub Desktop.
Save andriy-baran/ec1e28ad50c4da8034b3124b6d41ef15 to your computer and use it in GitHub Desktop.
RSpec.shared_examples 'protected endpoint' do |http_method|
context 'when api user unless they haven\'t provided access token' do
it 'renders not logged in message' do
public_send(http_method, path, valid_params) # No valid headers
expect(response.body).to eq 'Not logged in'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment