Sha256: 1e4791c17e5a3b9a17fb45d2afc829409c66171f4083201d0a632efc266c8b97

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

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

2 entries across 2 versions & 1 rubygems

Version Path
quandl_client-2.7.5 spec/lib/quandl/client/source_spec.rb
quandl_client-2.7.4 spec/lib/quandl/client/source_spec.rb