Sha256: fbd63eef5621ab21b161517019f75d712cd0d0757e4aae0e62c5e91eb4e58270

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

# encoding: utf-8
require 'spec_helper'
require 'open3'

def quandl(statement)
  version = "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
  path = File.join(Quandl::Command::Tasks.root, 'bin/quandl')
  command = "rvm #{version} do bundle exec #{path} #{statement} --token #{ENV['QUANDL_TEST_TOKEN']} --url #{ENV['QUANDL_TEST_URL']} "
  stdin, stdout, stderr = Open3.popen3(command)
  OpenStruct.new( stderr: stderr.read, stdout: stdout.read )
end

describe "./bin/quandl" do
  
  let(:command){ self.class.superclass.description }
  subject{ quandl(command) }
  
  context "help" do
    its(:stdout){ should match 'http://quandl.com/ command line interface' }
    its(:stderr){ should be_blank }
  end
  
  context "upload spec/fixtures/data/metadata.qdf" do
    its(:stdout){ should match /Created|OK/ }
    its(:stderr){ should be_blank }
  end
  
  context "download TEST_1" do
    its(:stdout){ should match 'The description of TEST_1 is here' }
    its(:stderr){ should be_blank }
  end
  
  context "delete TEST_1 TEST_5 TEST_15 --force-yes" do
    its(:stdout){ should match 'Deleted' }
  end
  
  context "info" do
    its(:stdout){ should match ENV['QUANDL_TEST_URL'] }
    its(:stderr){ should be_blank }
  end
  
  context "list" do
    its(:stderr){ should be_blank }
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
quandl-0.2.27 spec/lib/quandl/command_spec.rb
quandl-0.2.26 spec/lib/quandl/command_spec.rb
quandl-0.2.25 spec/lib/quandl/command_spec.rb
quandl-0.2.24 spec/lib/quandl/command_spec.rb
quandl-0.2.22 spec/lib/quandl/command_spec.rb