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
klass = Object.const_get("FakestZuora::#{class_name.to_s.constantize}") |
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
require "minitest/autorun" | |
module Anagram | |
def self.call(words, str) | |
words.select do |word| | |
word if (word.chars.sort == str.chars.sort) && word != str | |
end | |
end | |
end |
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
require "minitest/autorun" | |
module Anagram | |
def self.call(words, str) | |
[] | |
end | |
end | |
describe Anagram do | |
it "when we pass an empty string" do |
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
require "minitest/autorun" | |
module Anagram | |
def self.call(words, str) | |
end | |
end |
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
require "minitest/autorun" | |
module Anagram | |
end | |
describe Anagram do | |
it "when we pass an empty string" do | |
words = ["apple", "orange"] | |
str = "" |
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
def determine_whether_parcel_or_non_forward_stocked_nwgd | |
if transit_legs.present? | |
shipping_method_from_shipping_preference | |
else | |
"parcel" | |
end | |
end |
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
def unreserve_shipment(shipment) | |
shipment.update_attributes(:shipment_batch_id => nil) | |
Inventory::Reservations.unreserve_shipment(shipment) | |
end |
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
context "with different shipping preferences" do | |
let(:shipment1) { build(:shipment, shipping_preference: "parcel", products: [product_a]) } | |
let(:shipment2) { build(:shipment, shipping_preference: "courier", products: [product_b]) } | |
it "does not swap for the bundling product" do | |
expect(shipments_out).to match_array(shipments_in) | |
expect(products_skus_in_shipments(shipments_out)).to match_array( | |
[ | |
[product_a.sku], | |
[product_b.sku], |
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
# frozen_string_literal: true | |
require "rails_helper" | |
RSpec.describe Groupments::SwapForBundleProducts do | |
subject(:shipments_out) do | |
described_class.call(shipments_in, decision_matrix_class) | |
end | |
let(:product_a) { create(:product, sku: "SKUA") } |
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
# frozen_string_literal: true | |
require "rails_helper" | |
RSpec.describe Groupments::SwapForBundleProducts do | |
subject(:shipments_out) do | |
described_class.call(shipments_in, decision_matrix_class) | |
end | |
let(:product_a) { create(:product, sku: "SKUA") } |