-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This class is useful for satisfying Solidus' need for a shipping promotion handler. With SolidusFriendlyPromotions, shipping promotions are handled just like other promotions, so we don't need to do anything here.
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
promotions/app/models/solidus_friendly_promotions/promotion_handler/null.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module SolidusFriendlyPromotions | ||
module PromotionHandler | ||
# We handle shipping promotions just like other promotions, so we don't need a | ||
# special promotion handler for shipping. However, Solidus wants us to implement one. | ||
# This is what this class is for. | ||
class Null | ||
attr_reader :order | ||
attr_accessor :error, :success | ||
|
||
def initialize(order) | ||
@order = order | ||
end | ||
|
||
def activate | ||
end | ||
end | ||
end | ||
end |
14 changes: 14 additions & 0 deletions
14
promotions/spec/models/solidus_friendly_promotions/promotion_handler/null_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
RSpec.describe SolidusFriendlyPromotions::PromotionHandler::Null do | ||
let(:order) { double } | ||
|
||
subject { described_class.new(order) } | ||
|
||
it { is_expected.to respond_to(:order) } | ||
it { is_expected.to respond_to(:error) } | ||
it { is_expected.to respond_to(:success) } | ||
it { is_expected.to respond_to(:activate) } | ||
end |