Sha256: 496e2c98ebe4c8632e55b36d86ae707841ce1c8a07b61adfb3896c9e10f08cd3
Contents?: true
Size: 1005 Bytes
Versions: 7
Compression:
Stored size: 1005 Bytes
Contents
require 'spec_helper' require 'localeapp/cli/update' describe Localeapp::CLI::Update, "#execute" do let(:output) { StringIO.new } let(:updater) { Localeapp::CLI::Update.new(:output => output) } let(:poller) { Localeapp::Poller.new } before(:each) { Localeapp::Poller.stub(:new => poller) } context "when timestamp is recent" do before(:each) { poller.stub(:updated_at => Time.now.to_i - 60) } it "creates a Poller and calls poll! on it" do with_configuration do poller.should_receive(:poll!) updater.execute end end end context "when timestamp is too old" do before(:each) { poller.stub(:updated_at => 0) } it "warns the user" do with_configuration do updater.execute output.string.should include("Timestamp is missing or too old.") end end it "does not even call the API" do with_configuration do poller.should_not_receive(:poll!) updater.execute end end end end
Version data entries
7 entries across 7 versions & 1 rubygems