Sha256: 4d5318fdbd3bf80405747eca975da51c6370bdf65bb0ed50025c257cfe963d79

Contents?: true

Size: 825 Bytes

Versions: 8

Compression:

Stored size: 825 Bytes

Contents

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

  let!(:taxonomy) { create :taxonomy }

  describe '#index' do
    it 'will list taxonomies' do
      get :index
      taxonomy_ids = parse_json(response.body)['data'].map do |taxonomy|
        taxonomy['id']
      end
      expect(taxonomy_ids).to include taxonomy.id.to_s
    end
  end

  describe '#show' do
    let(:taxon) { taxonomy.root }

    it 'will show taxonomy' do
      get :show, id: taxonomy.id
      taxonomy_id = parse_json(response.body)['data']['id']
      expect(taxonomy_id).to eql taxonomy.id.to_s
    end

    it 'can show taxonomy by taxon_id' do
      get :show, taxon_id: taxon.id
      taxonomy_id = parse_json(response.body)['data']['id']
      expect(taxonomy_id).to eql taxonomy.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/taxonomies_controller_spec.rb
solidus_json_api-0.3.0 spec/controllers/spree/api/v2/taxonomies_controller_spec.rb
spree_api_v2-0.2.2 spec/controllers/spree/api/v2/taxonomies_controller_spec.rb
solidus_api_v2-0.2.2 spec/controllers/spree/api/v2/taxonomies_controller_spec.rb
solidus_api_v2-0.2.1 spec/controllers/spree/api/v2/taxonomies_controller_spec.rb
spree_api_v2-0.2.1 spec/controllers/spree/api/v2/taxonomies_controller_spec.rb
spree_api_v2-0.2.0 spec/controllers/spree/api/v2/taxonomies_controller_spec.rb
solidus_api_v2-0.2.0 spec/controllers/spree/api/v2/taxonomies_controller_spec.rb