From 64c87dbfd161231b3c33e548f3f4313d00c8dafb Mon Sep 17 00:00:00 2001 From: Matt Aimonetti Date: Thu, 24 Apr 2008 19:51:42 -0700 Subject: [PATCH] updated to 0.0.2 and switched to teasing mode by default. --- History.txt | 3 +++ lib/raffle.rb | 8 ++++++-- sdruby-raffle.gemspec | 2 +- spec/raffle_spec.rb | 14 +++++++++----- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/History.txt b/History.txt index dd591bb..cd62215 100644 --- a/History.txt +++ b/History.txt @@ -1,3 +1,6 @@ +== 0.0.2 2008-02-07 +* switched to teasing mode by default + == 0.0.1 2008-02-07 * 1 major enhancement: diff --git a/lib/raffle.rb b/lib/raffle.rb index e8f3103..09a17bd 100644 --- a/lib/raffle.rb +++ b/lib/raffle.rb @@ -30,7 +30,7 @@ class Raffle def initialize(participants = []) @participants = participants - @mode = 'normal' + @mode = 'teasing' end def pick_a_winner @@ -39,7 +39,7 @@ def pick_a_winner remove_participant(winner) if @mode == 'teasing' tease_the_loosers(winner) - "congratulations #{winner}!" + "long congratulations to #{winner} sent to STDOUT" else winner end @@ -48,6 +48,10 @@ def pick_a_winner def teasing_mode @mode = 'teasing' end + + def normal_mode + @mode = 'normal' + end protected diff --git a/sdruby-raffle.gemspec b/sdruby-raffle.gemspec index 8394c52..1fa3cfe 100644 --- a/sdruby-raffle.gemspec +++ b/sdruby-raffle.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = %q{sdruby-raffle} - s.version = "0.0.1" + s.version = "0.0.2" s.specification_version = 2 if s.respond_to? :specification_version= s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Matt Aimonetti"] diff --git a/spec/raffle_spec.rb b/spec/raffle_spec.rb index dd8f322..281ee62 100644 --- a/spec/raffle_spec.rb +++ b/spec/raffle_spec.rb @@ -1,14 +1,15 @@ require File.dirname(__FILE__) + '/spec_helper.rb' require File.dirname(__FILE__) + '/../lib/raffle' -def create_raffle +def create_normal_raffle @raffle = Raffle.new(["matt", "dominic"]) + @raffle.normal_mode end -describe "a generic Raffle" do +describe "a generic Raffle in normal mode" do before(:each) do - create_raffle + create_normal_raffle end it "should be able to create a new instance of itself" do @@ -38,14 +39,17 @@ def create_raffle describe 'in teasing mode' do before(:each) do - create_raffle - @raffle.teasing_mode + @raffle = Raffle.new(["matt", "dominic"]) end it "should be able to run in teasing mode" do @raffle.mode.should == 'teasing' end + it "should have a long and annoying message" do + @raffle.pick_a_winner.should include("long congratulations to") + end + end describe 'randomize' do