Sha256: 50c4a7015d954e2bdcc3c46657eca9af555de198499ad8327a045171b4bdaf5d

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Function::Predicate::GreaterThanOrEqualTo::Contradiction, '#optimizable?' do
  subject { object.optimizable? }

  let(:attribute) { Attribute::Integer.new(:id)    }
  let(:predicate) { left.gte(right)                }
  let(:object)    { described_class.new(predicate) }

  before do
    predicate.should be_kind_of(Function::Predicate::GreaterThanOrEqualTo)
  end

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

    it { should be(false) }
  end

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

    it { should be(true) }
  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 equivalent to the right' do
    let(:left)  { Attribute::Integer.new(:id) }
    let(:right) { Attribute::Integer.new(:id) }

    it { should be(false) }
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
axiom-optimizer-0.1.0 spec/unit/axiom/optimizer/function/predicate/greater_than_or_equal_to/contradiction/optimizable_predicate_spec.rb
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/function/predicate/greater_than_or_equal_to/contradiction/optimizable_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/function/predicate/greater_than_or_equal_to/contradiction/optimizable_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/function/predicate/greater_than_or_equal_to/contradiction/optimizable_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/function/predicate/greater_than_or_equal_to/contradiction/optimizable_spec.rb