Sha256: 4ffbca677fdc2da8af2a76b2fa0f9d96804a5e10a4e3945ff2bd6068e126f0ec

Contents?: true

Size: 759 Bytes

Versions: 4

Compression:

Stored size: 759 Bytes

Contents

require 'spec_helper'
module Alf
  module Lang
    describe ObjectOriented, 'to_rash' do

      include ObjectOriented.new(supplier_names_relation)

      subject{
        to_rash(options).each_line.map do |line|
          ::Kernel.eval(line)
        end
      }

      before do
        subject.should be_a(Array)
        subject.each{|t| t.should be_a(Hash)}
      end

      after do
        Relation(subject).should eq(_self_operand)
      end

      context 'when an ordering is specified' do
        let(:ordering){ [[:name, :desc]] }
        let(:options){ {:sort => ordering} }
        it 'respects it' do
          expected = supplier_names.sort.reverse
          subject.map{|t| t[:name]}.should eq(expected)
        end
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-lang/object_oriented/test_to_rash.rb
alf-core-0.14.0 spec/unit/alf-lang/object_oriented/test_to_rash.rb
alf-core-0.13.1 spec/unit/alf-lang/object_oriented/test_to_rash.rb
alf-core-0.13.0 spec/unit/alf-lang/object_oriented/test_to_rash.rb