Sha256: 4e6006f289f28e0444df4f722bb43afaccdd3321be7f4acfd8247f2c0a4b2959

Contents?: true

Size: 894 Bytes

Versions: 3

Compression:

Stored size: 894 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Yardstick::RuleConfig, '#enabled_for_path?' do
  subject { described_class.new(options).enabled_for_path?(path) }

  let(:options) { {} }

  %w[ Foo::Bar#baz Foo::Bar.baz ].each do |method|
    let(:path) { method }

    context 'when no restrictions' do
      it { should be(true) }
    end

    context 'when disabled' do
      before { options[:enabled] = false }

      it { should be(false) }
    end

    context 'when excluded by exact path' do
      before { options[:exclude] = [path] }

      it { should be(false) }
    end

    context 'when excluded by class or module' do
      before { options[:exclude] = ['Foo::Bar'] }

      it { should be(false) }
    end

    context 'when excluded by superclass or subclass' do
      before { options[:exclude] = ['Foo', 'Foo::Bar::Sub'] }

      it { should be(true) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yardstick-0.9.9 spec/unit/yardstick/rule_config/enabled_for_path_predicate_spec.rb
yardstick-0.9.8 spec/unit/yardstick/rule_config/enabled_for_path_predicate_spec.rb
yardstick-0.9.7 spec/unit/yardstick/rule_config/enabled_for_path_predicate_spec.rb