Sha256: e272723fccf701ad9f2aef30efa345d1bcdc6429de7ece2e0d7bc0fea291cd9d

Contents?: true

Size: 724 Bytes

Versions: 3

Compression:

Stored size: 724 Bytes

Contents

require 'spec_helper'

describe RuboCop::Cop::Mirego::ReceiveCounts do
  let(:cop) { RuboCop::Cop::Mirego::ReceiveCounts.new }

  before { inspect_source(cop, source) }

  describe 'with a receive having a count' do
    let(:source) { 'expect(object).to receive(:test).once' }

    it { expect(cop.offenses.size).to eql(0) }
  end

  describe 'with an allow' do
    let(:source) { 'allow(object).to receive(:test)' }

    it { expect(cop.offenses.size).to eql(0) }
  end

  describe 'with a receive missing a count' do
    let(:source) { 'expect(object).to receive(:test)' }

    specify do
      expect(cop.offenses.size).to eql(1)
      expect(cop.offenses.first.cop_name).to eql('Mirego/ReceiveCounts')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-mirego-0.1 spec/rubocop/cop/mirego/receive_counts_spec.rb
rubocop-mirego-0.0.4 spec/rubocop/cop/mirego/receive_counts_spec.rb
rubocop-mirego-0.0.3 spec/rubocop/cop/mirego/receive_counts_spec.rb