Skip to content

Instantly share code, notes, and snippets.

View cored's full-sized avatar
🐔
Debugging Everything

Rafael George cored

🐔
Debugging Everything
View GitHub Profile
klass = Object.const_get("FakestZuora::#{class_name.to_s.constantize}")
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
require "minitest/autorun"
module Anagram
def self.call(words, str)
[]
end
end
describe Anagram do
it "when we pass an empty string" do
require "minitest/autorun"
module Anagram
def self.call(words, str)
end
end
require "minitest/autorun"
module Anagram
end
describe Anagram do
it "when we pass an empty string" do
words = ["apple", "orange"]
str = ""
def determine_whether_parcel_or_non_forward_stocked_nwgd
if transit_legs.present?
shipping_method_from_shipping_preference
else
"parcel"
end
end
def unreserve_shipment(shipment)
shipment.update_attributes(:shipment_batch_id => nil)
Inventory::Reservations.unreserve_shipment(shipment)
end
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],
# 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") }
# 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") }