Permalink
Browse files

updated to 0.0.2 and switched to teasing mode by default.

  • Loading branch information...
1 parent 17b4739 commit 64c87dbfd161231b3c33e548f3f4313d00c8dafb @mattetti committed Apr 25, 2008
Showing with 19 additions and 8 deletions.
  1. +3 −0 History.txt
  2. +6 −2 lib/raffle.rb
  3. +1 −1 sdruby-raffle.gemspec
  4. +9 −5 spec/raffle_spec.rb
View
3 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:
View
8 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
View
2 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"]
View
14 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

0 comments on commit 64c87db

Please sign in to comment.