Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings in spec output #464

Merged
merged 2 commits into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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