Access it via:
"*
Paste:
"*p
Copy line:
"*Y
describe DonorsChoose do | |
describe "requesting data" do | |
let(:test_title) { "A test project" } | |
def mock_request(args) | |
request = double(:fetch => %Q/{"proposals": [{"title": "#{test_title}"}]}/) | |
DonorsChoose::Request.should_receive(:new).with(args).and_return(request) | |
end | |
context "via lat & lng" do |
require 'ostruct' | |
module ApplicationHelper | |
def pluralize(*args, &blk) | |
result = super | |
if block_given? | |
count, *text = result.split | |
yield OpenStruct.new(text: text.join(' '), count: count) | |
nil | |
else |
require 'spec_helper' | |
describe Candidate do | |
subject { Fabricate(:candidate, first_name: "Joe", last_name: "Doe") } | |
describe "#full_name" do | |
its(:full_name) { should == "Joe Doe" } | |
end | |
describe "#search" do |
RSpec::Matchers.define :have_country do |expected| | |
match do |actual| | |
# usage: | |
# field_labeled('Select your address').should have_option("Home Address") | |
RSpec::Matchers.define :have_option do |expected| | |
def options_for(select_field) | |
select_field.all('option').map &:text | |
end | |
match do |select_field| |
Run Cucumber features features/admin_deletes_an_event.feature features/admin_deletes_an_event.feature:7 | |
ERROR: Guard::Cucumber failed to achieve its <run_on_change>, exception was: | |
Errno::ENOENT: No such file or directory - features/admin_deletes_an_event.feature:7 | |
/Users/dev/.Guardfile:92:in `read' | |
/Users/dev/.Guardfile:92:in `block in cucumber_command' | |
/Users/dev/.Guardfile:91:in `each' | |
/Users/dev/.Guardfile:91:in `any?' | |
/Users/dev/.Guardfile:91:in `cucumber_command' | |
/Users/dev/.rvm/gems/ruby-1.9.2-p136@hr_2011/gems/guard-cucumber-0.7.2/lib/guard/cucumber/runner.rb:24:in `run' | |
/Users/dev/.rvm/gems/ruby-1.9.2-p136@hr_2011/gems/guard-cucumber-0.7.2/lib/guard/cucumber.rb:85:in `run_on_change' |
Drift is an always-already versioned, cloud-backed text editor. You can use it to take notes, and save them in the GitHub cloud.
Your gists are always saved locally, and any changes you make will get pushed to GitHub's servers.
To name a gist, touch its name in the toolbar.
You can use the share button at the top-right to copy a link to one of your gists, or view it on the web in Safari.
# Run :NotRocket to convert current buffer. | |
# Thanks to @tpope for the vim regex fu | |
command! -bar -range=% NotRocket :<line1>,<line2>s/:\(\w\+\)\s*=>/\1:/ge |
- any character you use it will literally match it except special characters | |
^ $ ? . / \ [ ] { } ( ) + * - all the special characters that will need escaping if you don't want them to be special | |
// - regexp ruby class | |
Common Patterns (I authored) | |
/[\w+\.~-]+@[\w~-]+.[\w\.]+/ - match emails, conforms to RFC 3986 section 3.3 | |
/\+?(\d)?[-|\.|\s]?\(?(\d{3})\)?[-|\.|\s]?(\d{3})[-|\.|\s]?(\d{4})/ - match phone numbers, https://gist.github.com/1009331 | |
Strategies |