Sha256: 52651c0f478ef237b84cf33c78d9085c79de846d385c70404fb4553a66e1c57b

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

module RailsBestPractices
  module Reviews
    describe DryBundlerInCapistranoReview do
      let(:runner) { runner = Core::Runner.new(:reviews => DryBundlerInCapistranoReview.new) }

      it "should dry bundler in capistrno" do
        content = <<-EOF
        namespace :bundler do
          task :create_symlink, :roles => :app do
            shared_dir = File.join(shared_path, 'bundle')
            release_dir = File.join(current_release, '.bundle')
            run("mkdir -p \#{shared_dir} && ln -s \#{shared_dir} \#{release_dir}")
          end

          task :bundle_new_release, :roles => :app do
            bundler.create_symlink
            run "cd \#{release_path} && bundle install --without development test"
          end
        end

        after 'deploy:update_code', 'bundler:bundle_new_release'
        EOF
        runner.review('config/deploy.rb', content)
        runner.should have(1).errors
        runner.errors[0].to_s.should == "config/deploy.rb:1 - dry bundler in capistrano"
      end

      it "should not dry bundler in capistrano" do
        content = <<-EOF
          require 'bundler/capistrano'
        EOF
        runner.review('config/deploy.rb', content)
        runner.should have(0).errors
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_best_practices-1.9.1 spec/rails_best_practices/reviews/dry_bundler_in_capistrano_review_spec.rb