Sha256: efd6ea4e4c6a289b26e5e91f50173f97fa7a671ad72e1d1ef4682836a2d58f9d
Contents?: true
Size: 1.36 KB
Versions: 4
Compression:
Stored size: 1.36 KB
Contents
require 'spec_helper' require 'method_log/source_file' module MethodLog describe SourceFile do let(:sha) { 'b54d38bbd989f4b54c38fd77767d89d1' } let(:repository) { double(:repository) } let(:blob) { double(:blob, text: 'source') } it 'is equal to another source file with same path and source' do file_one = source(path: 'path/to/source.rb', source: 'source-one') file_two = source(path: 'path/to/source.rb', source: 'source-one') expect(file_one).to eq(file_two) end it 'has same hash as another source file with same path and source' do file_one = source(path: 'path/to/source.rb', source: 'source-one') file_two = source(path: 'path/to/source.rb', source: 'source-one') expect(file_one.hash).to eq(file_two.hash) end it 'describes source file' do file = source(path: 'path/to/source.rb', source: unindent(%{ class Foo def bar # implementation end end })) expect(file.snippet(1..3)).to eq(indent(unindent(%{ def bar # implementation end }))) end it 'looks up source in repository using SHA if no source set' do repository.stub(:lookup).with(sha).and_return(blob) file = source(path: 'path/to/source.rb', repository: repository, sha: sha) expect(file.source).to eq('source') end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
method_log-0.1.1 | spec/source_file_spec.rb |
method_log-0.1.0 | spec/source_file_spec.rb |
method_log-0.0.7 | spec/source_file_spec.rb |
method_log-0.0.6 | spec/source_file_spec.rb |