Sha256: d29b39d833a8ed62f147c5fdba3e884eade78b0c46d07f3d30cc2e5551f64f7c

Contents?: true

Size: 900 Bytes

Versions: 22

Compression:

Stored size: 900 Bytes

Contents

require 'active_support/all'
module ControllerHacks
  def api_get(action, params={}, session=nil, flash=nil)
    api_process(action, params, session, flash, "GET")
  end

  def api_post(action, params={}, session=nil, flash=nil)
    api_process(action, params, session, flash, "POST")
  end

  def api_put(action, params={}, session=nil, flash=nil)
    api_process(action, params, session, flash, "PUT")
  end

  def api_delete(action, params={}, session=nil, flash=nil)
    api_process(action, params, session, flash, "DELETE")
  end

  def api_process(action, params={}, session=nil, flash=nil, method="get")
    scoping = respond_to?(:resource_scoping) ? resource_scoping : {}
    process(action, method, params.merge(scoping).reverse_merge!(:use_route => :spree, :format => :json), session, flash)
  end
end

RSpec.configure do |config|
  config.include ControllerHacks, :type => :controller
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
spree_api-2.1.12 spec/support/controller_hacks.rb
spree_api-2.1.11 spec/support/controller_hacks.rb
spree_api-2.1.10 spec/support/controller_hacks.rb
spree_api-2.1.9 spec/support/controller_hacks.rb
spree_api-2.3.2 spec/support/controller_hacks.rb
spree_api-2.2.5 spec/support/controller_hacks.rb
spree_api-2.1.8 spec/support/controller_hacks.rb
spree_api-2.3.1 spec/support/controller_hacks.rb
spree_api-2.2.4 spec/support/controller_hacks.rb
spree_api-2.2.3 spec/support/controller_hacks.rb
spree_api-2.3.0 spec/support/controller_hacks.rb
spree_api-2.2.2 spec/support/controller_hacks.rb
spree_api-2.1.7 spec/support/controller_hacks.rb
spree_api-2.1.6 spec/support/controller_hacks.rb
spree_api-2.2.1 spec/support/controller_hacks.rb
spree_api-2.2.0 spec/support/controller_hacks.rb
spree_api-2.1.5 spec/support/controller_hacks.rb
spree_api-2.1.4 spec/support/controller_hacks.rb
spree_api-2.1.3 spec/support/controller_hacks.rb
spree_api-2.1.2 spec/support/controller_hacks.rb