Sha256: d07a8a3cb79af13a3cbd6eca941da38a12313c432fa53c9309ee132bf52965b1

Contents?: true

Size: 806 Bytes

Versions: 19

Compression:

Stored size: 806 Bytes

Contents

module Spree
  module Api
    module TestingSupport
      module Setup
        def sign_in_as_admin!
          let!(:current_api_user) do
            user = stub_model(Spree::LegacyUser)
            user.should_receive(:has_spree_role?).any_number_of_times.with("admin").and_return(true)
            user
          end
        end

        # Default kaminari's pagination to a certain range
        # Means that you don't need to create 25 objects to test pagination
        def default_per_page(count)
          before do
            @current_default_per_page = Kaminari.config.default_per_page
            Kaminari.config.default_per_page = 1
          end

          after do
            Kaminari.config.default_per_page = @current_default_per_page
          end
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
spree_api-2.0.3 lib/spree/api/testing_support/setup.rb
spree_api-1.3.3 lib/spree/api/testing_support/setup.rb
spree_api-1.2.5 lib/spree/api/testing_support/setup.rb
spree_api-2.0.2 lib/spree/api/testing_support/setup.rb
spree_api-2.0.1 lib/spree/api/testing_support/setup.rb
spree_api-2.0.0 lib/spree/api/testing_support/setup.rb
spree_api-2.0.0.rc1 lib/spree/api/testing_support/setup.rb
spree_api-1.2.4 lib/spree/api/testing_support/setup.rb
spree_api-1.3.2 lib/spree/api/testing_support/setup.rb
spree_api-1.2.3 lib/spree/api/testing_support/setup.rb
spree_api-1.3.1 lib/spree/api/testing_support/setup.rb
spree_api-1.3.0 lib/spree/api/testing_support/setup.rb
spree_api-1.3.0.rc2 lib/spree/api/testing_support/setup.rb
dup_spree_api-1.3.0.rc1 lib/spree/api/testing_support/setup.rb
spree_api-1.3.0.rc1 lib/spree/api/testing_support/setup.rb
spree_api-1.2.2 lib/spree/api/testing_support/setup.rb
spree_api-1.2.0 lib/spree/api/testing_support/setup.rb
spree_api-1.2.0.rc2 lib/spree/api/testing_support/setup.rb
spree_api-1.2.0.rc1 lib/spree/api/testing_support/setup.rb