|
| 1 | +require 'spec_helper' |
| 2 | + |
| 3 | +require 'fakefs/safe' |
| 4 | + |
| 5 | +describe "Capifony::Symfony2 - shared" do |
| 6 | + before do |
| 7 | + @configuration = Capistrano::Configuration.new |
| 8 | + @configuration.extend(Capistrano::Spec::ConfigurationExtension) |
| 9 | + |
| 10 | + @configuration.set :application, 'test-app' |
| 11 | + @configuration.set :latest_release, '/var/www/releases/20120927' |
| 12 | + @configuration.set :previous_release, '/var/www/releases/20120920' |
| 13 | + @configuration.set :current_path, '/var/www/current' |
| 14 | + @configuration.set :shared_path, '/var/www/shared' |
| 15 | + @configuration.set :remote_tmp_dir, '/tmp' |
| 16 | + @configuration.set :maintenance_basename, 'maintenance' |
| 17 | + @configuration.set :try_sudo, '' |
| 18 | + |
| 19 | + Capifony::Symfony2.load_into(@configuration) |
| 20 | + end |
| 21 | + |
| 22 | + subject { @configuration } |
| 23 | + |
| 24 | + it "defines shared folder tasks" do |
| 25 | + @configuration.find_task('shared:folder:download').should_not == nil |
| 26 | + end |
| 27 | + |
| 28 | + context "when runnning shared:folder:download", fakefs: true do |
| 29 | + before do |
| 30 | + @configuration.find_and_execute_task('shared:folder:download') |
| 31 | + @filename = "test-app.remote_shared.#{Time.now.utc.strftime("%Y%m%d%H%M%S")}.tar.gz" |
| 32 | + @file = "/tmp/#{@filename}" |
| 33 | + end |
| 34 | + |
| 35 | + it { should have_run(" sh -c \'cd /var/www/shared; tar -zcvf #{@file} --exclude=\'cached-copy\' .\'") } |
| 36 | + it { should have_gotten("#{@file}").to("backups/#{@filename}") } |
| 37 | + it { should have_run(" rm -f #{@file}") } |
| 38 | + end |
| 39 | +end |
0 commit comments