Skip to content

Commit

Permalink
Merge pull request solidusio#5767 from mamhoff/null-promo-handler-ret…
Browse files Browse the repository at this point in the history
…urn-value

NullPromotionHandler: return self from #apply
  • Loading branch information
tvdeyen authored Jun 4, 2024
2 parents d5ea410 + fd5d77e commit ca82fa6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion core/app/models/spree/null_promotion_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ def initialize(order)
def activate
@order
end
alias_method :apply, :activate

def apply
self
end

def can_apply?
true
Expand Down
5 changes: 3 additions & 2 deletions core/spec/models/spree/null_promotion_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
describe "#apply" do
subject(:activate) { handler.apply }

it "returns the unchanged order" do
expect(activate).to eq(order)
it "returns the handler with the unchanged order" do
expect(activate).to eq(handler)
expect(activate.order).to eq(order)
end
end

Expand Down

0 comments on commit ca82fa6

Please sign in to comment.