Sha256: 920f17c238cd040696791e08dec205d7ab23a59b0c59340786902122c5fd47f5

Contents?: true

Size: 824 Bytes

Versions: 32

Compression:

Stored size: 824 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
    post :create, params: { 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
    post :create, params: { 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 & 1 rubygems

Version Path
solidus_backend-2.0.2 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.2.1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.2.0 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.2.0.rc1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.2.0.beta1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.1.0 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.1.0.rc1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.0.1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.1.0.beta1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.0.0 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.0.0.rc1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.0.0.beta1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb