Sha256: 87ba8584e2cc5db5fc970ab543426926a83dd2c049ba2142088b09f5ee1e5fde

Contents?: true

Size: 1000 Bytes

Versions: 2

Compression:

Stored size: 1000 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + "/../../../test_helper")

describe ::Inch::API::Compare::Codebases do
  let(:described_class) { ::Inch::API::Compare::Codebases }

  it "should run" do
    codebase1 = Inch::Codebase.parse fixture_path(:ruby, :diff1)
    codebase2 = Inch::Codebase.parse fixture_path(:ruby, :diff2)

    compare = described_class.new(codebase1, codebase2)
    refute compare.comparisons.empty?

    # Foo#a is added in diff2
    comparison = compare.find("Foo#a")
    assert comparison.added?

    # Foo#b is improved in diff2
    comparison = compare.find("Foo#b")
    assert comparison.present?
    assert comparison.changed?
    assert comparison.improved?

    # Foo#c stayed the same
    comparison = compare.find("Foo#c")
    assert comparison.present?
    assert comparison.unchanged?
    refute comparison.changed?

    # Foo#d is removed in diff2
    comparison = compare.find("Foo#d")
    refute comparison.present?
    assert comparison.removed?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inch-0.5.0.rc5 test/integration/api/compare/codebases.rb
inch-0.5.0.rc4 test/integration/api/compare/codebases.rb