File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
promotions/spec/models/solidus_promotions Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,14 @@ def self.model_name
1414 def eligible? ( _promotable , _options = { } )
1515 true
1616 end
17+
18+ def applicable? ( _promotable )
19+ true
20+ end
21+
22+ def level
23+ :line_item
24+ end
1725 end
1826 end
1927
@@ -37,6 +45,16 @@ def eligible?(_promotable, _options = {})
3745 expect { test_condition_class . new . eligible? ( "promotable" ) } . not_to raise_error
3846 end
3947
48+ it "forces developer to implement #applicable?" do
49+ expect { bad_test_condition_class . new . applicable? ( "promotable" ) } . to raise_error NotImplementedError
50+ expect { test_condition_class . new . applicable? ( "promotable" ) } . not_to raise_error
51+ end
52+
53+ it "forces developer to implement #level" , :silence_deprecations do
54+ expect { bad_test_condition_class . new . level } . to raise_error NotImplementedError
55+ expect { test_condition_class . new . level } . not_to raise_error
56+ end
57+
4058 it "validates unique conditions for a promotion benefit" do
4159 # Because of Rails' STI, we can't use the anonymous class here
4260 promotion = create ( :solidus_promotion , :with_adjustable_benefit )
You can’t perform that action at this time.
0 commit comments