Skip to content

Instantly share code, notes, and snippets.

@yorickpeterse
Created January 12, 2015 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yorickpeterse/f3c854e13b3bd27c17cb to your computer and use it in GitHub Desktop.
Save yorickpeterse/f3c854e13b3bd27c17cb to your computer and use it in GitHub Desktop.
# The contents of this block would be arbitrary, it's _not_ tied into any ORM/database/etc.
define_dummy(:stubbed_user) do |attrs|
user = User.new(attrs)
user.stub(:something).and_return('foo')
user
end
describe User do
describe '#something' do
it 'returns something' do
user = dummy(:stubbed_user, :name => 'Alice')
# ...
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment