Sha256: f4543bbb2c3c84e8a0f8884337367cfb16562a7799bc2e517a7c3165c6fdd6a0

Contents?: true

Size: 615 Bytes

Versions: 1

Compression:

Stored size: 615 Bytes

Contents

require 'spec_helper'
require 'i18n/tasks/scanners/files/caching_file_reader'

RSpec.describe 'CachingFileReader' do
  describe '#read_file' do
    around do |ex|
      TestCodebase.setup('test.txt' => 'test')
      TestCodebase.in_test_app_dir { ex.call }
      TestCodebase.teardown
    end
    it 'reads the file only once' do
      caching_file_reader = I18n::Tasks::Scanners::Files::CachingFileReader.new
      expect(caching_file_reader.read_file('test.txt')).to eq('test')
      File.write('test.txt', 'something else')
      expect(caching_file_reader.read_file('test.txt')).to eq('test')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
i18n-tasks-0.9.0.rc1 spec/scanners/files/caching_file_reader_spec.rb