Skip to content

Commit

Permalink
Fix tests by mocking returned checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
zachfeldman committed Aug 20, 2022
1 parent 52a7a3e commit fe68af5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions spec/erb_lint/cache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@
f.write(cache_file_content)
end

allow(::RuboCop::ConfigLoader).to(receive(:load_file).and_call_original)
allow(::RuboCop::ConfigLoader).to(receive(:read_file).and_return(rubocop_yml))
digest_sha1_double = instance_double(Digest::SHA1)
allow(Digest::SHA1).to(receive(:new).and_return(digest_sha1_double))
allow(digest_sha1_double).to(receive(:hexdigest).and_return(checksum))
allow(digest_sha1_double).to(receive(:update).and_return(true))
allow(digest_sha1_double).to(receive(:file).and_return(true))
end

describe "#get" do
Expand Down Expand Up @@ -127,7 +130,7 @@
)).to(be(true))
end

it "prunes outdated cache results" do
it "prunes unused cache results" do
fakefs_dir = Struct.new(:fakefs_dir)
allow(fakefs_dir).to(receive(:children).and_return([checksum, "fake-checksum"]))
allow(FakeFS::Dir).to(receive(:new).and_return(fakefs_dir))
Expand Down

0 comments on commit fe68af5

Please sign in to comment.