Sha256: df01c3199487b4ebdcaf758d03232d8cc2e17829c40998875ec759a659d05c2e

Contents?: true

Size: 787 Bytes

Versions: 2

Compression:

Stored size: 787 Bytes

Contents

describe RuboCop::RSpec::Language::SelectorSet do
  subject(:selector_set) { described_class.new(%i(foo bar)) }

  it 'composes sets' do
    combined = selector_set + described_class.new(%i(baz))

    expect(combined).to eq(described_class.new(%i(foo bar baz)))
  end

  it 'compares by value' do
    expect(selector_set).not_to eq(described_class.new(%i(foo bar baz)))
  end

  context '#include?' do
    it 'returns false for selectors not in the set' do
      expect(selector_set.include?(:baz)).to be(false)
    end

    it 'returns true for selectors in the set' do
      expect(selector_set.include?(:foo)).to be(true)
    end
  end

  context '#to_node_pattern' do
    it 'builds a node pattern' do
      expect(selector_set.to_node_pattern).to eql(':foo :bar')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-rspec-1.8.0 spec/rubocop/rspec/language/selector_set_spec.rb
rubocop-rspec-1.7.0 spec/rubocop/rspec/language/selector_set_spec.rb