Sha256: c168fad841876c5141db92f20609daaa08ec47a79d6fd78d8913d19ee6988408
Contents?: true
Size: 1.8 KB
Versions: 5
Compression:
Stored size: 1.8 KB
Contents
require 'spec_helper' describe "sync" do include_context :capistrano context 'loading' do it "should load deploy only once" do capistrano.load('deploy') capistrano.should_not_receive(:load).with('deploy') capistrano.load recipe_path capistrano.load recipe_path end end context 'db task' do let(:application) { "app" } let(:host) { "host" } let(:port) { "port" } let(:username) { "username" } let(:namespace) { subject.namespaces[:sync].namespaces[:db] } let(:database) { "o2h-db" } let(:remote_database) { {"database" => database, "host" => host, "port" => port, "username" => username} } let(:local_database) { {"database" => "local-db", "port" => "local-port", "username" => "local-username"} } before do subject.set(:application) { application } subject.set(:shared_path) { "/shared/#{application}" } namespace.stub(:remote_database_config) { remote_database } namespace.stub(:database_config) { local_database } end it "should set proper repository" do Capistrano::CLI.ui.stub(:agree) { true } subject.should_receive(:download) subject.should_receive(:run_locally).with("gunzip --stdout tmp/app-dump.sql.gz | psql -p local-port local-db") subject.execute_task(task) subject.should have_run("mkdir -p '/shared/app/backup'") subject.should have_run("pg_dump -c -Z 9 --no-owner -p #{port} -h #{host} -U #{username} -f /shared/app/backup/app-dump.sql.gz #{database}") end it "should call proper subtasks" do namespace.should_receive(:dump) namespace.should_receive(:fetch) namespace.should_receive(:import) subject.execute_task(task) end end context 'db:fetch task' do subject { task } its(:description) { should match(/fetch/i) } end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
o2h-0.2.1 | spec/recipes/sync_spec.rb |
o2h-0.2.0 | spec/recipes/sync_spec.rb |
o2h-0.1.16 | spec/recipes/sync_spec.rb |
o2h-0.1.15 | spec/recipes/sync_spec.rb |
o2h-0.1.14 | spec/recipes/sync_spec.rb |