Sha256: eb6ccdac79284983ac8353b233abf06a899ce640faed529c9d98b867624b5805

Contents?: true

Size: 970 Bytes

Versions: 4

Compression:

Stored size: 970 Bytes

Contents

require 'spec_helper'

require 'method_log/source_file'

describe MethodLog::SourceFile do
  it 'is equal to another source file with same path and source' do
    file_one = MethodLog::SourceFile.new(path: 'path/to/source.rb', source: 'source-one')
    file_two = MethodLog::SourceFile.new(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 = MethodLog::SourceFile.new(path: 'path/to/source.rb', source: 'source-one')
    file_two = MethodLog::SourceFile.new(path: 'path/to/source.rb', source: 'source-one')

    expect(file_one.hash).to eq(file_two.hash)
  end

  it 'describes source file' do
    file = MethodLog::SourceFile.new(path: 'path/to/source.rb', source: %{
class Foo
  def bar
    # implementation
  end
end
    }.strip)

    expect(file.snippet(1..3).strip).to eq(%{
  def bar
    # implementation
  end
    }.strip)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
method_log-0.0.4 spec/source_file_spec.rb
method_log-0.0.3 spec/source_file_spec.rb
method_log-0.0.2 spec/source_file_spec.rb
method_log-0.0.1 spec/source_file_spec.rb