Sha256: dd88f81a0241c384c1a4bde990646894ef92f487c73026828cf1a01bc112e5b6

Contents?: true

Size: 912 Bytes

Versions: 17

Compression:

Stored size: 912 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, params.merge(scoping).reverse_merge!(:use_route => :spree, :format => :json), session, { :foo => "bar" }, method)
  end
end

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

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
spree_api-1.2.5 spec/support/controller_hacks.rb
spree_api-1.1.6 spec/support/controller_hacks.rb
spree_api-1.1.5 spec/support/controller_hacks.rb
spree_api-1.2.4 spec/support/controller_hacks.rb
spree_api-1.2.3 spec/support/controller_hacks.rb
spree_api-1.2.2 spec/support/controller_hacks.rb
spree_api-1.1.4 spec/support/controller_hacks.rb
spree_api-1.2.0 spec/support/controller_hacks.rb
spree_api-1.2.0.rc2 spec/support/controller_hacks.rb
spree_api-1.2.0.rc1 spec/support/controller_hacks.rb
spree_api-1.1.3 spec/support/controller_hacks.rb
spree_api-1.1.2 spec/support/controller_hacks.rb
spree_api-1.1.2.rc1 spec/support/controller_hacks.rb
spree_api-1.1.1 spec/support/controller_hacks.rb
spree_api-1.1.0 spec/support/controller_hacks.rb
spree_api-1.1.0.rc2 spec/support/controller_hacks.rb
spree_api-1.1.0.rc1 spec/support/controller_hacks.rb