Sha256: 36f3ef354a0e3a25a26b5ab13afa267c6e46e15584e1fe6a091227da764a5a6b

Contents?: true

Size: 840 Bytes

Versions: 10

Compression:

Stored size: 840 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

10 entries across 10 versions & 1 rubygems

Version Path
spree_api-3.1.5 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.1.4 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.1.3 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.1.2 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.1.1 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.1.0 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.1.0.rc4 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.1.0.rc3 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.1.0.rc2 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
spree_api-3.1.0.rc1 spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb