Sha256: 004144a373d9d1ab71482b9a199e7b313bef6b36e26e33b48dda17eb16af0ba9

Contents?: true

Size: 1010 Bytes

Versions: 7

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_USER_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

7 entries across 7 versions & 1 rubygems

Version Path
quandl_client-2.9.0 spec/lib/quandl/client/source_spec.rb
quandl_client-2.8.0 spec/lib/quandl/client/source_spec.rb
quandl_client-2.7.12 spec/lib/quandl/client/source_spec.rb
quandl_client-2.7.9 spec/lib/quandl/client/source_spec.rb
quandl_client-2.7.8 spec/lib/quandl/client/source_spec.rb
quandl_client-2.7.7 spec/lib/quandl/client/source_spec.rb
quandl_client-2.7.6 spec/lib/quandl/client/source_spec.rb