Sha256: dcee635924c585255475535a9876a295560d8d1e0e2bfb886fdaae52bea7d654

Contents?: true

Size: 858 Bytes

Versions: 15

Compression:

Stored size: 858 Bytes

Contents

require 'test_helper'
require_relative '../lib/sandi_meter/loc_checker'

describe SandiMeter::LOCChecker do
  let(:checker) { SandiMeter::LOCChecker.new([]) }

  describe '#check' do
    context 'for short code' do
      before do
        stub_const('SandiMeter::LOCChecker::MAX_LOC', { 'blah' => 10 })
        checker.stub(:locs_size).and_return(rand(0..10))
      end

      # REFACTOR
      # avoid passing dumb arguments to tested methods
      it 'passes the check' do
        checker.check([1,2,3], 'blah').should be_true
      end
    end

    context 'for large code' do
      before do
        stub_const('SandiMeter::LOCChecker::MAX_LOC', { 'blah' => 10 })
        checker.stub(:locs_size).and_return(rand(11..100))
      end

      it 'does not pass the check' do
        checker.check([1,2,3], 'blah').should be_false
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sandi_meter-1.1.8 spec/loc_checker_spec.rb
sandi_meter-1.1.7 spec/loc_checker_spec.rb
sandi_meter-1.1.6 spec/loc_checker_spec.rb
sandi_meter-1.1.5 spec/loc_checker_spec.rb
sandi_meter-1.0.5 spec/loc_checker_spec.rb
sandi_meter-1.0.4 spec/loc_checker_spec.rb
sandi_meter-1.0.3 spec/loc_checker_spec.rb
sandi_meter-1.0.2 spec/loc_checker_spec.rb
sandi_meter-1.0.1 spec/loc_checker_spec.rb
sandi_meter-1.0.0 spec/loc_checker_spec.rb
sandi_meter-0.0.6 spec/loc_checker_spec.rb
sandi_meter-0.0.5 spec/loc_checker_spec.rb
sandi_meter-0.0.4 spec/loc_checker_spec.rb
sandi_meter-0.0.3 spec/loc_checker_spec.rb
sandi_meter-0.0.2 spec/loc_checker_spec.rb