Sha256: f73856a9d9ea78966a1cbb7ae1093b5f0ec18c87366287fd8061e9eaccfdf204

Contents?: true

Size: 1012 Bytes

Versions: 6

Compression:

Stored size: 1012 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 = Spec::Config::Quandl.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

6 entries across 6 versions & 1 rubygems

Version Path
quandl_client-2.13.0 spec/lib/quandl/client/source_spec.rb
quandl_client-2.12.0 spec/lib/quandl/client/source_spec.rb
quandl_client-2.11.0 spec/lib/quandl/client/source_spec.rb
quandl_client-2.10.2 spec/lib/quandl/client/source_spec.rb
quandl_client-2.10.1 spec/lib/quandl/client/source_spec.rb
quandl_client-2.10.0 spec/lib/quandl/client/source_spec.rb