Sha256: 0a966d07483d41ddd41aa0a711e6e6bc90e0ca0c15a6d69ef07cf008fe79bc84

Contents?: true

Size: 950 Bytes

Versions: 16

Compression:

Stored size: 950 Bytes

Contents

require 'spec_helper'

describe Dragonfly::Whitelist do
  it "matches regexps" do
    whitelist = Dragonfly::Whitelist.new([/platipus/])
    whitelist.include?("platipus").should be_truthy
    whitelist.include?("small platipus in the bath").should be_truthy
    whitelist.include?("baloney").should be_falsey
  end

  it "matches strings" do
    whitelist = Dragonfly::Whitelist.new(["platipus"])
    whitelist.include?("platipus").should be_truthy
    whitelist.include?("small platipus in the bath").should be_falsey
    whitelist.include?("baloney").should be_falsey
  end

  it "only needs one match" do
    Dragonfly::Whitelist.new(%w(a b)).include?("c").should be_falsey
    Dragonfly::Whitelist.new(%w(a b c)).include?("c").should be_truthy
  end

  it "allows pushing" do
    whitelist = Dragonfly::Whitelist.new(["platipus"])
    whitelist.push("duck")
    whitelist.should include "platipus"
    whitelist.should include "duck"
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dragonfly-1.4.1 spec/dragonfly/whitelist_spec.rb
dragonfly-1.4.0 spec/dragonfly/whitelist_spec.rb
dragonfly-1.3.0 spec/dragonfly/whitelist_spec.rb
dragonfly-1.2.1 spec/dragonfly/whitelist_spec.rb
dragonfly-1.2.0 spec/dragonfly/whitelist_spec.rb
dragonfly-1.1.5 spec/dragonfly/whitelist_spec.rb
dragonfly-1.1.4 spec/dragonfly/whitelist_spec.rb
dragonfly-1.1.3 spec/dragonfly/whitelist_spec.rb
dragonfly-1.1.2 spec/dragonfly/whitelist_spec.rb
dragonfly-1.1.1 spec/dragonfly/whitelist_spec.rb
dragonfly-1.1.0 spec/dragonfly/whitelist_spec.rb
dragonfly-1.0.12 spec/dragonfly/whitelist_spec.rb
dragonfly-1.0.11 spec/dragonfly/whitelist_spec.rb
dragonfly-1.0.10 spec/dragonfly/whitelist_spec.rb
dragonfly-1.0.9 spec/dragonfly/whitelist_spec.rb
dragonfly-1.0.8 spec/dragonfly/whitelist_spec.rb