Sha256: f1a87c62264535490b2022cdf8aabc3dd1197f2ca9a759435ce2f05047e29a0d
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Optimizer::Function::Predicate::Enumerable::UnoptimizedOperands, '#optimizable?' do subject { object.optimizable? } let(:attribute) { Attribute::Integer.new(:id) } let(:predicate) { attribute.include(operand) } let(:object) { described_class.new(predicate) } before do expect(predicate).to be_kind_of(Function::Predicate::Enumerable) end context 'when the operand contains an unsorted Enumerable' do let(:operand) { [2, 1] } it { should be(true) } end context 'when the operand contains an exclusive Range' do let(:operand) { 1...3 } it { should be(true) } end context 'when the operand contains an Enumerable after filtering invalid entries' do let(:operand) { ['a', 1, 2] } it { should be(true) } end context 'when the operand contains an Enumerable after filtering duplicate entries' do let(:operand) { [1, 1, 2, 2] } it { should be(true) } end context 'when the operand contains a sorted Enumerable' do let(:operand) { [1, 2] } it { should be(false) } end context 'when the operand contains an inclusive Range' do let(:operand) { 1..2 } it { should be(false) } end end
Version data entries
2 entries across 2 versions & 1 rubygems