Sha256: c52bcb2b8a631d31da0a90e09f92ee3b71fa3688a3c8f0d58a8724d63c385465

Contents?: true

Size: 842 Bytes

Versions: 3

Compression:

Stored size: 842 Bytes

Contents

# encoding: utf-8

describe "Composition" do

  it "& works" do
    blacklist = Selector.new except: /bar/
    whitelist = Selector.new only: /foo/
    selector = whitelist & blacklist

    expect(selector[:foobaz]).to eql(true)
    expect(selector[:foobar]).to eql(false)
  end

  it "- works" do
    whitelist = Selector.new only: /foo/
    blacklist = Selector.new except: /bar/
    selector = whitelist - blacklist

    expect(selector[:foobar]).to eql(true)
    expect(selector[:bar]).to eql(false)
    expect(selector[:foo]).to eql(false)
  end

  it "| works" do
    whitelist = Selector.new only: 4..8
    blacklist = Selector.new except: 1..5
    selector = whitelist | blacklist

    expect(selector[0.5]).to eql(true)
    expect(selector[5.5]).to eql(true)
    expect(selector[2.5]).to eql(false)
  end

end # describe Composition

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
selector-0.0.3 spec/integration/composition_spec.rb
selector-0.0.2 spec/integration/composition_spec.rb
selector-0.0.1 spec/integration/composition_spec.rb