Skip to content

Commit

Permalink
updated to 0.0.2 and switched to teasing mode by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattetti committed Apr 25, 2008
1 parent 17b4739 commit 64c87db
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
3 changes: 3 additions & 0 deletions History.txt
@@ -1,3 +1,6 @@
== 0.0.2 2008-02-07
* switched to teasing mode by default

== 0.0.1 2008-02-07 == 0.0.1 2008-02-07


* 1 major enhancement: * 1 major enhancement:
Expand Down
8 changes: 6 additions & 2 deletions lib/raffle.rb
Expand Up @@ -30,7 +30,7 @@ class Raffle


def initialize(participants = []) def initialize(participants = [])
@participants = participants @participants = participants
@mode = 'normal' @mode = 'teasing'
end end


def pick_a_winner def pick_a_winner
Expand All @@ -39,7 +39,7 @@ def pick_a_winner
remove_participant(winner) remove_participant(winner)
if @mode == 'teasing' if @mode == 'teasing'
tease_the_loosers(winner) tease_the_loosers(winner)
"congratulations #{winner}!" "long congratulations to #{winner} sent to STDOUT"
else else
winner winner
end end
Expand All @@ -48,6 +48,10 @@ def pick_a_winner
def teasing_mode def teasing_mode
@mode = 'teasing' @mode = 'teasing'
end end

def normal_mode
@mode = 'normal'
end


protected protected


Expand Down
2 changes: 1 addition & 1 deletion sdruby-raffle.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = %q{sdruby-raffle} 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.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.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Matt Aimonetti"] s.authors = ["Matt Aimonetti"]
Expand Down
14 changes: 9 additions & 5 deletions spec/raffle_spec.rb
@@ -1,14 +1,15 @@
require File.dirname(__FILE__) + '/spec_helper.rb' require File.dirname(__FILE__) + '/spec_helper.rb'
require File.dirname(__FILE__) + '/../lib/raffle' require File.dirname(__FILE__) + '/../lib/raffle'


def create_raffle def create_normal_raffle
@raffle = Raffle.new(["matt", "dominic"]) @raffle = Raffle.new(["matt", "dominic"])
@raffle.normal_mode
end end


describe "a generic Raffle" do describe "a generic Raffle in normal mode" do


before(:each) do before(:each) do
create_raffle create_normal_raffle
end end


it "should be able to create a new instance of itself" do it "should be able to create a new instance of itself" do
Expand Down Expand Up @@ -38,14 +39,17 @@ def create_raffle


describe 'in teasing mode' do describe 'in teasing mode' do
before(:each) do before(:each) do
create_raffle @raffle = Raffle.new(["matt", "dominic"])
@raffle.teasing_mode
end end


it "should be able to run in teasing mode" do it "should be able to run in teasing mode" do
@raffle.mode.should == 'teasing' @raffle.mode.should == 'teasing'
end end


it "should have a long and annoying message" do
@raffle.pick_a_winner.should include("long congratulations to")
end

end end


describe 'randomize' do describe 'randomize' do
Expand Down

0 comments on commit 64c87db

Please sign in to comment.