Sha256: 2236bda557aa4b43be467e72de5b56a9a79ef3a17a3f0a0f2124d9189b214c8b

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Quandl::Format::Dataset do
  subject{ data }
  context "valid.qdf" do
    let(:data){ Quandl::Format::Dataset.load( fixtures_data['valid'] ) }
    
    it{ should be_a Array }
    its(:count){ should eq 3 }
    
    describe "#first" do
      subject{ data.first }
      its(:code){ should eq 'BLAKE_TEST_1' }
      its(:name){ should eq 'A new title' }
      its(:description){ should eq 'The description Date, Open, High'}
      its(:column_names){ should eq ['Date','Open','High','Low','Last','Close','Total Trade Quantity','Turnover (Lacs)']}
      its(:data){ should eq Quandl::Data.new([['2013-11-22','1252.0','454.95','448.2','450.0','450.0','1354405.0','6099.41'],['2013-11-21','452.25','457.75','449.1','451.2','451.0','218881.0','992.94']]) }
    end
  end
  
  context "invalid_data.qdf" do
    let(:data){ Quandl::Format::Dataset.load( fixtures_data['invalid_data'] ) }
    it{ expect{data}.to raise_error Quandl::Operation::Errors::UnknownDateFormat, /Date/ }
  end
  
  context "unknown_attribute.qdf" do
    let(:data){ Quandl::Format::Dataset.load( fixtures_data['unknown_attribute'] ) }
    it{ expect{data}.to raise_error Quandl::Format::Errors::UnknownAttribute, /this_attribute_does_not_exist/ }
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
quandl_format-0.1.1 spec/lib/quandl/format/dataset/errors_spec.rb
quandl_format-0.1.0 spec/lib/quandl/format/dataset/errors_spec.rb