Sha256: d07838f1c35c187dc92243cc5a110706b5d0233f4438cd680a92c009231f4a2b

Contents?: true

Size: 860 Bytes

Versions: 2

Compression:

Stored size: 860 Bytes

Contents

require 'test_helper'
require_relative '../lib/sandi_meter/calculator'
require_relative '../lib/sandi_meter/analyzer'

describe SandiMeter::Calculator do
  let(:analyzer) { SandiMeter::Analyzer.new }
  let(:calculator) { SandiMeter::Calculator.new }

  describe 'line number in details' do
    let(:test_class) { test_file_path(15) }

    before do
      data = analyzer.analyze(test_class)
      calculator.push(data)
    end

    it 'counts class lines' do
      output = calculator.calculate!(true)
      klass = output[:first_rule][:log][:classes].find { |params| params.first == "User" }
      klass[1].should eq(109)
    end

    it 'counts method lines' do
      output = calculator.calculate!(true)
      method_params = output[:second_rule][:log][:methods].find { |method| method[1] == "create" }
      method_params[2].should eq(6)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sandi_meter-1.0.5 spec/calculator_spec.rb
sandi_meter-1.0.4 spec/calculator_spec.rb