Sha256: 2ecc4e28cc907af7f057c8681613cb741e4aa3c360795629cddb10e872a390ce

Contents?: true

Size: 1.17 KB

Versions: 14

Compression:

Stored size: 1.17 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Typhoeus::Filter do
  it "should take a method name and optionally take options" do
    filter = Typhoeus::Filter.new(:bar, :only => :foo)
    filter = Typhoeus::Filter.new(:bar)
  end
  
  describe "#apply_filter?" do
    it "should return true for any method when :only and :except aren't specified" do
      filter = Typhoeus::Filter.new(:bar)
      filter.apply_filter?(:asdf).should be_true
    end
    
    it "should return true if a method is in only" do
      filter = Typhoeus::Filter.new(:bar, :only => :foo)
      filter.apply_filter?(:foo).should be_true
    end
    
    it "should return false if a method isn't in only" do
      filter = Typhoeus::Filter.new(:bar, :only => :foo)
      filter.apply_filter?(:bar).should be_false
    end
    
    it "should return true if a method isn't in except" do
      filter = Typhoeus::Filter.new(:bar, :except => :foo)
      filter.apply_filter?(:bar).should be_true
    end
    
    it "should return false if a method is in except" do
      filter = Typhoeus::Filter.new(:bar, :except => :foo)
      filter.apply_filter?(:foo).should be_false
    end
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
marnen-typhoeus-0.3.7 spec/typhoeus/filter_spec.rb
marnen-typhoeus-0.3.6 spec/typhoeus/filter_spec.rb
marnen-typhoeus-0.3.5 spec/typhoeus/filter_spec.rb
marnen-typhoeus-0.3.4 spec/typhoeus/filter_spec.rb
typhoeus-0.3.3 spec/typhoeus/filter_spec.rb
typhoeus-0.3.2 spec/typhoeus/filter_spec.rb
xenda-typhoeus-0.2.4 spec/typhoeus/filter_spec.rb
typhoeus-0.2.4 spec/typhoeus/filter_spec.rb
typhoeus-0.2.3 spec/typhoeus/filter_spec.rb
arachni-typhoeus-0.2.0.2 spec/typhoeus/filter_spec.rb
typhoeus-0.2.2 spec/typhoeus/filter_spec.rb
arachni-typhoeus-0.2.0.1 spec/typhoeus/filter_spec.rb
arachni-typhoeus-0.2.0 spec/typhoeus/filter_spec.rb
typhoeus-0.2.1 spec/typhoeus/filter_spec.rb