Sha256: 09c20b2848bd32012628550b1648498021f57498cd3153ff56b9ecb1645c32fa

Contents?: true

Size: 949 Bytes

Versions: 3

Compression:

Stored size: 949 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe SolidusGraphqlApi::Types::Query do
  subject { described_class.send(:new, {}, {}) }

  it { expect(described_class.method_defined?(:taxonomies)).to be_truthy }

  describe '#products' do
    let(:query_object) { spy(:query_object) }

    before { allow(SolidusGraphqlApi::Queries::ProductsQuery).to receive(:new).and_return(query_object) }

    after { subject.products }

    it { expect(SolidusGraphqlApi::Queries::ProductsQuery).to receive(:new) }

    it { expect(query_object).to receive(:call) }
  end

  describe '#product_by_slug' do
    let(:query_object) { spy(:query_object) }

    let(:slug) { 'slug' }

    before {
      allow(SolidusGraphqlApi::Queries::ProductBySlugQuery).to receive(:new).with(no_args).and_return(query_object)
    }

    after { subject.product_by_slug(slug: slug) }

    it { expect(query_object).to receive(:call).with(slug: slug) }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_graphql_api-0.3.1 spec/lib/solidus_graphql_api/types/query_spec.rb
solidus_graphql_api-0.3.0 spec/lib/solidus_graphql_api/types/query_spec.rb
solidus_graphql_api-0.2.0 spec/lib/solidus_graphql_api/types/query_spec.rb