Sha256: ea2ca92360d2ac860fe9f9b80863c6cc18a1919c500b970aaeafdbc906f625a7

Contents?: true

Size: 855 Bytes

Versions: 47

Compression:

Stored size: 855 Bytes

Contents

# frozen_string_literal: true

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

47 entries across 47 versions & 2 rubygems

Version Path
solidus_backend-2.10.5 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.10.3 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.10.2 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.9.6 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.8.6 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.10.1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.9.5 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.10.0 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.9.4 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.6.6 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.7.4 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.8.5 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.9.3 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.9.2 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.10.0.beta1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.7.3 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.6.5 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.9.1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.9.0 spec/controllers/spree/admin/promotion_actions_controller_spec.rb
solidus_backend-2.9.0.rc.1 spec/controllers/spree/admin/promotion_actions_controller_spec.rb