Sha256: fb9a0e07cb3dea395eb133cf19b74702ad4d57be179081abaa596fe3a4b88f39

Contents?: true

Size: 1.41 KB

Versions: 35

Compression:

Stored size: 1.41 KB

Contents

require 'spec_helper'

shared_examples_for '#map' do
  describe 'simple element route' do
    subject do
      c = 0
      source.map { c += 1 }
    end
    its(:first) { should == 1 }
    its(:element_type) { should == :object }
  end

  describe 'with extensions' do
    let(:extended) { source.add_extensions([Tackle::SimpleMixin]) }

    subject { extended.map { |v| v.extensions } }

    its(:first) { should == [Tackle::SimpleMixin] }
    its(:element_type) { should == :object }

    context 'with vertex result type' do
      subject { extended.map(element_type: :vertex) { |v| v } }
      its(:element_type) { should == :vertex }
      its(:extensions) { should == [] }
    end

    context 'with extended vertex result type' do
      let(:exts) { [] }
      subject { extended.map(element_type: :vertex, extensions: TP::Person) { |v| exts << v.extensions; v } }
      its(:element_type) { should == :vertex }
      its(:extensions) { should == [TP::Person] }
      it 'should use the source - not the result - extension in the block' do
        v = subject.first
        v.extensions.should == [TP::Person]
        exts.first.should == [Tackle::SimpleMixin]
      end
    end
  end
end

Run.tg :read_only do
  use_pacer_graphml_data :read_only

  context 'on route' do
    it_uses '#map' do
      let(:source) { graph.v }
    end
  end

  context 'on element' do
    it_uses '#map' do
      let(:source) { pangloss }
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
pacer-2.0.24-java spec/pacer/transform/map_spec.rb
pacer-2.0.22-java spec/pacer/transform/map_spec.rb
pacer-2.0.20-java spec/pacer/transform/map_spec.rb
pacer-2.0.19-java spec/pacer/transform/map_spec.rb
pacer-2.0.18-java spec/pacer/transform/map_spec.rb
pacer-2.0.17-java spec/pacer/transform/map_spec.rb
pacer-2.0.16-java spec/pacer/transform/map_spec.rb
pacer-2.0.15-java spec/pacer/transform/map_spec.rb
pacer-2.0.14-java spec/pacer/transform/map_spec.rb
pacer-2.0.13-java spec/pacer/transform/map_spec.rb
pacer-2.0.12-java spec/pacer/transform/map_spec.rb
pacer-2.0.10-java spec/pacer/transform/map_spec.rb
pacer-2.0.10.pre-java spec/pacer/transform/map_spec.rb
pacer-2.0.8-java spec/pacer/transform/map_spec.rb
pacer-2.0.6-java spec/pacer/transform/map_spec.rb
pacer-2.0.4.pre-java spec/pacer/transform/map_spec.rb
pacer-2.0.0.pre-java spec/pacer/transform/map_spec.rb
pacer-1.6.0-java spec/pacer/transform/map_spec.rb
pacer-1.5.4-java spec/pacer/transform/map_spec.rb
pacer-1.5.3-java spec/pacer/transform/map_spec.rb