Sha256: b05b4c49ed8eaa612fa6ae82c40f609a5df5bfb323f75d5db1069e8b4f84f882

Contents?: true

Size: 779 Bytes

Versions: 8

Compression:

Stored size: 779 Bytes

Contents

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

  let(:taxon) { create :taxon }
  let!(:child) { create :taxon, parent: taxon, taxonomy: taxon.taxonomy }

  describe '#index' do
    context 'by taxon' do
      it 'can list all the children' do
        get :index, taxon_id: taxon.id
        taxon_ids = parse_json(response.body)['data'].map do |taxon|
          taxon['id']
        end
        expect(taxon_ids).to include child.id.to_s
      end
    end
  end

  describe '#show' do
    context 'by taxon' do
      it 'will fetch the selected child' do
        get :show, taxon_id: taxon.id, id: child.id
        child_id = parse_json(response.body)['data']['id']
        expect(child_id).to eql child.id.to_s
      end
    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/children_controller_spec.rb
solidus_json_api-0.3.0 spec/controllers/spree/api/v2/children_controller_spec.rb
spree_api_v2-0.2.2 spec/controllers/spree/api/v2/children_controller_spec.rb
solidus_api_v2-0.2.2 spec/controllers/spree/api/v2/children_controller_spec.rb
solidus_api_v2-0.2.1 spec/controllers/spree/api/v2/children_controller_spec.rb
spree_api_v2-0.2.1 spec/controllers/spree/api/v2/children_controller_spec.rb
spree_api_v2-0.2.0 spec/controllers/spree/api/v2/children_controller_spec.rb
solidus_api_v2-0.2.0 spec/controllers/spree/api/v2/children_controller_spec.rb