Sha256: 19d78a6c36f9ef9f59102a21f915db2bfb154da5ebe12aa487cc5f79327a509b
Contents?: true
Size: 1.02 KB
Versions: 8
Compression:
Stored size: 1.02 KB
Contents
require 'spidr/rules' require 'spec_helper' describe Rules do it "should accept data based on acceptance data" do rules = Rules.new(:accept => [1]) rules.accept?(1).should == true end it "should accept data based on acceptance regexps" do rules = Rules.new(:accept => [/1/]) rules.accept?('1').should == true end it "should match non-Strings using acceptance regexps" do rules = Rules.new(:accept => [/1/]) rules.accept?(1).should == true end it "should accept data using acceptance lambdas" do rules = Rules.new(:accept => [lambda { |data| data > 2 }]) rules.accept?(3).should == true end it "should reject data that does not match any acceptance patterns" do rules = Rules.new(:accept => [1, 2, 3]) rules.accept?(2).should == true rules.accept?(4).should == false end it "should accept data that does not match any rejection patterns" do rules = Rules.new(:reject => [1, 2, 3]) rules.accept?(2).should == false rules.accept?(4).should == true end end
Version data entries
8 entries across 8 versions & 1 rubygems