Sha256: 497725044d6bdbcaa855e57302f2444ea342da5d77dee42a3c1796989b5cb603

Contents?: true

Size: 938 Bytes

Versions: 8

Compression:

Stored size: 938 Bytes

Contents

require 'spec_helper'

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

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

  it "only needs one match" do
    Dragonfly::Whitelist.new(%w(a b)).include?("c").should be_false
    Dragonfly::Whitelist.new(%w(a b c)).include?("c").should be_true
  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

8 entries across 8 versions & 1 rubygems

Version Path
dragonfly-1.0.7 spec/dragonfly/whitelist_spec.rb
dragonfly-1.0.6 spec/dragonfly/whitelist_spec.rb
dragonfly-1.0.5 spec/dragonfly/whitelist_spec.rb
dragonfly-1.0.4 spec/dragonfly/whitelist_spec.rb
dragonfly-1.0.3 spec/dragonfly/whitelist_spec.rb
dragonfly-1.0.2 spec/dragonfly/whitelist_spec.rb
dragonfly-1.0.1 spec/dragonfly/whitelist_spec.rb
dragonfly-1.0 spec/dragonfly/whitelist_spec.rb