Skip to content

Commit

Permalink
Add a null promotion handler
Browse files Browse the repository at this point in the history
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
mamhoff committed Nov 2, 2023
1 parent 0ed4286 commit 234f73e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
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
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

0 comments on commit 234f73e

Please sign in to comment.