Sha256: df9e26a2f924f6e1d533aac0097db563210ac9a2fcb8e4d33ab7fb33071138b3

Contents?: true

Size: 1009 Bytes

Versions: 4

Compression:

Stored size: 1009 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe Quandl::Data::Enumerator do

  let(:data){ Quandl::Fabricate::Data.rand( nils: false, rows: 4, columns: 4 ) }
  subject { data }

  its(:to_h){ should be_a Hash }
  its(:count){ should eq 4 }

  describe "#==" do
    it{ should eq data.to_a }
  end

  [nil, :to_jd, :to_date].each do |date_format|
    [nil, :to_a, :to_csv].each do |format|
      describe ".new(data.#{date_format}.#{format})" do
        let(:raw){
          raw = data
          raw = raw.send(date_format) if date_format.present?
          raw = raw.send(format) if format.present?
          raw
        }
        subject{ Quandl::Data.new(raw.clone) }
        
        it "subject.to_jd.first.first" do
          # binding.pry if date_format == nil && format == :to_csv
          puts subject.to_jd.first.first
        end
        
        its('to_jd.first.first'){ should be_a Integer }
        its('to_date.first.first'){ should be_a Date }
        
      end
      
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
quandl_data-1.5.1 spec/lib/quandl/data/enumerator_spec.rb
quandl_data-1.5.0 spec/lib/quandl/data/enumerator_spec.rb
quandl_data-1.4.1 spec/lib/quandl/data/enumerator_spec.rb
quandl_data-1.4.0 spec/lib/quandl/data/enumerator_spec.rb