Skip to content

Instantly share code, notes, and snippets.

View richmolj's full-sized avatar

Lee Richmond richmolj

View GitHub Profile
class Article
def publish
self.published_at = Time.now
save
end
end
class Article
def publish(clock = Time.now)
self.published_at = clock
save
end
end
# BgovService is just a placeholder here, to illustrate this is a service-backed
# class, not ActiveRecord
class Comment < BgovService
end
class Photo < BgovService
end
class Article
# BgovService is just a placeholder here, to illustrate this is a service-backed
# class, not ActiveRecord
class Comment < BgovService
end
class Photo < BgovService
end
@richmolj
richmolj / gist:5912220
Created July 2, 2013 19:16
pseudo code
context "when the service is down" do
before do
SomeService.stub(:get).and_raise(BadResponseError)
end
it "should show a friendly error message" do
visit '/some-url'
click_link 'Tab 2'
page.find("#loading_indicator").should_not_be_visible
kernel/common/encoding.rb:139:in `initialize'
kernel/common/io19.rb:153:in `read_encode'
kernel/common/io19.rb:687:in `read'
execjs (1.4.0) lib/execjs/external_runtime.rb:173:in `sh'
kernel/common/io19.rb:1155:in `popen'
execjs (1.4.0) lib/execjs/external_runtime.rb:173:in `sh'
execjs (1.4.0) lib/execjs/external_runtime.rb:138:in `exec_runtime'
execjs (1.4.0) lib/execjs/external_runtime.rb:28:in `exec'
execjs (1.4.0) lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
execjs (1.4.0) lib/execjs/external_runtime.rb:27:in `exec'
creating Makefile
make
compiling pty.c
pty.c:1:20: error: config.h: No such file or directory
In file included from pty.c:26:
/Users/richmolj/code/rubinius/vm/capi/19/include/ruby/backward/rubyio.h:1:2: warning: #warning use "ruby/io.h" instead of "rubyio.h"
In file included from pty.c:27:
/Users/richmolj/code/rubinius/vm/capi/19/include/ruby/backward/util.h:1:2: warning: #warning use "ruby/util.h" instead of bare "util.h"
make: *** [pty.o] Error 1
rake aborted!
Building 18/pty
make
compiling pty.c
pty.c:1:20: error: config.h: No such file or directory
In file included from pty.c:26:
/Users/richmolj/code/rubinius/vm/capi/19/include/ruby/backward/rubyio.h:1:2: warning: #warning use "ruby/io.h" instead of "rubyio.h"
In file included from pty.c:27:
/Users/richmolj/code/rubinius/vm/capi/19/include/ruby/backward/util.h:1:2: warning: #warning use "ruby/util.h" instead of bare "util.h"
make: *** [pty.o] Error 1
rake aborted!
module Rubinius
# Make this reload friendly without silly constant defined warnings.
BUILD_CONFIG = {
:command_line => "",
:which_ruby => :ruby,
:build_ruby => "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby",
:build_rake => "rake",
:build_perl => "perl",
:llvm => :prebuilt,
:llvm_configure => "/Users/richmolj/code/rubinius/vendor/llvm/Release/bin/llvm-config",
TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/4l/l3fq04bj5y3c60w9sl6n49_m0000gn/T/
Apple_PubSub_Socket_Render=/tmp/launch-i55QGh/Render
TERM_PROGRAM_VERSION=309
TERM_SESSION_ID=46A34ACF-35FA-49A7-98DD-FD955724F795
USER=richmolj
COMMAND_MODE=unix2003
SSH_AUTH_SOCK=/tmp/launch-6Gh463/Listeners