Skip to content

Instantly share code, notes, and snippets.

class BidOfferedJob < Struct.new(:bid_id)
PRIORITY = 1
def self.enqueue(bid)
Delayed::Job.enqueue new(bid.id), priority: PRIORITY
end
def perform
Mailer.bid_offered(owner, bid).deliver
Activity.create activity_type: 'bid_offered', subject: bid, user: aide
require "spec_helper"
describe ExampleController do
context "GET #index" do
let(:resources) { FactoryGirl.create_list(:resource) }
before do
get :index
end
module DelayedJob
module Matchers
def enqueue_delayed_job(handler)
DelayedJobMatcher.new handler
end
class DelayedJobMatcher
def initialize(handler)
@handler = handler
@attributes = {}
@ralphos
ralphos / .rspec
Created March 16, 2014 13:16 — forked from coreyhaines/.rspec
--colour
-I app
@ralphos
ralphos / create_locations.rb
Created May 25, 2012 04:30 — forked from szimek/create_locations.rb
How to setup PostGIS with Rails
class CreateLocations < ActiveRecord::Migration
def self.up
create_table :locations do |t|
t.datetime :time
t.point :geom, :null => false, :srid => 4326, :with_z => true
t.float :speed
end
end
def self.down
@ralphos
ralphos / message.rb
Created April 30, 2012 16:14 — forked from jwo/message.rb
Sample mailbox delivery code for Ruby Off Rails
class Message
def deliver_to(mailbox)
mailbox.new_mail(self)
end
end
class Mailbox
def initialize