Skip to content

Instantly share code, notes, and snippets.

@knewter
Created September 7, 2011 17:07
Show Gist options
  • Save knewter/1201122 to your computer and use it in GitHub Desktop.
Save knewter/1201122 to your computer and use it in GitHub Desktop.
Given /^user "([^"]*)" has selected "([^"]*)" as his receive funds method$/ do |user, receive_funds_method|
u = model("user \"#{user}\"")
$ai = u.account_information
$ai.stubs(:receive_funds_method_raw).returns(receive_funds_method)
# Oh gods of ruby, do not be angry with me, for I could find no other way -ja
eval <<-EOF
class User < ActiveRecord::Base
alias_method :original_account_information, :account_information
def account_information
if id == #{u.id}
$ai
else
original_account_information
end
end
end
EOF
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment