Try to reduce specs execution time by providing an option for the "rest delay" before & after starting / stopping the listener.
This commit is contained in:
parent
0b945f10ec
commit
24f0d21f71
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user