Sha256: 5777b900a8685cefabc14100b7db306d8bcaac786e9fb2fdbf7f1c07ec374f06

Contents?: true

Size: 880 Bytes

Versions: 47

Compression:

Stored size: 880 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe Dataset do
  
  subject{ build(:dataset, source_code: "QUANDL_CLIENT_TEST_SOURCE", data: Quandl::Fabricate::Data.rand(rows: 20, columns: 2) ) }
  
  describe "#from_date" do
    context "before_save" do
      it "should be nil" do
        subject.from_date.should be_nil
      end
    end
    context "after_save" do
      before(:each){ subject.save }
      it "should equal the last date" do
        subject.from_date.should eq subject.data.to_date[-1][0].to_s
      end
    end
  end
  
  describe "#to_date" do
    context "before_save" do
      it "should be nil" do
        subject.to_date.should be_nil
      end
    end
    context "after_save" do
      before(:each){ subject.save }
      it "should equal the first date" do
        subject.to_date.should eq subject.data.to_date[0][0].to_s
      end
    end
  end
  
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
quandl_client-2.13.0 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.12.0 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.11.0 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.10.2 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.10.1 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.10.0 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.9.0 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.8.0 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.7.12 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.7.9 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.7.8 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.7.7 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.7.6 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.7.3 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.7.2 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.7.1 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.7.0 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.6.2 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.6.1 spec/lib/quandl/client/dataset/trim_spec.rb
quandl_client-2.6.0 spec/lib/quandl/client/dataset/trim_spec.rb