listened to" do significant_other = Sender.new("I had a good day") me = double(Recipient) me.stub(:listened_to_day?) { true } significant_other.describe_day_to(me) significant_other.mood.should >= "content" end end
if @feel_acknowledged "content" end end def describe_day_to(another_person) if another_person.listened_to_day? @feel_acknowledged = true end end end class Recipient end
understood" do significant_other = Sender.new "I had a good day" me = Recipient.new significant_other.describe_day_to(me) significant_other.mood.should >= "content" end end
another_person.interpret(@said) if satisfied_with_interpretation?(interpretation) @feel_acknowledged = true end end def satisfied_with_interpretation?(interpretation) shared_words = interpretation.split(' ') & @said.split(' ') true if shared_words.size >= 2 end end
a content mood when all frustrations are understood" do complaints = ["Heroku was down", "There was ruby drama on twitter", "My presentation isn't done yet"] me = Sender.new complaints significant_other = Recipient.new me.describe_day_to(significant_other) me.mood.should >= "content" end end
|message| interpretation = another_person.interpret(message) if satisfied_with_interpretation?(interpretation, message) @feel_acknowledged = true else @feel_acknowledged = false end end end def satisfied_with_interpretation?(interpretation, message) shared_words = interpretation.split(' ') & message.split(' ') true if shared_words.size >= 1 end end
good day" "I'm glad you had a good day" elsif sentence == "Heroku was down" "What is Heroku?" elsif sentence == "There was ruby drama on twitter" "There is drama with ruby? Isn't it a programming language?" elsif sentence == "My presentation isn't done yet" "I'm sorry your presentation is taking so long" end end end