Sha256: 1433dada564ed000aebb02a3d4847caf3ca85a9232ecc30f0dc3ec539c586c58

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'
module Alf
  module Operator::NonRelational
    describe Generator do

      let(:operator_class){ Generator }
      it_should_behave_like("An operator class")

      subject{ operator.to_rel }

      context "empty args" do
        let(:expected){Relation[
          {:num => 1},
          {:num => 2},
          {:num => 3},
          {:num => 4},
          {:num => 5},
          {:num => 6},
          {:num => 7},
          {:num => 8},
          {:num => 9},
          {:num => 10},
        ]}

        context "with Lispy" do 
          let(:operator){ Lispy.generator() }
          it{ should == expected }
        end

      end # empty args

      context "with a size" do
        let(:expected){Relation[
          {:num => 1},
          {:num => 2},
        ]}

        context "When factored with Lispy" do 
          let(:operator){ Lispy.generator(2) }
          it{ should == expected }
        end

      end # with a size

      context "when providing a size and a name" do
        let(:expected){Relation[
          {:id => 1},
          {:id => 2},
        ]}

        context "When factored with Lispy" do 
          let(:operator){ Lispy.generator(2, :id) }
          it{ should == expected }
        end

      end # size and name

    end 
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-0.12.2 spec/unit/alf-core/operator/non_relational/test_generator.rb
alf-0.12.1 spec/unit/alf-core/operator/non_relational/test_generator.rb
alf-0.12.0 spec/unit/alf-core/operator/non_relational/test_generator.rb
alf-0.11.1 spec/unit/alf-core/operator/non_relational/test_generator.rb
alf-0.11.0 spec/unit/alf-core/operator/non_relational/test_generator.rb