Skip to content

Instantly share code, notes, and snippets.

View cored's full-sized avatar
🐽
Hacking Everything

Rafael George cored

🐽
Hacking Everything
View GitHub Profile
require "minitest/autorun"
require "minitest/pride"
module ParenthesisValidator
extend self
OPENERS = %w|( { [|
def call(code)
return false if code.size == 1
openers = []
# frozen_string_literal: true
module Groupments
class GroupShipments
def self.call(shipments:)
new(shipments: shipments).call.grouped_shipments
end
attr_reader :grouped_shipments
# frozen_string_literal: true
require_relative "../../../app/services/groupments/group_shipments"
FakeShipment = Struct.new(:parcel, :courier, :shipment_items) do
def courier?
courier
end
def parcel?
module Casper
module OrderPublishing
def publish_to_queue(routing_key)
::Hutch::Casper::Publisher.publish(routing_key, serialized_order, {type: 'order'})
end
def publish_tax_breakdown(routing_key)
::Hutch::Casper::Publisher.publish(routing_key, TaxBreakdownSerializer.new(self).as_json)
end
require "minitest/autorun"
module PI
extend self
def call(str)
return mask_email(str) if str =~ /@/
mask_phone(str)
end
# frozen_string_literal: true
module WarehouseAssignment
module Rates
class UpdateWithCheapest
def self.call(options:)
new(options: Array(options)).to_a
end
def initialize(options:)
module Scans
class Action
def self.call(scan)
factory(scan).call
end
def self.factory(scan)
const_get(scan.type.camelcase).new(scan)
end
require "rails_helper"
feature "Users search shipment", :as_admin_user do
context 'with sorting' do
scenario 'takes the user-defined sorting' do
shipment1 = create :shipment, number: 'Shipment 1', order_completed_at: 2.days.ago
shipment2 = create :shipment, number: 'Shipment 2', vip: true
shipment3 = create :shipment, number: 'Shipment 3', status: 'canceled'
visit shipments_path
require "rails_helper"
describe WarehouseShowPresenter do
subject(:presenter) { described_class.new(warehouse) }
let(:warehouse) { create(:warehouse) }
let(:product) do
create(:product, id: 1,
variation_count: 2,
category: 1,
require "rails_helper"
feature "Users see case pack labels button", :as_admin_user do
scenario "When the shipment is reserve" do
warehouse = create(:warehouse)
inventory_item = create(:inventory_item)
shipment_item = create(:shipment_item, inventory_item: inventory_item)
bulk_shipment = create(:bulk_shipment, shipment_items: [shipment_item])
visit warehouse_bulk_shipment_path(warehouse_id: warehouse.id, id: bulk_shipment.id)