Sha256: ac3d1dcad7a0777ee7401948822891fe06536463c167954fbf284d3763bd8a59

Contents?: true

Size: 727 Bytes

Versions: 2

Compression:

Stored size: 727 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Function, '.rename_attributes' do
  subject { object.rename_attributes(operand, aliases) }

  let(:object)  { described_class                                        }
  let(:header)  { Relation::Header.coerce([[:id, Integer]])              }
  let(:aliases) { Algebra::Rename::Aliases.coerce(header, id: :other_id) }

  context 'with an attribute' do
    let(:operand) { header[:id] }

    it { should == Attribute::Integer.new(:other_id) }
  end

  context 'with a function' do
    let(:operand) { header[:id].eq(1) }

    it { should == Attribute::Integer.new(:other_id).eq(1) }
  end

  context 'with a literal' do
    let(:operand) { 1 }

    it { should == 1 }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-0.2.0 spec/unit/axiom/function/class_methods/rename_attributes_spec.rb
axiom-0.1.1 spec/unit/axiom/function/class_methods/rename_attributes_spec.rb