Sha256: fa1c0d7e3d698e313bc504a1f38e99597ecf0c3bce9a9b07bd634bbd2a834a85

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe 'Veritas::Optimizer::Logic::Predicate::LessThanOrEqualTo::AlwaysTrue#optimizable?' do
  subject { object.optimizable? }

  let(:klass)     { Optimizer::Logic::Predicate::LessThanOrEqualTo::AlwaysTrue }
  let(:attribute) { Attribute::Integer.new(:id)                                }
  let(:predicate) { left.lte(right)                                            }
  let(:object)    { klass.new(predicate)                                       }

  before do
    predicate.should be_kind_of(Logic::Predicate::LessThanOrEqualTo)
  end

  context 'when left and right are equal' do
    let(:left)  { attribute }
    let(:right) { attribute }

    it { should be(true) }
  end

  context 'when left and right are different types' do
    let(:left)  { attribute                    }
    let(:right) { Attribute::String.new(:name) }

    it { should be(false) }
  end

  context 'when left is always less than right' do
    let(:left)  { Attribute::Integer.new(:id, :size => 1..9)   }
    let(:right) { Attribute::Integer.new(:id, :size => 10..20) }

    it { should be(true) }
  end

  context 'when left is not equivalent to the right' do
    let(:left)  { attribute                    }
    let(:right) { Attribute::String.new(:name) }

    it { should be(false) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/optimizer/logic/predicate/less_than_or_equal_to/always_true/optimizable_spec.rb