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
|
subject.should be_usable
|
||||||
end
|
end
|
||||||
|
|
||||||
it_should_behave_like "a listener that reacts to #on_change"
|
it_should_behave_like "a listener that reacts to #on_change", 0.4
|
||||||
it_should_behave_like "a listener scoped to a specific directory"
|
it_should_behave_like "a listener scoped to a specific directory", 0.4
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
private
|
private
|
||||||
|
|
||||||
def start
|
def start
|
||||||
sleep 1
|
sleep(@rest_delay || 1)
|
||||||
@listener.update_last_event
|
@listener.update_last_event
|
||||||
Thread.new { @listener.start }
|
Thread.new { @listener.start }
|
||||||
sleep 1
|
sleep(@rest_delay || 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def record_results
|
def record_results
|
||||||
@ -17,17 +17,18 @@ private
|
|||||||
end
|
end
|
||||||
|
|
||||||
def stop
|
def stop
|
||||||
sleep 1
|
sleep(@rest_delay || 1)
|
||||||
@listener.stop
|
@listener.stop
|
||||||
sleep 1
|
sleep(@rest_delay || 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def results
|
def results
|
||||||
@results.flatten
|
@results.flatten
|
||||||
end
|
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
|
before(:each) do
|
||||||
|
@rest_delay = rest_delay
|
||||||
@listener = described_class.new
|
@listener = described_class.new
|
||||||
record_results
|
record_results
|
||||||
end
|
end
|
||||||
@ -105,8 +106,9 @@ shared_examples_for 'a listener that reacts to #on_change' do
|
|||||||
|
|
||||||
end
|
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
|
before :each do
|
||||||
|
@rest_delay = rest_delay
|
||||||
@wd = @fixture_path.join("folder1")
|
@wd = @fixture_path.join("folder1")
|
||||||
@listener = described_class.new @wd
|
@listener = described_class.new @wd
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user