Sha256: 61cfcf60cf856b63e2164bf5a67437b040670a2b8c9ae668c083834ff60106ac
Contents?: true
Size: 795 Bytes
Versions: 6
Compression:
Stored size: 795 Bytes
Contents
require 'spec_helper' module Spree describe Spree::PromotionRule, type: :model do class BadTestRule < Spree::PromotionRule; end class TestRule < Spree::PromotionRule def eligible?(_promotable, _options = {}) true end end it "forces developer to implement eligible? method" do expect { BadTestRule.new.eligible?("promotable") }.to raise_error NotImplementedError 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 it "generates its own partial path" do rule = TestRule.new expect(rule.to_partial_path).to eq 'spree/admin/promotions/rules/test_rule' end end end
Version data entries
6 entries across 6 versions & 1 rubygems