Not sure if my syntax is right, it doesn't seem to recognise the stub I've passed to my double.
class Robot
def boogie friend
friend.dances
end
end
Test:
describe Robot do
let(:robo_friend){double(:friend, {dances: true})}
it "should have a friend dance too" do
expect(subject.boogie :robo_friend).to be true
end
end
And the error:
Robot should have a friend dance too
Failure/Error: expect(subject.boogie :robo_friend).to be true
NoMethodError:
undefined method `dances' for :robo_friend:Symbol
# ./lib/robot.rb:3:in `boogie'
# ./spec/robot_spec.rb:8:in `block (2 levels) in <top (required)>'
Can anyone see what I'm doing wrong?
Aucun commentaire:
Enregistrer un commentaire