Sha256: aed9a0e51d7c9000aec0256d6df6fc502eee199359f9928cb4d3dc7dbc31c28d

Contents?: true

Size: 1.46 KB

Versions: 2

Compression:

Stored size: 1.46 KB

Contents

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

describe "Quandl::Command::Tasks::Schedule" do
  let(:schedule) { Quandl::Command::Tasks::Schedule.new(nil, nil)}

  its "should parse 'at' time to cron correctly " do
    schedule.stub_chain(:options, :at){'13:00'}
    schedule.instance_eval{cron_at}.should == "* 0 13 * * *"
  end

  its "should parse 'at' time to cron correctly " do
    schedule.stub_chain(:options, :at){'7pm monday'}
    schedule.instance_eval{cron_at}.should == "* 0 19 * * 1"
  end
end

describe "./bin/quandl schedule" do

  let(:command){ self.class.superclass.description }
  subject{ quandl("schedule #{command}") }
  
  context "list" do
    its(:stdout){ should_not match "scraper-test-file.rb" }
  end
  
  context "add spec/fixtures/scraper-test-file.rb" do
    its(:stdout){ should match "You have successfully scheduled 'scraper-test-file.rb'" }
  end
  
  context "delete scraper-test-file.rb --force-yes" do
    its(:stdout){ should match "You have successfully deleted 'scraper-test-file.rb'" }
  end
  
  context "add spec/fixtures/scraper-test-file.rb --at 7pm" do
    its(:stdout){ should match "You have successfully scheduled 'scraper-test-file.rb'" }
  end
  
  context "list" do
    its(:stdout){ should match "scraper-test-file.rb Scheduled: every day at 23:00"}
  end
  
  context "delete scraper-test-file.rb --force-yes" do
    its(:stdout){ should match "You have successfully deleted 'scraper-test-file.rb'" }
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
quandl-0.4.1 spec/lib/quandl/command/schedule_spec.rb
quandl-0.4.0 spec/lib/quandl/command/schedule_spec.rb