Sha256: e29b754b74621fa88489319caae5b84ff76f6052be8425417c4501220beb49bc
Contents?: true
Size: 1.67 KB
Versions: 4
Compression:
Stored size: 1.67 KB
Contents
require 'spec_helper' module Alf module Operator::Relational describe Project do let(:operator_class){ Project } it_should_behave_like("An operator class") let(:input) {[ {:a => "a", :b => "b"}, {:a => "a", :b => "b"}, ]} subject{ operator.to_a } describe "when used without --allbut" do let(:expected){[{:a => "a"}]} describe "and factored with commandline args" do let(:operator){ Project.run(["--", 'a']) } before{ operator.pipe(input) } it { should == expected } end describe "and factored with Lispy" do let(:operator){ Lispy.project(input, [:a]) } it { should == expected } end end # --no-allbut describe "when used with --allbut" do let(:expected){[{:b => "b"}]} describe "and factored with commandline args" do let(:operator){ Project.run(['--allbut', '--', 'a']) } before{ operator.pipe(input) } it { should == expected } end describe "and factored with Lispy" do let(:operator){ Lispy.allbut(input, [:a]) } it { should == expected } end end # --allbut describe "when all is projected" do let(:expected){[{}]} describe "when input is not empty" do let(:operator){ Lispy.project(input, []) } it { should == expected } end describe "when input is empty" do let(:operator){ Lispy.project([], []) } it { should == [] } end end # all attributes projected end end end
Version data entries
4 entries across 4 versions & 1 rubygems