Sha256: 3d1c59d057861dee8cf6b6263e9d778096de225424e07902f68c7eacac687e5f

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'
module Alf
  describe Lispy, ".run" do

    let(:cities){Relation[
      {:city => "London"},
      {:city => "Paris"},
      {:city => "Athens"}
    ]}

    let(:lispy){ Alf.lispy(Environment.examples) }
    subject{ lispy.run(args).to_rel }

    describe "without any pipe, on a String" do
      let(:args){ "project suppliers -- city" }
      it{ should eq(cities) }
    end

    describe "without any pipe, on an Array" do
      let(:args){ %w{project suppliers -- city} }
      it{ should eq(cities) }
    end

    describe "with alf explicitely" do
      let(:args){ %w{alf project suppliers -- city} }
      it{ should eq(cities) }
    end

    describe "with piped commands" do
      let(:args){ %w{alf project suppliers -- city | alf extend -- upcased city.upcase} }
      it{ should eq(cities.extend(:upcased => lambda{ city.upcase })) }
    end

    describe "with piped commands and a dyadic op" do
      let(:args){ %w{alf project suppliers -- city | alf matching suppliers} }
      it{ should eq(cities) }
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
alf-0.12.2 spec/integration/lispy/test_run.rb
alf-0.12.1 spec/integration/lispy/test_run.rb
alf-0.12.0 spec/integration/lispy/test_run.rb
alf-0.11.1 spec/integration/lispy/test_run.rb
alf-0.11.0 spec/integration/lispy/test_run.rb
alf-0.10.1 spec/unit/lispy/test_run.rb
alf-0.10.0 spec/unit/lispy/test_run.rb