Sha256: 342a86383911e6fed27a50a5b879d2019f5d0b3ae8f21b495234b925481a48f5
Contents?: true
Size: 1.84 KB
Versions: 1
Compression:
Stored size: 1.84 KB
Contents
require 'spec_helper' Filter = DumpRake::Env::Filter describe Filter do it 'should pass everything if initialized with nil' do filter = Filter.new(nil) expect(filter.pass?('a')).to be_truthy expect(filter.pass?('b')).to be_truthy expect(filter.pass?('c')).to be_truthy expect(filter.pass?('d')).to be_truthy end it 'should pass only specified values' do filter = Filter.new('a,c') expect(filter.pass?('a')).to be_truthy expect(filter.pass?('b')).to be_falsey expect(filter.pass?('c')).to be_truthy expect(filter.pass?('d')).to be_falsey end it 'should not pass anything if initialized empty' do filter = Filter.new('') expect(filter.pass?('a')).to be_falsey expect(filter.pass?('b')).to be_falsey expect(filter.pass?('c')).to be_falsey expect(filter.pass?('d')).to be_falsey end describe 'when initialized with -' do it 'should pass everything except specified values' do filter = Filter.new('-a,c') expect(filter.pass?('a')).to be_falsey expect(filter.pass?('b')).to be_truthy expect(filter.pass?('c')).to be_falsey expect(filter.pass?('d')).to be_truthy end it 'should pass everything if initialized empty' do filter = Filter.new('-') expect(filter.pass?('a')).to be_truthy expect(filter.pass?('b')).to be_truthy expect(filter.pass?('c')).to be_truthy expect(filter.pass?('d')).to be_truthy end end describe 'custom_pass?' do it 'should pass only when any call to block returns true' do filter = Filter.new('a,c') expect(filter.custom_pass?{ |value| value == 'a' }).to be_truthy expect(filter.custom_pass?{ |value| value == 'b' }).to be_falsey expect(filter.custom_pass?{ |value| value == 'c' }).to be_truthy expect(filter.custom_pass?{ |value| value == 'd' }).to be_falsey end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dump-1.0.5 | spec/lib/dump_rake/env/filter_spec.rb |