Sha256: 77762152ca524aaae7a75ad1e4c0bf9498cdb2ef86df090ec582c4d626277b62

Contents?: true

Size: 1.15 KB

Versions: 65

Compression:

Stored size: 1.15 KB

Contents

require 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

65 entries across 65 versions & 9 rubygems

Version Path
abhay-typhoeus-0.0.22 spec/typhoeus/filter_spec.rb
dbalatero-typhoeus-0.0.20 spec/typhoeus/filter_spec.rb
dbalatero-typhoeus-0.0.21 spec/typhoeus/filter_spec.rb
dbalatero-typhoeus-0.0.22 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.10 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.11 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.12 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.13 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.14 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.15 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.16 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.17 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.18 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.19 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.20 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.22 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.23 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.24 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.0.8 spec/typhoeus/filter_spec.rb
pauldix-typhoeus-0.1.0 spec/typhoeus/filter_spec.rb