Sha256: 26beaef22ad4fd5c9c1083f0964d396111ef9a1f02eb1a3ad85e73e47ae04200

Contents?: true

Size: 599 Bytes

Versions: 10

Compression:

Stored size: 599 Bytes

Contents

require 'spec_helper'

module Spree
  describe Spree::PromotionRule, :type => :model do

    class BadTestRule < Spree::PromotionRule; end

    class TestRule < Spree::PromotionRule
      def eligible?
        true
      end
    end

    it "should force developer to implement eligible? method" do
      expect { BadTestRule.new.eligible? }.to raise_error(ArgumentError)
    end

    it "validates unique rules for a promotion" do
      p1 = TestRule.new
      p1.promotion_id = 1
      p1.save

      p2 = TestRule.new
      p2.promotion_id = 1
      expect(p2).not_to be_valid
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spree_core-3.1.5 spec/models/spree/promotion_rule_spec.rb
spree_core-3.1.4 spec/models/spree/promotion_rule_spec.rb
spree_core-3.1.3 spec/models/spree/promotion_rule_spec.rb
spree_core-3.1.2 spec/models/spree/promotion_rule_spec.rb
spree_core-3.1.1 spec/models/spree/promotion_rule_spec.rb
spree_core-3.1.0 spec/models/spree/promotion_rule_spec.rb
spree_core-3.1.0.rc4 spec/models/spree/promotion_rule_spec.rb
spree_core-3.1.0.rc3 spec/models/spree/promotion_rule_spec.rb
spree_core-3.1.0.rc2 spec/models/spree/promotion_rule_spec.rb
spree_core-3.1.0.rc1 spec/models/spree/promotion_rule_spec.rb