This file contains 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 "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 } |
This file contains 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
/* | |
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. |
This file contains 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
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 |
This file contains 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
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 |
This file contains 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 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", |
This file contains 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
#!/bin/bash | |
if [ $# == 0 ]; then | |
mvim | |
else | |
mvim --servername $(basename $(pwd)) --remote-tab-silent "$@" 1>/dev/null 2>&1 | |
fi |
This file contains 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 MyScopes | |
def self.included(base) | |
base.send(:scope, :blue, lambda { where("color = blue") }) | |
end | |
end | |
class ActiveRecord::Base | |
include MyScopes | |
end |
This file contains 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 ActiveRecord::Base | |
scope :none, where("false") | |
end |
This file contains 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
scope :none, where("false") | |
def self.listable_by(user) | |
return none unless user | |
where(:creator_id => user.id) | |
end |
This file contains 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
$ cat spec/support/shoulda.rb | |
require 'shoulda' | |
Rspec.configure do |config| | |
config.include Shoulda::ActiveRecord::Matchers | |
config.include Shoulda::ActionController::Matchers | |
end |