Upgraded Rails and RSpec
[monkeycharger.git] / vendor / plugins / rspec / examples / greeter_spec.rb
blob7d67e3187eceda02a985dd4308354ba809d9b0d9
1 # greeter.rb
3 # Based on http://glu.ttono.us/articles/2006/12/19/tormenting-your-tests-with-heckle
5 # Run with:
7 #   spec greeter_spec.rb --heckle Greeter
9 class Greeter
10   def initialize(person = nil)
11     @person = person
12   end
14   def greet
15     @person.nil? ? "Hi there!" : "Hi #{@person}!"
16   end
17 end
19 describe "Greeter" do
20   it "should say Hi to person" do
21     greeter = Greeter.new("Kevin")
22     greeter.greet.should == "Hi Kevin!"
23   end
25   it "should say Hi to nobody" do
26     greeter = Greeter.new
27     # Uncomment the next line to make Heckle happy
28     #greeter.greet.should == "Hi there!"
29   end
30 end