Skip to content

Commit f33f6c7

Browse files
committed
Coverage: Add specs for Condition#applicable? and Condition#level
`#level` will be deprecated soon, but Codecov still complains.
1 parent 176a520 commit f33f6c7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

promotions/spec/models/solidus_promotions/condition_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)