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
def javascript_confirm(answer) | |
page.evaluate_script 'window._confirm = window.confirm' | |
page.evaluate_script "window.confirm = function(x) { return #{answer} }" | |
yield | |
page.evaluate_script 'window._confirm && (window.confirm = window._confirm)' | |
page.evaluate_script 'window._confirm = null' | |
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
def retrying(attempts, options = {}) | |
exception_class = options[:when] || Exception | |
sleep_time = options[:sleep] || 0.seconds | |
last_exception = nil | |
attempts.each do | |
begin | |
return yield | |
rescue exception_class => last_exception | |
Kernel.sleep sleep_time.to_f | |
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
# Hack to simulate validatable groups with Rails validations | |
# | |
# Example: | |
# | |
# class MortgageApplication < ActiveRecord::Base | |
# validation_group :underwriting | |
# validates_presence_of :ssn | |
# validates_presence_of :name, :if => :validating_for_underwriting? | |
# 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
describe Something do | |
context "when it is too old" do | |
# Two options here: | |
# (a) make it too old by changing the internal state | |
# Pros: Simple | |
# Cons: If you change the definition of what is "too old" you have to change many tests | |
before { subject.updated_at = 2.years.ago } | |
# (b) stub the too_old? method | |
# Pros: Resistant to changes of what "too old" exactly means | |
# Cons: Forces the implementation to use a specific method. |
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
Connecting to the server... | |
ssh -o StrictHostKeyChecking=no -q [email protected] '/usr/local/ey_resin/ruby/bin/gem list ey-deploy | grep "ey-deploy " | egrep -q '\''0\.7\.0[,)]'\' | |
Running deploy for 'ultimate_tennis_staging' on server... | |
ssh -o StrictHostKeyChecking=no -q [email protected] '/usr/local/ey_resin/ruby/bin/eysd _0.7.0_ deploy --app ultimatetennis --repo [email protected]:hashrocket/ultimate-tennis.git --stack nginx_unicorn --branch master --migrate '\''rake db:migrate'\'' --instances ec2-184-72-248-8.compute-1.amazonaws.com,solo' | |
:: i-7ee8f415 running git --git-dir /data/ultimatetennis/shared/cached-copy/.git --work-tree /data/ultimatetennis/shared/cached-copy fetch origin | |
:: i-7ee8f415 running git --git-dir /data/ultimatetennis/shared/cached-copy/.git --work-tree /data/ultimatetennis/shared/cached-copy checkout 'origin/master' | |
HEAD is now at 55c01e5... Fix styles for Wait List button | |
~> Pushing code to all servers | |
~> Starting full depl |
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
Connecting to the server... | |
ssh -o StrictHostKeyChecking=no -q [email protected] '/usr/local/ey_resin/ruby/bin/gem list ey-deploy | grep "ey-deploy " | egrep -q '\''0\.7\.0[,)]'\' | |
Running deploy for 'ultimate_tennis_staging' on server... | |
ssh -o StrictHostKeyChecking=no -q [email protected] '/usr/local/ey_resin/ruby/bin/eysd _0.7.0_ deploy --app ultimatetennis --repo [email protected]:hashrocket/ultimate-tennis.git --stack nginx_unicorn --branch master --migrate '\''rake db:migrate'\'' --instances ec2-184-72-248-8.compute-1.amazonaws.com,solo' | |
:: i-7ee8f415 running git --git-dir /data/ultimatetennis/shared/cached-copy/.git --work-tree /data/ultimatetennis/shared/cached-copy fetch origin | |
:: i-7ee8f415 running git --git-dir /data/ultimatetennis/shared/cached-copy/.git --work-tree /data/ultimatetennis/shared/cached-copy checkout 'origin/master' | |
HEAD is now at 55c01e5... Fix styles for Wait List button | |
~> Pushing code to all servers | |
~> Starting full depl |
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
ruby-1.8.7-p248 > foo = [1,2,3] | |
=> [1, 2, 3] | |
ruby-1.8.7-p248 > Array(foo) | |
=> [1, 2, 3] |
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
lsoto@Leonardo-Sotos-MacBook-Pro:~/src/continuum/trilla(master)$ git log spec/acceptance/ | grep Author | sort | uniq -c | |
1 Author: Abraham <[email protected]> | |
1 Author: Alter Lagos <[email protected]> | |
27 Author: Alter Lagos <[email protected]> | |
21 Author: Leo Soto M <[email protected]> | |
5 Author: vutreras <vutreras@vutreras-pc.(none)> |
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
Object.prototype.new = (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) -> | |
new this(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) | |
class Point | |
constructor: (@x, @y) -> | |
toString: -> "(#{@x}, #{@y})" | |
alert String.new("hello") | |
alert Point.new(10, 10) |
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
Object.prototype.new = (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) -> | |
new this(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) | |
class Point | |
constructor: (@x, @y) -> | |
toString: -> "(#{@x}, #{@y})" | |
alert String.new("hello") | |
alert Point.new(10, 10) |
OlderNewer