From 0352de0a464f00114c062cb0310585d67b1eef71 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Thu, 22 Feb 2018 11:53:07 +1100 Subject: [PATCH] feat: try opening the file without a lock to see if that's what's causing problem on windows --- spec/mock_service_with_merge_spec.rb | 2 +- spec/support/monkeypatch.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 spec/support/monkeypatch.rb diff --git a/spec/mock_service_with_merge_spec.rb b/spec/mock_service_with_merge_spec.rb index a6a0a37..34d8529 100644 --- a/spec/mock_service_with_merge_spec.rb +++ b/spec/mock_service_with_merge_spec.rb @@ -15,7 +15,7 @@ def logger.debug *args; end end let(:mock_service_options) do - { cli_args: ['--pact-file-write-mode', 'merge'] } + { cli_args: ['--pact-file-write-mode', 'merge', '--monkeypatch', File.absolute_path('spec/support/monkeypatch.rb')] } end let(:first_interaction) do diff --git a/spec/support/monkeypatch.rb b/spec/support/monkeypatch.rb new file mode 100644 index 0000000..4a12f2f --- /dev/null +++ b/spec/support/monkeypatch.rb @@ -0,0 +1,6 @@ +def Filelock(lockname, options = {}, &block) + puts "Opening file without filelock" + File.open(lockname, File::RDWR|File::CREAT, 0644) do |file| + Timeout::timeout(options.fetch(:timeout, 60), Filelock::ExecTimeout) { yield file } + end +end