diff --git a/spec/unit/mutant/cache_spec.rb b/spec/unit/mutant/cache_spec.rb new file mode 100644 index 00000000..fd20514d --- /dev/null +++ b/spec/unit/mutant/cache_spec.rb @@ -0,0 +1,22 @@ +RSpec.describe Mutant::Cache do + let(:object) { described_class.new } + + describe '#parse' do + let(:path) { double('Path') } + + subject { object.parse(path) } + + before do + allow(File).to receive(:read).with(path).and_return(':source') + end + + it 'returns parsed source' do + expect(subject).to eql(s(:sym, :source)) + end + + it 'returns cached parsed source' do + source = object.parse(path) + expect(subject).to be(source) + end + end +end