Sha256: 5c6d5aa7359697ee0c33e70b0e8c193afea8c5a707c9370144c29b6c45fcc6c7
Contents?: true
Size: 1.63 KB
Versions: 6
Compression:
Stored size: 1.63 KB
Contents
require 'spec_helper' describe RightPublish::Repo do class FakeRepo < RightPublish::Repo REPO_KEY = :fake_repo REPO_OPTIONS = {} end module MockLocal STORAGE_KEY = :mocklocal_storage STORAGE_OPTIONS = { } def self.get_directories() end end module MockRemote STORAGE_KEY = :mockremote_storage STORAGE_OPTIONS = { } def self.get_directories() end end before(:all) do RightPublish::StorageManager.register_storage(MockLocal) RightPublish::StorageManager.register_storage(MockRemote) RightPublish::RepoManager.register_repo(FakeRepo) end before(:each) do flexmock(RightPublish::Profile) do |obj| obj.should_receive(:log).and_return { |str,dbg| } obj.should_receive(:config).and_return { { :verbose=>false, :remote_storage=>{:provider=>'mockremote'}, :local_storage=>{:provider=>'mocklocal'}, :fake_repo=>{:subdir=>'fake/'} } } end @repo = RightPublish::RepoManager.get_repository(:fake_repo) end context "#pull" do it "fetches from remote storage to local" do flexmock(RightPublish::Storage).should_receive(:sync_dirs).and_return do |src,dest,options| src.should be_equal(MockRemote) dest.should be_equal(MockLocal) nil end @repo.pull end end context "#push" do it "stores from local storage to remote" do flexmock(RightPublish::Storage).should_receive(:sync_dirs).and_return do |src,dest,options| src.should be_equal(MockLocal) dest.should be_equal(MockRemote) nil end @repo.push end end end
Version data entries
6 entries across 6 versions & 1 rubygems