debian-mirror-gitlab/spec/support/helpers/file_mover_helpers.rb

13 lines
392 B
Ruby
Raw Normal View History

2019-03-13 22:55:13 +05:30
# frozen_string_literal: true
module FileMoverHelpers
def stub_file_mover(file_path, stub_real_path: nil)
file_name = File.basename(file_path)
allow(Pathname).to receive(:new).and_call_original
expect_next_instance_of(Pathname, a_string_including(file_name)) do |pathname|
allow(pathname).to receive(:realpath) { stub_real_path || pathname.cleanpath }
end
end
end