Skip to content
Snippets Groups Projects
Unverified Commit f469f515 authored by Jaroslav Prokop's avatar Jaroslav Prokop Committed by Rémy Coutable
Browse files

Stub File.read instead of IO.read in spec.

Ruby 2.6 changed Pathname#read from using IO.read to File.read.
parent fbae74af
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -91,7 +91,7 @@ RSpec.describe Guard::Guardfile::Generator do
let(:template) { File.join(described_class::HOME_TEMPLATES, "/bar") }
 
it "copies the Guardfile template and initializes the Guard" do
expect(IO).to receive(:read)
expect(File).to receive(:read)
.with(template).and_return "Template content"
 
expected = "\nTemplate content\n"
Loading
Loading
@@ -113,7 +113,7 @@ RSpec.describe Guard::Guardfile::Generator do
expect(::Guard::PluginUtil).to receive(:new) { plugin_util }
allow(plugin_util).to receive(:plugin_class) { nil }
path = File.expand_path("~/.guard/templates/foo")
expect(IO).to receive(:read).with(path) do
expect(File).to receive(:read).with(path) do
fail Errno::ENOENT
end
end
Loading
Loading
Loading
Loading
@@ -70,14 +70,14 @@ def stub_file(path, contents = nil, &block)
allow(File).to receive(:exist?).with(path).and_return(exists)
if exists
if block.nil?
allow(IO).to receive(:read).with(path).and_return(contents)
allow(File).to receive(:read).with(path).and_return(contents)
else
allow(IO).to receive(:read).with(path) do
allow(File).to receive(:read).with(path) do
yield
end
end
else
allow(IO).to receive(:read).with(path) do
allow(File).to receive(:read).with(path) do
fail Errno::ENOENT
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment