Skip to content

Instantly share code, notes, and snippets.

View ratnikov's full-sized avatar

Dmitry Ratnikov ratnikov

  • wonder.com
  • New York, NY
View GitHub Profile
class AccountsController < ApplicationController
def new
@account = Account.new
end
def create
@account = Account.new(params[:account])
if @account.save
session[:account_id] = @account.id
flash[:notice] = "Thank you for signing up! You are now logged in."
Feature: Beer Donations
In order to donate a beer
A user
Should be signed_in
Background:
Given user@example.com is a user with password "secret"
Scenario: A registered user should be able to donate a beer to another registered user
Given someone@example.com is a user
def can_edit?(this_user)
=begin
if can_delete(this_user)
return true
end
if this_user.isadmin
return true
end
if user == this_user
return true
def para (attributes = {}, &block)
method_missing(:p, attributes, &block)
end
para do
<<-END_PARAGRAPH
Hello there. I love #{input 'inputting VARIOUS things'}. I also get a kick
out of #{code 'coding various things'}. There's such a thrill in
seeing all of the exciting #{output 'output you can get'} from a
well-written program.
def para (attributes = {}, &block)
method_missing(:p, attributes, &block)
end
para do
foo = <<-END_PARAGRAPH
Hello there. I love #{input 'inputting VARIOUS things'}. I also get a kick
out of #{code 'coding various things'}. There's such a thrill in
seeing all of the exciting #{output 'output you can get'} from a
well-written program.
def uses(source = nil)
block = proc { yield }
klass.inject_csv_source = block_given? ? block : source
end
require 'cgi'
module LoggedInControllerExtension
def self.included(base)
base.extend Setup
base.setup_logged_in
end
module Setup
def setup_logged_in
require 'cgi'
module LoggedInControllerExtension
def self.included(base)
base.extend Setup
base.setup_logged_in
end
module Setup
def setup_logged_in