Sha256: c72fd699529618e177d3e7cc7c82934d61147ad494ea596cbbc0a25c9dff247c
Contents?: true
Size: 1.08 KB
Versions: 5
Compression:
Stored size: 1.08 KB
Contents
require 'spidr/rules' require 'spec_helper' describe Rules do subject { Rules } it "should accept data based on acceptance data" do rules = subject.new(accept: [1]) expect(rules.accept?(1)).to eq(true) end it "should accept data based on acceptance regexps" do rules = subject.new(accept: [/1/]) expect(rules.accept?('1')).to eq(true) end it "should match non-Strings using acceptance regexps" do rules = subject.new(accept: [/1/]) expect(rules.accept?(1)).to eq(true) end it "should accept data using acceptance lambdas" do rules = subject.new(accept: [lambda { |data| data > 2 }]) expect(rules.accept?(3)).to eq(true) end it "should reject data that does not match any acceptance patterns" do rules = subject.new(accept: [1, 2, 3]) expect(rules.accept?(2)).to eq(true) expect(rules.accept?(4)).to eq(false) end it "should accept data that does not match any rejection patterns" do rules = subject.new(reject: [1, 2, 3]) expect(rules.accept?(2)).to eq(false) expect(rules.accept?(4)).to eq(true) end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
spidr-0.7.1 | spec/rules_spec.rb |
spidr-0.7.0 | spec/rules_spec.rb |
spidr-0.6.1 | spec/rules_spec.rb |
spidr-0.6.0 | spec/rules_spec.rb |
spidr-0.5.0 | spec/rules_spec.rb |