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
# this would be in a helper somewhere | |
def stub_find(entity) | |
result = mock_model(entity) | |
entity.stub(:find).with(result.id).and_return(result) | |
result | |
end | |
let(:params) do | |
{:these => 'params'} | |
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
git log --all -M -C --name-only | grep -E '^(app|lib|spec|features)/' | uniq | sort | uniq -c | sort |
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 Organization | |
def to_param | |
"42" | |
end | |
def saved? | |
rand > 0.5 | |
end | |
end | |
class OrganizationCreator |
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 Organization | |
def to_param | |
"42" | |
end | |
def saved? | |
rand > 0.5 | |
end | |
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 CommentsController < ApplicationController | |
def create | |
app.create_comment(params) | |
end | |
private | |
def app | |
MyRailsApp.new |
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
File.open("test.html", "w") { |file| file << "<h1>hello</h1>" } | |
url = "file://#{File.expand_path '../test.html', __FILE__}" | |
require 'capybara' | |
browser = Capybara::Session.new(:selenium) | |
browser.visit url | |
puts browser.find("h1").text |
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
# total pseudocode | |
class StickyNotePlacer < Role | |
messages :call, :user, :message, :color? | |
end | |
class ApplicationApi < Role | |
messages :sticky_note_placer | |
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
require 'wrong/adapters/rspec' | |
require 'facets/proc/compose' | |
# (apply comp fns) in clojure | |
module Composer | |
def compose(lambdas) | |
lambdas.reduce(:*) || lambda {|x| x} | |
end |
OlderNewer