Skip to content

Instantly share code, notes, and snippets.

@davidimoore
Last active August 29, 2015 14:11
Show Gist options
  • Save davidimoore/b9e4a844927a3b23be9c to your computer and use it in GitHub Desktop.
Save davidimoore/b9e4a844927a3b23be9c to your computer and use it in GitHub Desktop.
#stubs
describe '#solution' do
it 'delegates to its clone' do
clone = double("clone")
solution = double("solution")
#prepares clone
allow(clone).to receive(:solution).and_return(solution)
participation = Participation.new(clone:clone)
#since participation is an instance of clone,
#it can receive the solution method
result = participation.solution
expect(result).to eq(solution)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment