Sha256: 3a07407ffef8495b392c5304bba56d973aa9483ab85949882723826819f31cb6
Contents?: true
Size: 988 Bytes
Versions: 1
Compression:
Stored size: 988 Bytes
Contents
require 'spec_helper' describe 'API', type: :request do include DevicesAPISupport describe 'GET /api/v1/products' do before :each do @user = create(:user, email: 'test@ingemark.com', password: 'password') @user.generate_spree_api_key! @device = create(:device) create(:user_device, user: @user, device: @device) end context 'when valid device name and uid headers are provided' do it 'lists protected resource' do headers = request_headers_with_device(@user, @device) get '/api/v1/products', params: {}, headers: headers expect(status).to eq 200 end end context 'when invalid device name and uid headers are provided' do it 'does not list protected resource' do unused_device = create(:device) headers = request_headers_with_device(@user, unused_device) get '/api/v1/products', params: {}, headers: headers expect(status).to eq 401 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_devices-1.2.0 | spec/api/v1/products_spec.rb |