Make the sleep time for listener specs configurable.
This commit is contained in:
parent
5c9ee2afdf
commit
5de287ba95
@ -1,10 +1,14 @@
|
|||||||
private
|
private
|
||||||
|
|
||||||
|
def sleep_time
|
||||||
|
ENV['GUARD_SPEC_SLEEP'] ? ENV['GUARD_SPEC_SLEEP'].to_i : 1
|
||||||
|
end
|
||||||
|
|
||||||
def start
|
def start
|
||||||
sleep(@rest_delay || 1)
|
sleep(sleep_time)
|
||||||
@listener.update_last_event
|
@listener.update_last_event
|
||||||
Thread.new { @listener.start }
|
Thread.new { @listener.start }
|
||||||
sleep(@rest_delay || 1)
|
sleep(sleep_time)
|
||||||
end
|
end
|
||||||
|
|
||||||
def record_results
|
def record_results
|
||||||
@ -17,18 +21,17 @@ private
|
|||||||
end
|
end
|
||||||
|
|
||||||
def stop
|
def stop
|
||||||
sleep(@rest_delay || 1)
|
sleep(sleep_time)
|
||||||
@listener.stop
|
@listener.stop
|
||||||
sleep(@rest_delay || 1)
|
sleep(sleep_time)
|
||||||
end
|
end
|
||||||
|
|
||||||
def results
|
def results
|
||||||
@results.flatten
|
@results.flatten
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples_for 'a listener that reacts to #on_change' do |rest_delay|
|
shared_examples_for 'a listener that reacts to #on_change' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@rest_delay = rest_delay if rest_delay.is_a?(Integer) || rest_delay.is_a?(Float) # jruby workaround
|
|
||||||
@listener = described_class.new
|
@listener = described_class.new
|
||||||
record_results
|
record_results
|
||||||
end
|
end
|
||||||
@ -115,9 +118,8 @@ shared_examples_for 'a listener that reacts to #on_change' do |rest_delay|
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples_for "a listener scoped to a specific directory" do |rest_delay|
|
shared_examples_for "a listener scoped to a specific directory" do
|
||||||
before :each do
|
before :each do
|
||||||
@rest_delay = rest_delay if rest_delay.is_a?(Integer) || rest_delay.is_a?(Float) # jruby workaround
|
|
||||||
@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