Skip to content

Instantly share code, notes, and snippets.

View tammersaleh's full-sized avatar
🚀
Orbiting?

Tammer Saleh tammersaleh

🚀
Orbiting?
View GitHub Profile
require 'spec_helper'
describe "given some agents" do
before do
create(:agent, name: "Agent 1")
create(:agent, name: "Agent 2")
end
describe "GET /agents.json", :as => :api do
its(:status) { should == 200 }
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
def new_idea_notification(idea, user)
@idea = idea
@user = user
headers("X-Foo" => "foo")
headers["X-Fie"] = "fie"
email = mail(:to => user.email,
:subject => "New Idea: #{@idea.title}",
"X-Bar" => "foo")
email["X-what"] = "why"
end
def new_idea_notification(idea, user)
@idea = idea
@user = user
headers("X-Foo" => "foo")
headers["X-Fie"] = "fie"
mail :to => user.email,
:subject => "New Idea: #{@idea.title}",
"X-Bar" => "foo"
end
class Mailer < ActionMailer::Base
default :from => "[email protected]"
helper :formatting
def new_notification(user)
@idea = idea
@user = user
headers("X-Foo" => "foo")
mail :to => user.email,
:subject => "Subject",
#!/bin/bash
if [ $# == 0 ]; then
mvim
else
mvim --servername $(basename $(pwd)) --remote-tab-silent "$@" 1>/dev/null 2>&1
fi
module MyScopes
def self.included(base)
base.send(:scope, :blue, lambda { where("color = blue") })
end
end
class ActiveRecord::Base
include MyScopes
end
class ActiveRecord::Base
scope :none, where("false")
end
scope :none, where("false")
def self.listable_by(user)
return none unless user
where(:creator_id => user.id)
end
$ cat spec/support/shoulda.rb
require 'shoulda'
Rspec.configure do |config|
config.include Shoulda::ActiveRecord::Matchers
config.include Shoulda::ActionController::Matchers
end