Sha256: b8ae67281fe06afa03070f4c2424095d5414ccc6e7b0e1d39871696ee2435a8d

Contents?: true

Size: 687 Bytes

Versions: 8

Compression:

Stored size: 687 Bytes

Contents

describe Spree::Api::V2::CountriesController do
  routes { Spree::Core::Engine.routes }

  let!(:country) { create :country }
  let(:state) { create :state, country: country }

  describe '#index' do
    it 'will list all countries' do
      get :index
      expect(JSON.parse(response.body)['data'].length).to eql 1
    end
  end

  describe '#show' do
    it 'will list the selected country' do
      get :show, id: country.id
      expect(JSON.parse(response.body)['data']['id']).to eql country.id.to_s
    end

    it 'will the country via a state' do
      get :show, state_id: state.id
      expect(JSON.parse(response.body)['data']['id']).to eql country.id.to_s
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
solidus_json_api-0.3.1 spec/controllers/spree/api/v2/countries_controller_spec.rb
solidus_json_api-0.3.0 spec/controllers/spree/api/v2/countries_controller_spec.rb
spree_api_v2-0.2.2 spec/controllers/spree/api/v2/countries_controller_spec.rb
solidus_api_v2-0.2.2 spec/controllers/spree/api/v2/countries_controller_spec.rb
solidus_api_v2-0.2.1 spec/controllers/spree/api/v2/countries_controller_spec.rb
spree_api_v2-0.2.1 spec/controllers/spree/api/v2/countries_controller_spec.rb
spree_api_v2-0.2.0 spec/controllers/spree/api/v2/countries_controller_spec.rb
solidus_api_v2-0.2.0 spec/controllers/spree/api/v2/countries_controller_spec.rb