Sha256: 782408c4b3a8b6e35bfaee78d814b96a129397959a643a6c1fe4b5c826ba6ce8

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require File.expand_path('../test_helper', File.dirname(__FILE__))

class SvnAnalyzerTest < Test::Unit::TestCase
  
  should "parses logs correctly" do
    svn_analyzer = Churn::SvnAnalyzer.new
    revision     = 'first'
    revisions    = ['first']
    lines        = ["--- a/lib/churn/churn_calculator.rb", "+++ b/lib/churn/churn_calculator.rb", "@@ -18,0 +19 @@ module Churn"]
    svn_analyzer.stubs(:get_updated_files_from_log).returns(lines)
    updated = svn_analyzer.get_updated_files_change_info(revision, revisions)
    expected_hash = {"lib/churn/churn_calculator.rb"=>[18..18, 19..19]}
    assert_equal = updated
  end

  should "run get_logs correctly" do
    svn_analyzer = Churn::SvnAnalyzer.new
    svn_analyzer.expects(:`).returns(svn_output) #`fix syntax hilighting
    assert_equal ["/trunk", "/trunk/test.txt"], svn_analyzer.get_logs
  end

  should "run date range correctly" do
    svn_analyzer = Churn::SvnAnalyzer.new(Date.parse('3/3/2010'))
    assert_equal "--revision {2010-03-03}:{#{Date.today.to_s}}", svn_analyzer.send(:date_range)
  end

  protected

  def svn_output
    "------------------------------------------------------------------------
r1 | danmayer | 2013-09-07 10:45:32 -0400 (Sat, 07 Sep 2013) | 1 line
Changed paths:
   A /trunk
   A /trunk/test.txt

Initial import of project1
------------------------------------------------------------------------"
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
churn-0.0.34 test/unit/svn_analyzer_test.rb