Sha256: 0d8d9e939be1e9e5780a319ea38c260136e816ab4b1629e3922aa0147f953179

Contents?: true

Size: 819 Bytes

Versions: 12

Compression:

Stored size: 819 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
    spree_post :create, 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
    spree_post :create, 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

12 entries across 12 versions & 2 rubygems

Version Path
solidus_backend-1.3.2 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
spree_backend-3.3.0.rc1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
spree_backend-3.2.1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
spree_backend-3.2.0 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
spree_backend-3.2.0.rc3 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
spree_backend-3.2.0.rc2 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
spree_backend-3.2.0.rc1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-1.3.1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-1.3.0 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-1.3.0.rc2 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-1.3.0.rc1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb
solidus_backend-1.3.0.beta1 spec/controllers/spree/admin/promotion_rules_controller_spec.rb