Sha256: 93cec921c98c0ba4a6313df44e307309681a9b84b1c8e8d3e2953895dcadd9c2

Contents?: true

Size: 827 Bytes

Versions: 32

Compression:

Stored size: 827 Bytes

Contents

require 'spec_helper'

describe Spree::Admin::PromotionActionsController, :type => :controller do
  stub_authorization!

  let!(:promotion) { create(:promotion) }

  it "can create a promotion action of a valid type" do
    spree_post :create, :promotion_id => promotion.id, :action_type => "Spree::Promotion::Actions::CreateAdjustment"
    expect(response).to be_redirect
    expect(response).to redirect_to spree.edit_admin_promotion_path(promotion)
    expect(promotion.actions.count).to eq(1)
  end

  it "can not create a promotion action of an invalid type" do
    spree_post :create, :promotion_id => promotion.id, :action_type => "Spree::InvalidType"
    expect(response).to be_redirect
    expect(response).to redirect_to spree.edit_admin_promotion_path(promotion)
    expect(promotion.rules.count).to eq(0)
  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
solidus_backend-1.2.3 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-1.1.4 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-1.0.7 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.1.5 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.1.4 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.1.3 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.1.2 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.0.10 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.1.1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.1.0 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.1.0.rc4 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.0.9 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.1.0.rc3 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.1.0.rc2 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.1.0.rc1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-1.0.6 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.0.8 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-1.2.2 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
spree_backend-3.0.7 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-1.2.1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb