File tree Expand file tree Collapse file tree
app/models/concerns/solidus_promotions/benefits
spec/models/solidus_promotions/benefits Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33module SolidusPromotions
44 module Benefits
55 module LineItemBenefit
6+ def self . included ( _base )
7+ Spree . deprecator . warn ( "Including #{ name } is deprecated." )
8+ end
9+
610 def can_discount? ( object )
711 object . is_a? Spree ::LineItem
812 end
Original file line number Diff line number Diff line change 33module SolidusPromotions
44 module Benefits
55 module OrderBenefit
6+ def self . included ( _base )
7+ Spree . deprecator . warn ( "Including #{ name } is deprecated." )
8+ end
9+
610 def can_discount? ( _ )
711 false
812 end
Original file line number Diff line number Diff line change 33module SolidusPromotions
44 module Benefits
55 module ShipmentBenefit
6+ def self . included ( _base )
7+ Spree . deprecator . warn ( "Including #{ name } is deprecated." )
8+ end
9+
610 def can_discount? ( object )
711 object . is_a? ( Spree ::Shipment ) || object . is_a? ( Spree ::ShippingRate )
812 end
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require "rails_helper"
4+
5+ RSpec . describe SolidusPromotions ::Benefits ::LineItemBenefit do
6+ subject ( :benefit_class ) do
7+ Class . new ( SolidusPromotions ::Benefit ) do
8+ include SolidusPromotions ::Benefits ::LineItemBenefit
9+ end
10+ end
11+
12+ it "warns" do
13+ expect ( Spree . deprecator ) . to receive ( :warn ) . with (
14+ "Including SolidusPromotions::Benefits::LineItemBenefit is deprecated."
15+ )
16+ subject
17+ end
18+ end
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require "rails_helper"
4+
5+ RSpec . describe SolidusPromotions ::Benefits ::OrderBenefit do
6+ subject ( :benefit_class ) do
7+ Class . new ( SolidusPromotions ::Benefit ) do
8+ include SolidusPromotions ::Benefits ::OrderBenefit
9+ end
10+ end
11+
12+ it "warns" do
13+ expect ( Spree . deprecator ) . to receive ( :warn ) . with (
14+ "Including SolidusPromotions::Benefits::OrderBenefit is deprecated."
15+ )
16+ subject
17+ end
18+ end
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require "rails_helper"
4+
5+ RSpec . describe SolidusPromotions ::Benefits ::ShipmentBenefit do
6+ subject ( :benefit_class ) do
7+ Class . new ( SolidusPromotions ::Benefit ) do
8+ include SolidusPromotions ::Benefits ::ShipmentBenefit
9+ end
10+ end
11+
12+ it "warns" do
13+ expect ( Spree . deprecator ) . to receive ( :warn ) . with (
14+ "Including SolidusPromotions::Benefits::ShipmentBenefit is deprecated."
15+ )
16+ subject
17+ end
18+ end
You can’t perform that action at this time.
0 commit comments