spec/unit/veritas/optimizer/algebra/rename/unoptimized_operand/optimizable_spec.rb in veritas-optimizer-0.0.3 vs spec/unit/veritas/optimizer/algebra/rename/unoptimized_operand/optimizable_spec.rb in veritas-optimizer-0.0.4
- old
+ new
@@ -1,42 +1,29 @@
+# encoding: utf-8
+
require 'spec_helper'
describe Optimizer::Algebra::Rename::UnoptimizedOperand, '#optimizable?' do
subject { object.optimizable? }
let(:header) { Relation::Header.new([ [ :id, Integer ] ]) }
let(:base) { Relation.new(header, [ [ 1 ] ].each) }
let(:relation) { operand.rename(aliases) }
+ let(:aliases) { { :id => :other_id } }
let(:object) { described_class.new(relation) }
before do
object.operation.should be_kind_of(Algebra::Rename)
end
- context 'when the operand and aliases are optimizable' do
- let(:aliases) { { :other_id => :another_id } }
- let(:operand) { base.project(header).rename(:id => :other_id) }
+ context 'when the operand is optimizable' do
+ let(:operand) { base.rename({}) }
it { should be(true) }
end
- context 'when the operand is optimizable, but the aliases are not optimizable' do
- let(:aliases) { { :id => :other_id } }
- let(:operand) { base.project(header) }
-
- it { should be(true) }
- end
-
- context 'when the operand is not optimizable, but the aliases are optimizable' do
- let(:aliases) { { :other_id => :another_id } }
- let(:operand) { base.rename(:id => :other_id) }
-
- it { should be(true) }
- end
-
- context 'when the operand and aliases are not optimizable' do
- let(:aliases) { { :id => :other_id } }
- let(:operand) { base }
+ context 'when the operand is not optimizable' do
+ let(:operand) { base }
it { should be(false) }
end
end