Sha256: b4c3c6a9991b6037aeac141ce2190b95a8fa74d3413d409d2dab960564a4c3f7

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require "analysers_test_helper"
require "rubycritic/analysers/churn"
require "rubycritic/source_control_systems/base"

describe Rubycritic::Analyser::Churn do
  before do
    @analysed_files = [AnalysedFileDouble.new(:path => "path_to_some_file.rb")]
    @source_control_system = SourceControlSystemDouble.new
  end

  it "calculates the churn of each file and adds it to analysed_files" do
    Rubycritic::Analyser::Churn.new(@analysed_files, @source_control_system).run
    @analysed_files.each do |analysed_file|
      analysed_file.churn.must_equal 1
    end
  end

  it "calculates the date of the last commit of each file and adds it to analysed_files" do
    Rubycritic::Analyser::Churn.new(@analysed_files, @source_control_system).run
    @analysed_files.each do |analysed_file|
      analysed_file.committed_at.must_equal "2013-10-09 12:52:49 +0100"
    end
  end
end

class SourceControlSystemDouble < Rubycritic::SourceControlSystem::Base
  def revisions_count(path)
    1 # churn
  end

  def date_of_last_commit(path)
    "2013-10-09 12:52:49 +0100"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubycritic-1.0.2 test/lib/rubycritic/analysers/churn_test.rb
rubycritic-1.0.1 test/lib/rubycritic/analysers/churn_test.rb
rubycritic-1.0.0 test/lib/rubycritic/analysers/churn_test.rb