Sha256: f24b6c8a93b2433ebb024325346d9a3317095197627e8812da78929c8c012886

Contents?: true

Size: 900 Bytes

Versions: 2

Compression:

Stored size: 900 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)
      class_params = output[:first_rule][:log][:classes].find { |params| params.first == "User" }
      class_params[1].should eq(109)
    end

    it 'counts method lines' do
      output = calculator.calculate!(true)
      method_params = output[:second_rule][:log][:methods].find { |params| params.first == "User" && params[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.3 spec/calculator_spec.rb
sandi_meter-1.0.2 spec/calculator_spec.rb