Sha256: 976d9f73acf6e62ea718d68f0069ab7facba345b2730d2828356650e20be5101

Contents?: true

Size: 831 Bytes

Versions: 32

Compression:

Stored size: 831 Bytes

Contents

require 'spec_helper'

describe Spree::Admin::PromotionRulesController, type: :controller do
  stub_authorization!

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

  it "can create a promotion rule of a valid type" do
    post :create, params: { promotion_id: promotion.id, promotion_rule: { type: "Spree::Promotion::Rules::Product" } }
    expect(response).to be_redirect
    expect(response).to redirect_to spree.edit_admin_promotion_path(promotion)
    expect(promotion.rules.count).to eq(1)
  end

  it "can not create a promotion rule of an invalid type" do
    post :create, params: { promotion_id: promotion.id, promotion_rule: { 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.5.2 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.5.1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.5.0 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.5.0.rc1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.5.0.beta2 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.5.0.beta1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.4.2 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.4.1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.3.1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.2.2 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.1.1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.0.3 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.4.0 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.4.0.rc1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.4.0.beta1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.3.0 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.3.0.rc3 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.3.0.rc2 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.3.0.rc1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-2.3.0.beta1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb