Hack Night RSpec
November 13th, 2007
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# # RSpec for HackNight # describe HackNight do before do @hacknight = HackNight.new(Panera.new, RubyGroup.invite) end it "should have multiple rubyists" do @hacknight.rubyists.length.should > 1 end it "should have people with laptops" do laptop = false @hacknight.rubyists.each { |person| laptop = true if person.laptop? } laptop.should be_true end it "should be at a location with coffee or beer" do (@hacknight.location.coffee? || @hacknight.location.beer?).should be_true end it "should have free wifi" do @hacknight.location.wifi?.should be_true @hacknight.location.wifi_cost.should == 0 end it "should be fun and interesting for everyone" do @hacknight.rubyists.each do |person| person.fun?.should be_true person.interested?.should be_true end end end |
3 Responses Follows
Sorry, comments are closed for this article.

on November 13th, 2007 at 03:01 PM Testing the tests :) ... there is a bug in the scenario - "should have people with laptops". It should read ... it "should have people with laptops" do laptop = true @hacknight.rubyists.each { |person| laptop = false unless person.laptop? } laptop.should be_true end
on November 13th, 2007 at 04:51 PM Smarty pants. ;-) I suppose it should have read "should have at least one laptop among the group". So, what else have ya got? Bring it on. Hurt the code.
on November 14th, 2007 at 10:24 AM Thanks for the sample RSpec Scott! It puts it all in perspective... I found myself google'ing this morning for BDD packages targeting .Net. Too bad I'm "just a contractor" and nobody really listens to me here! Thanks for getting us back together Scott. I look forward to the next meeting.