Sha256: 0ae7a832aa9efcac169fd9c3fd990eba447410f4c4e63231fad6cc48a9e92048

Contents?: true

Size: 766 Bytes

Versions: 1

Compression:

Stored size: 766 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Rubocop::Cop::Force do
  subject(:force) { Rubocop::Cop::Force.new(cops) }
  let(:cops) { [double('cop1'), double('cop2')] }

  describe '.force_name' do
    it 'returns the class name without namespace' do
      expect(Rubocop::Cop::VariableForce.force_name).to eq('VariableForce')
    end
  end

  describe '#run_hook' do
    it 'invokes a hook in all cops' do
      cops.each do |cop|
        expect(cop).to receive(:some_hook).with(:foo, :bar)
      end

      force.run_hook(:some_hook, :foo, :bar)
    end

    it 'does not invoke a hook if the cop does not respond to the hook' do
      expect(cops.last).to receive(:some_hook).with(:foo, :bar)
      force.run_hook(:some_hook, :foo, :bar)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-0.21.0 spec/rubocop/cop/force_spec.rb