Sha256: ebe4423616ec1055fcf54973ab626521cb1f3583c4af49c5cc515f80cd4e3c12

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require 'test_helper'
require 'rubycritic/analysis_summary'

module RubyCritic
  describe AnalysisSummary do
    before do
      analysed_modules = AnalysedModulesCollectionDouble.new(
        [
          AnalysedModuleDouble.new(rating: 'A', churn: 2, smells: %i[a b c]),
          AnalysedModuleDouble.new(rating: 'A', churn: 3, smells: [:b]),
          AnalysedModuleDouble.new(rating: 'A', churn: 4, smells: %i[x y]),
          AnalysedModuleDouble.new(rating: 'B', churn: 5, smells: %i[a z])
        ]
      )
      @summary = RubyCritic::AnalysisSummary.generate(analysed_modules)
    end

    describe '.root' do
      it 'computes correct summary' do
        @summary['A'].to_a.must_equal({ files: 3, churns: 9, smells: 6 }.to_a)
        @summary['B'].to_a.must_equal({ files: 1, churns: 5, smells: 2 }.to_a)
        @summary['C'].to_a.must_equal({ files: 0, churns: 0, smells: 0 }.to_a)
        @summary['D'].to_a.must_equal({ files: 0, churns: 0, smells: 0 }.to_a)
        @summary['F'].to_a.must_equal({ files: 0, churns: 0, smells: 0 }.to_a)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubycritic-3.4.0 test/lib/rubycritic/analysis_summary_test.rb
rubycritic-3.3.0 test/lib/rubycritic/analysis_summary_test.rb
rubycritic-3.2.3 test/lib/rubycritic/analysis_summary_test.rb
rubycritic-3.2.2 test/lib/rubycritic/analysis_summary_test.rb
rubycritic-3.2.1 test/lib/rubycritic/analysis_summary_test.rb