Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
Trying to figure out how to look up comments I've left

Pat Maddox patmaddox

🤔
Trying to figure out how to look up comments I've left
View GitHub Profile
View gist:11390
require "rubygems"
require "spec"
class AccountService
def withdraw(account, amount)
account.debit(amount)
end
def deposit(account, amount)
account.credit(amount)
View gist:25806
When player wins he should be paid 1-1
When player loses, he is not paid
When player has blackjack, he is paid 1.5-1
Scenario: <Scenario title>
Given <some known state>
And <some more known state>
When <I do something>
Then <some desired outcome>
View strange_name_error.rb
# When I run the specs above, the following error occurs:
$ script/spec -c spec/controllers/strange_name_error.rb
./spec/controllers/strange_name_error.rb:15: undefined local variable or method `properties_url' for #<Class:0x22b918c> (NameError)
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:68:in `module_eval'
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:68:in `create_nested_example_group'
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/extensions/class.rb:14:in `instance_eval'
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/extensions/class.rb:14:in `subclass'
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:66:in `create_nested_example_group'
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:53:in `describe'
View *scratch*
This is just a test thing, to see how gist.el works
View item.rb
module Twinkies
class Item
include DataMapper::Resource
property :id, Integer, :serial => true
property :twitter_id, Integer
property :link, String
property :user, String
property :created_at, DateTime
property :text, Text, :lazy => false
property :guid, String, :default => Proc.new { Guid.new.to_s }
View gotgit.rb
require 'rubygems'
require 'grit'
require 'gruff'
module GotGit
class Repo
def initialize(url)
@repo = Grit::Repo.new url
end
View incentives_controller_spec.rb
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe IncentivesController do
integrate_views
describe "GET /incentives" do
it "should work" do
get :index
response.should be_success
end
View server.rb
require 'sinatra/base'
module Griki
class Server < Sinatra::Base
enable :static
def initialize(repository, app=nil)
@repository = repository
super app
options.root = @repository.root
View gist:62546
require 'rubygems'
require 'spec'
class Mine
attr_reader :foo, :bar
def initialize
@foo = 'unchanged'
@bar = 'unchanged'
end
View users_controller.rb
create.response do |wants|
wants.html { redirect_to welcome_user_path(@user) }
end
You can’t perform that action at this time.