This file contains hidden or 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 'spec_helper' | |
describe Scheduled::ChaseCardUpdateRequestJob do | |
describe "#execute" do | |
before do | |
orders | |
Scheduled::ChaseCardUpdateRequestJob.new.execute | |
end | |
context "Order being shipped in the next 10 days that needs an updated card" do |
This file contains hidden or 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
orders = Order.joins(:order_state_transitions).where("order_state_transitions.to = 'charged'").order('id DESC').limit(50000).includes(:linked_orders).to_a; nil | |
bad_orders = orders.find_all{ |order| order.linked_orders.length > 1 && order.linked_orders.find_all{ |o| o.order_classification == 0 && o.state == 'start_order'}.length > 1}; nil | |
dup_orders = multi_followon_orders.map(&:linked_orders).map{ |linked_orders| linked_orders - linked_orders.uniq_by{ |o| "#{o.kid.try(:id)}#{o.user_selected_ship_date.to_s}#{o.line_items.map(&:variant_id).join}"} }; nil |
This file contains hidden or 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
module Scheduled | |
class ChaseOvernightChargeJob < JobBase | |
run_every_day(1, 0) | |
def perform | |
Chase::BatchChargeService.new(charges).charge | |
end | |
def charges |
This file contains hidden or 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
describe Something do | |
describe "#do_something" do | |
before do | |
allow_any_instance_of(Namespace::MyClass).to receive(:foo) | |
Something.new.do_something | |
end | |
#expect to have received foo | |
end | |
end |
This file contains hidden or 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
describe Something do | |
subject{ Something.new } | |
let(:my_object){ Namespace::MyClass.new } | |
describe "#do_something" do | |
before do | |
allow(my_object).to receive(:foo) | |
allow(subject).to receive(:my_object).and_return(my_object) | |
subject.do_something | |
end |
This file contains hidden or 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
describe Something do | |
subject{ Something.new } | |
let(:my_object){ Namespace::MyClass.new } | |
before do | |
allow(my_object).to receive(:foo) | |
allow(subject).to receive(:my_object).and_return(my_object) | |
subject.do_something | |
end |
This file contains hidden or 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
describe Something do | |
before do | |
allow_any_instance_of(Namespace::MyClass).to receive(:foo) | |
Something.new.do_something | |
end | |
#expect to have received foo | |
end | |
class Something |
This file contains hidden or 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
#!/usr/bin/env ruby | |
class FailFinder | |
def initialize(specs) | |
@test_specs = specs[0...-1] | |
@result_spec = specs.last | |
end | |
def stupid_spec | |
binary_search(@test_specs) |
This file contains hidden or 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
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; |
This file contains hidden or 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
class Klass | |
def a(b) | |
p "Hello" | |
end | |
def c | |
a(1) | |
a(2) | |
end | |
end |