Sha256: 7dcabf0a48199a5fd26558c331121959ff09de130b4cf580a12611a6929c169b

Contents?: true

Size: 1.39 KB

Versions: 7

Compression:

Stored size: 1.39 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Quandl::Format::Dataset do
    
  let(:file_path){ 'spec/fixtures/data/' }
  let(:file){ File.open( File.join(file_path, self.class.superclass.description + '.qdf')) }
  let(:output){
    output = []
    Quandl::Format::Dataset.each_line( file ){|r,e| output << OpenStruct.new( record: r, error: e ) }
    output
  }
  subject{ output.first }
  
  context "unknown_attribute" do
    its(:record){ should be_nil }
    its("error.to_s"){ should match /this_attribute_does_not_exist/ }
  end

  context "invalid_yaml" do
    its(:record){ should be_nil }
    its("error.to_s"){ should match /Could not find expected ':'/ }
  end

  context "illegal_dash" do
    its(:record){ should be_nil }
    its("error.to_s"){ should match /Could not find expected ':'/ }
  end

  context "missing_dashes" do
    subject{ output[2] }
    its(:record){ should be_nil }
    its("error.to_s"){ should match /Could not find expected ':' on line 22/ }
  end

  context "missing_colon" do
    its(:record){ should be_nil }
    its("error.to_s"){ should match /Did you forget a colon on this line/ }
  end

  context "missing_colon2" do
    its(:record){ should be_nil }
    its("error.to_s"){ should match /Could not find expected ':' on line 3/ }
  end

  context "missing_space" do
    its(:record){ should be_nil }
    its("error.to_s"){ should match /Are you missing a colon/ }
  end
 
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
quandl_format-0.5.1 spec/lib/quandl/format/dataset/load/errors_spec.rb
quandl_format-0.5.0 spec/lib/quandl/format/dataset/load/errors_spec.rb
quandl_format-0.4.3 spec/lib/quandl/format/dataset/load/errors_spec.rb
quandl_format-0.4.2 spec/lib/quandl/format/dataset/load/errors_spec.rb
quandl_format-0.4.1 spec/lib/quandl/format/dataset/load/errors_spec.rb
quandl_format-0.4.0 spec/lib/quandl/format/dataset/load/errors_spec.rb
quandl_format-0.3.0 spec/lib/quandl/format/dataset/load/errors_spec.rb