Sha256: 352cb9868bc976c4ee87312581287b0dd8e2f2520811e71f954c18e261faf202

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 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

1 entries across 1 versions & 1 rubygems

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