diff options
Diffstat (limited to 'spec/lib/gitlab_spec.rb')
-rw-r--r-- | spec/lib/gitlab_spec.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/spec/lib/gitlab_spec.rb b/spec/lib/gitlab_spec.rb index 7c2758bf27e..eaab39291b2 100644 --- a/spec/lib/gitlab_spec.rb +++ b/spec/lib/gitlab_spec.rb @@ -26,18 +26,17 @@ RSpec.describe Gitlab do end it 'returns the actual Git revision' do - expect(File).to receive(:read) - .with(described_class.root.join('REVISION')) - .and_return("abc123\n") + expect_file_read(described_class.root.join('REVISION'), content: "abc123\n") expect(described_class.revision).to eq('abc123') end it 'memoizes the revision' do + stub_file_read(described_class.root.join('REVISION'), content: "abc123\n") + expect(File).to receive(:read) - .once - .with(described_class.root.join('REVISION')) - .and_return("abc123\n") + .once + .with(described_class.root.join('REVISION')) 2.times { described_class.revision } end |