Sha256: 24ef6ea2cc0996afbcf5fc569e4604bc41aeca82beeff809cbff574458baf337

Contents?: true

Size: 798 Bytes

Versions: 1

Compression:

Stored size: 798 Bytes

Contents

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

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

  describe '#check' do
    context 'for short code' do
      before do
        stub_const('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('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

1 entries across 1 versions & 1 rubygems

Version Path
sandi_meter-0.0.1 spec/loc_checker_spec.rb