Sha256: 96aeaab98815c7a1cb786d63eab0e6279dffb8519c7e9a98b04e080bbe6ad5ce

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: [:a, :b, :c]),
          AnalysedModuleDouble.new(rating: 'A', churn: 3, smells: [:b]),
          AnalysedModuleDouble.new(rating: 'A', churn: 4, smells: [:x, :y]),
          AnalysedModuleDouble.new(rating: 'B', churn: 5, smells: [: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.2.0 test/lib/rubycritic/analysis_summary_test.rb
rubycritic-3.1.3 test/lib/rubycritic/analysis_summary_test.rb
rubycritic-3.1.2 test/lib/rubycritic/analysis_summary_test.rb
rubycritic-3.1.1 test/lib/rubycritic/analysis_summary_test.rb
rubycritic-3.1.0 test/lib/rubycritic/analysis_summary_test.rb