Sha256: 5cc3591cadd8ff183296068a3655447ef2acd96b9f03643f4f740df3cd0763eb

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

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

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

      let(:input) {[
        {:a => "a"},
        {:a => "b"},
        {:a => "a"},
      ]}

      subject{ operator.to_a }

      context "with default attribute name" do

        let(:expected){[
          {:a => "a", :autonum => 0},
          {:a => "b", :autonum => 1},
          {:a => "a", :autonum => 2},
        ]}

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

      end # default attribute name

      context "with explicit attribute name" do
        let(:expected){[
          {:a => "a", :unique => 0},
          {:a => "b", :unique => 1},
          {:a => "a", :unique => 2},
        ]}

        context "with Lispy" do 
          let(:operator){ Lispy.autonum(input, :unique) }
          it{ should == expected }
        end

      end # explicit attribute 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_autonum.rb
alf-0.12.1 spec/unit/alf-core/operator/non_relational/test_autonum.rb
alf-0.12.0 spec/unit/alf-core/operator/non_relational/test_autonum.rb
alf-0.11.1 spec/unit/alf-core/operator/non_relational/test_autonum.rb
alf-0.11.0 spec/unit/alf-core/operator/non_relational/test_autonum.rb