Skip to content

Commit fe68af5

Browse files
committed
Fix tests by mocking returned checksum
1 parent 52a7a3e commit fe68af5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

spec/erb_lint/cache_spec.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@
4242
f.write(cache_file_content)
4343
end
4444

45-
allow(::RuboCop::ConfigLoader).to(receive(:load_file).and_call_original)
46-
allow(::RuboCop::ConfigLoader).to(receive(:read_file).and_return(rubocop_yml))
45+
digest_sha1_double = instance_double(Digest::SHA1)
46+
allow(Digest::SHA1).to(receive(:new).and_return(digest_sha1_double))
47+
allow(digest_sha1_double).to(receive(:hexdigest).and_return(checksum))
48+
allow(digest_sha1_double).to(receive(:update).and_return(true))
49+
allow(digest_sha1_double).to(receive(:file).and_return(true))
4750
end
4851

4952
describe "#get" do
@@ -127,7 +130,7 @@
127130
)).to(be(true))
128131
end
129132

130-
it "prunes outdated cache results" do
133+
it "prunes unused cache results" do
131134
fakefs_dir = Struct.new(:fakefs_dir)
132135
allow(fakefs_dir).to(receive(:children).and_return([checksum, "fake-checksum"]))
133136
allow(FakeFS::Dir).to(receive(:new).and_return(fakefs_dir))

0 commit comments

Comments
 (0)