Sha256: 246778c3a71c10c3971130e6c0dd98289166f95408935506841b53fe5e7efa34

Contents?: true

Size: 1.48 KB

Versions: 6

Compression:

Stored size: 1.48 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 }
  
      describe "without providing an attribute name" do
        
        let(:expected){[
          {:a => "a", :autonum => 0},
          {:a => "b", :autonum => 1},
          {:a => "a", :autonum => 2},
        ]}
    
        describe "When factored with Lispy" do 
          let(:operator){ Lispy.autonum(input) }
          it{ should == expected }
        end
    
        describe "When factored from commandline args" do
          let(:operator){ Autonum.run([]) }
          before{ operator.pipe(input) }
          it{ should == expected }
        end
  
      end
      
      describe "when providing an attribute name" do
        
        let(:expected){[
          {:a => "a", :unique => 0},
          {:a => "b", :unique => 1},
          {:a => "a", :unique => 2},
        ]}
    
        describe "When factored with Lispy" do 
          let(:operator){ Lispy.autonum(input, :unique) }
          it{ should == expected }
        end
    
        describe "When factored from commandline args" do
          let(:operator){ Autonum.run(["--", "unique"]) }
          before{ operator.pipe(input) }
          it{ should == expected }
        end
  
      end
      
    end 
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
alf-0.10.1 spec/unit/operator/non_relational/test_autonum.rb
alf-0.10.0 spec/unit/operator/non_relational/test_autonum.rb
alf-0.9.3 spec/unit/operator/non_relational/test_autonum.rb
alf-0.9.2 spec/unit/operator/non_relational/test_autonum.rb
alf-0.9.1 spec/unit/operator/non_relational/test_autonum.rb
alf-0.9.0 spec/operator/non_relational/autonum_spec.rb