Sha256: 406f86c203b125a76f7495656e976fc4965e68a3dc46dadff982f359f0e79126

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

# encoding: utf-8
require 'spec_helper'

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
      Quandl::Logger.should_receive(:info).with(/Deleted/).exactly(4).times
      # load each dataset from file
      datasets = Quandl::Format::Dataset.load_from_file('spec/fixtures/data/datasets.qdf')
      # send command to delete each dataset
      datasets.each{|d| Quandl::Command::Tasks::Delete.call( d.code, force_yes: true ) }
      
      Quandl::Logger.should_receive(:error).with(/Not Found/).exactly(4).times
      datasets.each{|d| Quandl::Command::Tasks::Download.call( d.code ) }
    end
    
  end
  
  it "should fail to delete missing dataset" do
    Quandl::Logger.should_receive(:error).with(/Not Found/).exactly(1).times
    Quandl::Command::Tasks::Delete.call("DOES_NOT_EXIST", force_yes: true )
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

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