Sha256: 2deec253de5a49a6b706069336ddb6063eee9f711fda5f657caaa24fb7f2e535

Contents?: true

Size: 1010 Bytes

Versions: 20

Compression:

Stored size: 1010 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe Source do
  
  let(:source){ build(:source) }
  
  context "without token" do
        
    before(:all){ Quandl::Client.token = '' }
    
    subject{ source }

    its(:valid?){ should be_true }
    
    describe "#save" do
      
      it "should not be authorized to create a source" do
        source.save
        source.status.should eq 401
      end
      
    end
    
  end
  
  context "with token" do

    before(:all){ Quandl::Client.token = ENV['QUANDL_AUTH_TOKEN'] }
    
    describe "#save" do
      
      it "should save the source" do
        source.save
        source.status.should eq 201
      end
      
      it "should update the source" do
        source.save
        retrieved_source = Source.find(source.id)
        retrieved_source.description = "something new #{Time.now}"
        retrieved_source.save
        Source.find(source.id).description.should eq retrieved_source.description
      end
      
    end
    
  end
  
  
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
quandl_client-2.7.3 spec/lib/quandl/client/source_spec.rb
quandl_client-2.7.2 spec/lib/quandl/client/source_spec.rb
quandl_client-2.7.1 spec/lib/quandl/client/source_spec.rb
quandl_client-2.7.0 spec/lib/quandl/client/source_spec.rb
quandl_client-2.6.2 spec/lib/quandl/client/source_spec.rb
quandl_client-2.6.1 spec/lib/quandl/client/source_spec.rb
quandl_client-2.6.0 spec/lib/quandl/client/source_spec.rb
quandl_client-2.5.3 spec/lib/quandl/client/source_spec.rb
quandl_client-2.5.2 spec/lib/quandl/client/source_spec.rb
quandl_client-2.5.1 spec/lib/quandl/client/source_spec.rb
quandl_client-2.5.0 spec/lib/quandl/client/source_spec.rb
quandl_client-2.4.9 spec/lib/quandl/client/source_spec.rb
quandl_client-2.4.8 spec/lib/quandl/client/source_spec.rb
quandl_client-2.4.7 spec/lib/quandl/client/source_spec.rb
quandl_client-2.4.6 spec/lib/quandl/client/source_spec.rb
quandl_client-2.4.5 spec/lib/quandl/client/source_spec.rb
quandl_client-2.4.4 spec/lib/quandl/client/source_spec.rb
quandl_client-2.4.3 spec/lib/quandl/client/source_spec.rb
quandl_client-2.4.2 spec/lib/quandl/client/source_spec.rb
quandl_client-2.4.1 spec/lib/quandl/client/source_spec.rb