Sha256: e4328acb2041ec1c75a0d6fce0287c58381b2f039865d3ec8841aa4e1f41a965

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe "./bin/quandl delete" do

  let(:command){ self.class.superclass.description }
  subject{ quandl("delete #{command}") }

  
  context "DOES_NOT_EXIST" do
    its(:stdout){ should match 'Not Found' }
  end
  
  context "DATASET_1" do
    before(:each){ create(:dataset, code: 'DATASET_1') }
    its(:stdout){ should match 'Deleted' }
  end
  
end

describe Quandl::Command::Tasks::Delete do
  
  let(:subject_args){ [] }
  subject{ Quandl::Command::Tasks::Delete.call(*subject_args) }
  
  context "spec/fixtures/data/datasets.qdf" do
    
    before(:each){ Quandl::Command::Tasks::Upload.call( 'spec/fixtures/data/datasets.qdf' ) }

    it "should delete spec/fixtures/data/datasets.qdf" do
      Spec::Config::Output.should_receive(:info).with(/Deleted/).at_least(4).times
      datasets = Quandl::Format::Dataset.load_from_file('spec/fixtures/data/datasets.qdf')
      datasets.each{|d| Quandl::Command::Tasks::Delete.call( d.code, force_yes: true ) }
    end
    
    it "should not download" do
      datasets = Quandl::Format::Dataset.load_from_file('spec/fixtures/data/datasets.qdf')
      datasets.each{|d| Quandl::Command::Tasks::Delete.call( d.code, force_yes: true ) }
      Spec::Config::Output.should_receive(:info).with(nil).at_least(4).times
      datasets.each{|d| Quandl::Command::Tasks::Download.call( d.code ) }
    end
    
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
quandl-0.4.4 spec/lib/quandl/command/delete_spec.rb
quandl-0.4.3 spec/lib/quandl/command/delete_spec.rb
quandl-0.4.2 spec/lib/quandl/command/delete_spec.rb
quandl-0.4.1 spec/lib/quandl/command/delete_spec.rb