~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to vendor/gems/rspec/examples/pure/greeter_spec.rb

  • Committer: Bazaar Package Importer
  • Author(s): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mto: (3.1.1 lenny) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20080726154345-1fmgo76b4l72ulvc
ImportĀ upstreamĀ versionĀ 0.24.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require File.dirname(__FILE__) + '/spec_helper'
 
2
# greeter.rb
 
3
#
 
4
# Based on http://glu.ttono.us/articles/2006/12/19/tormenting-your-tests-with-heckle
 
5
#
 
6
# Run with:
 
7
#
 
8
#   spec greeter_spec.rb --heckle Greeter
 
9
#
 
10
class Greeter
 
11
  def initialize(person = nil)
 
12
    @person = person
 
13
  end
 
14
 
 
15
  def greet
 
16
    @person.nil? ? "Hi there!" : "Hi #{@person}!"
 
17
  end
 
18
end
 
19
 
 
20
describe "Greeter" do
 
21
  it "should say Hi to person" do
 
22
    greeter = Greeter.new("Kevin")
 
23
    greeter.greet.should == "Hi Kevin!"
 
24
  end
 
25
 
 
26
  it "should say Hi to nobody" do
 
27
    greeter = Greeter.new
 
28
    # Uncomment the next line to make Heckle happy
 
29
    #greeter.greet.should == "Hi there!"
 
30
  end
 
31
end