Sha256: a2b23b75da6a5a4a2df4baa62a203e5cb80f698b15fb5b3c9e62bd35655621e7

Contents?: true

Size: 837 Bytes

Versions: 6

Compression:

Stored size: 837 Bytes

Contents

require 'shared_examples/protect_product_actions'
require 'spec_helper'

module Spree
  describe Api::V1::ProductsController, type: :controller do
    render_views

    let!(:product) { create(:product) }
    let(:attributes) { [:id, :name, :description, :price, :available_on, :slug, :meta_description, :meta_keywords, :taxon_ids] }

    context "without authentication" do
      before { Spree::Api::Config[:requires_authentication] = false }

      it "retrieves a list of products" do
        api_get :index
        expect(json_response["products"].first).to have_attributes(attributes)
        expect(json_response["count"]).to eq(1)
        expect(json_response["current_page"]).to eq(1)
        expect(json_response["pages"]).to eq(1)
      end

      it_behaves_like "modifying product actions are restricted"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_api-3.3.0.rc1 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.2.1 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.2.0 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.2.0.rc3 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.2.0.rc2 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.2.0.rc1 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb