Sha256: c3b37db8f8764eee6740717472efa14dcb2cdc5f91de51d9e547c6c9178f893c

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Dataset do
  
  let(:source){
    s = Source.find("QUANDL_CLIENT_TEST_SOURCE")
    s = create(:source, code: "QUANDL_CLIENT_TEST_SOURCE") unless s.exists?
    s
  }
  subject{ create(:dataset, source_code: source.code, private: true ) }
  
  describe "#reference_url" do
    let(:url){ "http://website.com/path/to/reference" }
    let(:dataset){ Dataset.new( reference_url: url, code: "VALID" ) }
    subject{ dataset }
    
    its(:reference_url){ should eq url }
    its(:valid?){ should be_true }
    
    context "partial url" do
      let(:url){ "website.com/path/to/reference" }
      its(:valid?){ should be_false }
    end
    
    context "invalid url" do
      let(:url){ "website" }
      its(:valid?){ should be_false }
    end
    
  end
  
  describe "#private" do
    
    it "should update to false" do
      subject.private = false
      subject.save
      Dataset.find(subject.id).private.should be_false
    end
    
    it "should update to true" do
      subject.private = false
      subject.save
      subject.private = true
      subject.save
      Dataset.find(subject.id).private.should be_true
    end
    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
quandl_client-2.3.2 spec/lib/quandl/client/dataset/attributes_spec.rb
quandl_client-2.3.1 spec/lib/quandl/client/dataset/attributes_spec.rb
quandl_client-2.3.0 spec/lib/quandl/client/dataset/attributes_spec.rb