Sha256: cd88901c27ecd47424ee27506fb6a6fa8402842223da4b168fdb24677be0e8a8

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe RailsBestPractices::Checks::DryBundlerInCapistranoCheck do
  before(:each) do
    @runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::DryBundlerInCapistranoCheck.new)
  end

  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)
    errors = @runner.errors
    errors.should_not be_empty
    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)
    errors = @runner.errors
    errors.should be_empty
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_best_practices-0.6.6 spec/rails_best_practices/checks/dry_bundler_in_capistrano_check_spec.rb
rails_best_practices-0.6.5 spec/rails_best_practices/checks/dry_bundler_in_capistrano_check_spec.rb