diff --git a/spec/guard/listeners/darwin_spec.rb b/spec/guard/listeners/darwin_spec.rb index 1b679bb..2c31edb 100644 --- a/spec/guard/listeners/darwin_spec.rb +++ b/spec/guard/listeners/darwin_spec.rb @@ -21,7 +21,7 @@ describe Guard::Darwin do subject.should be_usable end - it_should_behave_like "a listener that reacts to #on_change" - it_should_behave_like "a listener scoped to a specific directory" + it_should_behave_like "a listener that reacts to #on_change", 0.4 + it_should_behave_like "a listener scoped to a specific directory", 0.4 end end diff --git a/spec/support/listener_helper.rb b/spec/support/listener_helper.rb index 85c9d78..38388e5 100644 --- a/spec/support/listener_helper.rb +++ b/spec/support/listener_helper.rb @@ -1,10 +1,10 @@ private def start - sleep 1 + sleep(@rest_delay || 1) @listener.update_last_event Thread.new { @listener.start } - sleep 1 + sleep(@rest_delay || 1) end def record_results @@ -17,17 +17,18 @@ private end def stop - sleep 1 + sleep(@rest_delay || 1) @listener.stop - sleep 1 + sleep(@rest_delay || 1) end def results @results.flatten end -shared_examples_for 'a listener that reacts to #on_change' do +shared_examples_for 'a listener that reacts to #on_change' do |rest_delay| before(:each) do + @rest_delay = rest_delay @listener = described_class.new record_results end @@ -105,8 +106,9 @@ shared_examples_for 'a listener that reacts to #on_change' do end -shared_examples_for "a listener scoped to a specific directory" do +shared_examples_for "a listener scoped to a specific directory" do |rest_delay| before :each do + @rest_delay = rest_delay @wd = @fixture_path.join("folder1") @listener = described_class.new @wd end