Sha256: 5841d487ea59d8a7d4e103a8a518817e0211330665b9e0b965ce5714698906cf

Contents?: true

Size: 986 Bytes

Versions: 4

Compression:

Stored size: 986 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(:diff1)
    codebase2 = Inch::Codebase.parse fixture_path(: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

4 entries across 4 versions & 1 rubygems

Version Path
inch-0.4.10 test/integration/api/compare/codebases.rb
inch-0.4.9 test/integration/api/compare/codebases.rb
inch-0.4.8 test/integration/api/compare/codebases.rb
inch-0.4.7 test/integration/api/compare/codebases.rb