Sha256: 5ae1b28e91a49915a30a5e21d5b1d80dbcd57307efbbf27d85361862229c4fd0

Contents?: true

Size: 861 Bytes

Versions: 2

Compression:

Stored size: 861 Bytes

Contents

require 'spec_helper'
module Alf
  module Operator::NonRelational
    describe Coerce do
  
      let(:operator_class){ Coerce }
      it_should_behave_like("An operator class")
        
      let(:input) {Alf::Relation[
        {:a => "12", :b => "14.0"},
      ]}
  
      subject{ operator.to_rel }
  
      describe "When used without --strict" do
        let(:expected){Alf::Relation[
          {:a => 12, :b => 14.0}
        ]}
        
        describe "when factored from commandline" do
          let(:operator){ Coerce.run(%w{-- a Integer b Float}) }
          before{ operator.pipe(input) }
          it { should == expected } 
        end
  
        describe "when factored with Lispy" do
          let(:operator){ Lispy.coerce(input, :a => Integer, :b => Float) }
          it { should == expected } 
        end
  
      end
  
    end 
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alf-0.10.1 spec/unit/operator/non_relational/test_coerce.rb
alf-0.10.0 spec/unit/operator/non_relational/test_coerce.rb