Skip to content

Commit 87fe079

Browse files
authored
Merge pull request #17 from voxik/fix-socket-test-on-nested-path
Use `Tempfile` for socket tests
2 parents 2c8e8e6 + 1e7a30c commit 87fe079

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

spec/abrt_handler_spec.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,16 @@
132132

133133
it "because no-one is listeing on the other side" do
134134
# This file is not correct UNIX socket, so it should be usable for the test.
135-
socket_path = __FILE__
136-
expect(abrt).to receive(:abrt_socket).and_wrap_original do |original_method, *args, &block|
137-
args << __FILE__
138-
original_method.call(*args)
135+
require 'tempfile'
136+
Tempfile.create do |tf|
137+
socket_path = tf.path
138+
expect(abrt).to receive(:abrt_socket).and_wrap_original do |original_method, *args, &block|
139+
args << tf.path
140+
original_method.call(*args)
141+
end
142+
expect(syslog).to receive(:err).with("%s", /can't communicate with ABRT daemon, is it running\? Connection refused -( connect\(2\) for)? "?#{socket_path}"?/)
143+
abrt.handle_exception exception
139144
end
140-
expect(syslog).to receive(:err).with("%s", /can't communicate with ABRT daemon, is it running\? Connection refused -( connect\(2\) for)? "?#{socket_path}"?/)
141-
abrt.handle_exception exception
142145
end
143146
end
144147
end

0 commit comments

Comments
 (0)