Sha256: 9caf2ce12495c3585fd131e0fff4df92eefeac451197619cdac3203ea05a0ce9

Contents?: true

Size: 747 Bytes

Versions: 2

Compression:

Stored size: 747 Bytes

Contents

require 'spec_helper'

describe OrderBy do
  describe '#as_cypher' do
    let(:payload) { instance_spy(Payload) }
    let(:context) { instance_spy(Context) }
    let(:c) { Node('c') }

    it 'formats simple case' do
      ob = OrderBy(c.something)
      expect(ob.as_cypher(payload: payload, context: context)).to eq 'ORDER BY c.something'
    end

    it 'formats multiple elements' do
      ob = OrderBy(c.something, c.other)
      expect(ob.as_cypher(payload: payload, context: context)).to eq 'ORDER BY c.something, c.other'
    end

    it 'formats using :asc/:desc' do
      ob = OrderBy(c.something, :desc, c.other)
      expect(ob.as_cypher(payload: payload, context: context)).to eq 'ORDER BY c.something desc, c.other'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cypher_builder-0.0.5 spec/cypher_builder/order_by_spec.rb
cypher_builder-0.0.4 spec/cypher_builder/order_by_spec.rb