Skip to content

Instantly share code, notes, and snippets.

@waseem
Last active August 29, 2015 14:01
Show Gist options
  • Save waseem/a843b8a842d63ffea80c to your computer and use it in GitHub Desktop.
Save waseem/a843b8a842d63ffea80c to your computer and use it in GitHub Desktop.
class ResourceArchiver
def archive_resource
@resource_downloader.download_resource # download_resource is already tested properly
@resource_downloader.archive # archive is already tested properly
upload_resource_archive # upload_resource_archive s already tested properly
end
end
require 'spec_helper'
describe ResourceArchiver do
let(:resource_archiver) { ResourceArchiver.new(Factory(:resource_downloader)) }
describe '#archive_resource' do
it 'calls methods in correct order' do
rd = resource_archiver.instance_variable_get(:@resource_downloader)
rd.should_receive(:download_resource).and_return(true)
rd.should_receive(:archive).and_return(true)
resource_archiver.should_receive(:upload_resource_archive).and_return(true)
resource_archiver.archive_resource
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment