]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/rspec-1.1.2/examples/pure/behave_as_example.rb
added RSpec and RSpec on Rails
[rails.git] / vendor / gems / rspec-1.1.2 / examples / pure / behave_as_example.rb
1 require File.dirname(__FILE__) + '/spec_helper'
2
3 def behave_as_electric_musician
4   respond_to(:read_notes, :turn_down_amp)
5 end
6
7 def behave_as_musician
8   respond_to(:read_notes)
9 end
10
11 module BehaveAsExample
12   
13   class BluesGuitarist
14     def read_notes; end
15     def turn_down_amp; end
16   end
17   
18   class RockGuitarist
19     def read_notes; end
20     def turn_down_amp; end
21   end
22   
23   class ClassicGuitarist
24     def read_notes; end
25   end
26   
27   describe BluesGuitarist do
28     it "should behave as guitarist" do
29       BluesGuitarist.new.should behave_as_electric_musician
30     end
31   end
32
33   describe RockGuitarist do
34     it "should behave as guitarist" do
35       RockGuitarist.new.should behave_as_electric_musician
36     end
37   end
38
39   describe ClassicGuitarist do
40     it "should not behave as guitarist" do
41       ClassicGuitarist.new.should behave_as_musician
42     end
43   end
44   
45 end