Skip to content

Commit

Permalink
Merge pull request #464 from floehopper/fix-warnings-in-spec-output
Browse files Browse the repository at this point in the history
Fix warnings in spec output
  • Loading branch information
rymai committed Aug 8, 2019
2 parents dc1e798 + 086b785 commit 83bdac8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
5 changes: 4 additions & 1 deletion spec/lib/listen/adapter/darwin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@
expectations.each do |dir, obj|
allow(obj).to receive(:watch).with(dir.to_s, latency: 0.1)
end
subject.configure
end

describe 'configuration' do
before do
subject.configure
end

context 'with 1 directory' do
let(:directories) { expectations.keys.map { |p| Pathname(p.to_s) } }

Expand Down
10 changes: 5 additions & 5 deletions spec/lib/listen/event/loop_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
it 'sets up the thread in a resumable state' do
subject.setup

expect(subject).to receive(:sleep).with(no_args).ordered
allow(processor).to receive(:loop_for).with(1.234).ordered
expect(subject).to receive(:sleep).with(no_args)
allow(processor).to receive(:loop_for).with(1.234)

blocks[:thread_block].call
end
Expand All @@ -91,8 +91,8 @@
subject.setup

allow(thread).to receive(:wakeup) do
allow(subject).to receive(:sleep).with(no_args).ordered
allow(processor).to receive(:loop_for).with(1.234).ordered
allow(subject).to receive(:sleep).with(no_args)
allow(processor).to receive(:loop_for).with(1.234)
allow(ready).to receive(:<<).with(:ready)
blocks[:thread_block].call
end
Expand Down Expand Up @@ -153,7 +153,7 @@

subject.setup

allow(subject).to receive(:sleep).with(no_args).ordered do
allow(subject).to receive(:sleep).with(no_args) do
allow(processor).to receive(:loop_for).with(1.234)
blocks[:timer_block].call
end
Expand Down
8 changes: 4 additions & 4 deletions spec/lib/listen/event/processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ def status_for_time(time)
it 'sleeps for latency to possibly later optimize some events' do
# pretend we were woken up at 0.6 seconds since start
allow(config).to receive(:sleep).
with(no_args) { |*_args| state[:time] += 0.6 }.ordered
with(no_args) { |*_args| state[:time] += 0.6 }

# pretend we slept for latency (now: 1.6 seconds since start)
allow(config).to receive(:sleep).
with(1.0) { |*_args| state[:time] += 1.0 }.ordered
with(1.0) { |*_args| state[:time] += 1.0 }

subject.loop_for(1)
end
Expand All @@ -123,14 +123,14 @@ def status_for_time(time)
it 'still does not process events because it is paused' do
# pretend we were woken up at 0.6 seconds since start
allow(config).to receive(:sleep).
with(no_args) { |*_args| state[:time] += 2.0 }.ordered
with(no_args) { |*_args| state[:time] += 2.0 }

# second loop starts here (no sleep, coz recent events, but no
# processing coz paused

# pretend we were woken up at 3.6 seconds since start
allow(config).to receive(:sleep).
with(no_args) { |*_args| state[:time] += 3.0 }.ordered
with(no_args) { |*_args| state[:time] += 3.0 }

subject.loop_for(1)
end
Expand Down

0 comments on commit 83bdac8

Please sign in to comment.