Sha256: 763e1e36664b95cb4861e13d80d50e1bda54b1bc547f4165188cb80e0a6fdbfb

Contents?: true

Size: 823 Bytes

Versions: 9

Compression:

Stored size: 823 Bytes

Contents

require 'shared_examples/protect_product_actions'
require 'spec_helper'

module Spree
  describe Spree::Api::ProductsController do
    render_views

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

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

      it "retreives a list of products" do
        api_get :index
        json_response["products"].first.should have_attributes(attributes)
        json_response["count"].should == 1
        json_response["current_page"].should == 1
        json_response["pages"].should == 1
      end

      it_behaves_like "modifying product actions are restricted"
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
spree_api-1.3.5 spec/controllers/spree/api/unauthenticated_products_controller_spec.rb
spree_api-1.3.4 spec/controllers/spree/api/unauthenticated_products_controller_spec.rb
spree_api-1.3.3 spec/controllers/spree/api/unauthenticated_products_controller_spec.rb
spree_api-1.3.2 spec/controllers/spree/api/unauthenticated_products_controller_spec.rb
spree_api-1.3.1 spec/controllers/spree/api/unauthenticated_products_controller_spec.rb
spree_api-1.3.0 spec/controllers/spree/api/unauthenticated_products_controller_spec.rb
spree_api-1.3.0.rc2 spec/controllers/spree/api/unauthenticated_products_controller_spec.rb
dup_spree_api-1.3.0.rc1 spec/controllers/spree/api/unauthenticated_products_controller_spec.rb
spree_api-1.3.0.rc1 spec/controllers/spree/api/unauthenticated_products_controller_spec.rb