Browse files

Added test for 2 sounds

  • Loading branch information...
1 parent 1f2cb58 commit dbb94a4d2c65019962b254c1f74ab59777d033a8 @rafadc rafadc committed Jan 29, 2012
Showing with 17 additions and 4 deletions.
  1. +0 −1 lib/model/drumkit.rb
  2. +17 −3 spec/drumkit_spec.rb
View
1 lib/model/drumkit.rb
@@ -13,7 +13,6 @@ def initialize(drumkit_name = nil, tempo = 180, length = 4)
end
def load(drumkit_name)
- puts "Loading #{get_drumkit_loader.load(drumkit_name)}"
@sounds = get_drumkit_loader.load(drumkit_name)
end
View
20 spec/drumkit_spec.rb
@@ -23,13 +23,27 @@ def wait_for_threads_to_finish
drumkit_loader
end
- it "should play if a single sound in pattern 0 set" do
+ let(:simple_drumkit) do
drumkit = Rhythmic::Drumkit.new
+ drumkit.tempo = 10000
drumkit.drumkit_loader = drumkit_loader
drumkit.load "my drumkit"
- drumkit.pattern("kick", 0, 0)
- drumkit.play
+ drumkit
+ end
+
+ it "should play if a single sound in pattern 0 set" do
+ simple_drumkit.pattern("kick", 0, 0)
+ simple_drumkit.play
+ @kick_sound.should_receive(:play)
+ wait_for_threads_to_finish
+ end
+
+ it "should play two sounds if set in pattern 0 set" do
+ simple_drumkit.pattern("kick", 0, 0)
+ simple_drumkit.pattern("tom", 0, 1)
+ simple_drumkit.play
@kick_sound.should_receive(:play)
+ @tom_sound.should_receive(:play)
wait_for_threads_to_finish
end
end

0 comments on commit dbb94a4

Please sign in to comment.