diff --git a/spec/lib/guard/guardfile/generator_spec.rb b/spec/lib/guard/guardfile/generator_spec.rb
index 0e23ee8..7726717 100644
--- a/spec/lib/guard/guardfile/generator_spec.rb
+++ b/spec/lib/guard/guardfile/generator_spec.rb
@@ -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"
@@ -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
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 2eed73d..262c0b8 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -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