spec/lib/libinput_command_spec.rb in fusuma-2.0.3 vs spec/lib/libinput_command_spec.rb in fusuma-2.0.4
- old
+ new
@@ -3,11 +3,13 @@
require 'spec_helper'
require './lib/fusuma/libinput_command'
module Fusuma
RSpec.describe LibinputCommand do
- let(:libinput_command) { described_class.new(libinput_options: libinput_options, commands: commands) }
+ let(:libinput_command) do
+ described_class.new(libinput_options: libinput_options, commands: commands)
+ end
let(:libinput_options) { [] }
let(:commands) { {} }
describe '#version' do
subject { libinput_command.version }
@@ -77,11 +79,12 @@
after { subject }
before do
dummy_io = StringIO.new('dummy')
io = StringIO.new('dummy output')
- allow(Open3).to receive(:popen3).with(anything).and_return([dummy_io, io, dummy_io, dummy_io, nil])
+ allow(Open3).to receive(:popen3).with(anything).and_return([dummy_io, io, dummy_io,
+ dummy_io, nil])
end
context 'with the alternative command' do
let(:commands) { { list_devices_command: 'dummy_list_devices' } }
@@ -117,20 +120,21 @@
end
describe 'debug_events' do
before do
@dummy_io = StringIO.new('dummy')
- allow(Process).to receive(:spawn).with(anything).and_return(0)
+ allow(Process).to receive(:detach).with(anything).and_return(nil)
end
subject { libinput_command.debug_events(@dummy_io) }
context 'with the alternative command' do
before do
allow(libinput_command).to receive(:debug_events_with_options).and_return 'dummy_debug_events'
end
it 'should call dummy events' do
- expect(Process).to receive(:spawn).with('dummy_debug_events', { out: @dummy_io, in: '/dev/null' }).once
+ expect(Process).to receive(:spawn).with('dummy_debug_events',
+ { out: @dummy_io, in: '/dev/null' }).once
subject
end
end
end