Skip to content

Instantly share code, notes, and snippets.

def show_project(username, project_name)
user = User.with(username)
project = Project.for(user).named(project_name)
Presenter::Board.new(project, user).render
end
def a_method(required_arguments, optional_arguments,
*additional_required_arguments,
keyword_arguments: "with_defaults",
**rest_of_keyword_arguments,
&block_capture)
end
module Cucumber
module Impersonators
class BankManager
def initialize(world)
@world = world
end
def method_missing(method, *args, &block)
@world.send(method, *args, &block)
end
module Cucumber
module Impersonators
class BankManager
def initialize(world)
@world = world
end
def login
@world.visit '/login'
@world.fill_in 'username', with: 'me'
Dir.should_receive(:glob).and_yield(post_name)
Post.should_receive(:load_from_file).and_return(post)
Dir.glob("#{File.dirname(__FILE__) + '/../../posts/*.yml'}") do |file|
post = Post.load_from_file(file)
end
class Someclass < Struct.new(:listener)
def sign_up attributes
post '/sign-up', attributes,
success: ->(response) { listener.user_signed_up attributes.merge(response) },
error: ->(cause) {listener.error_signing_up_user cause}
end
...
end
@ecomba
ecomba / gist:104031
Created April 29, 2009 20:22
Raising an Exception and keeping the backtrace
class A
def self.ouch
raise "blarrrghhh"
end
end
class B
def self.ouch
begin
A.ouch