summaryrefslogtreecommitdiff
path: root/spec/deprecation_spec.rb
blob: 21cb9d72a464c9cf77d4ff03543418d66cff586e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# frozen_string_literal: true
require "spec_helper"

describe "Bundler version 1.99" do
  context "when bundle is run" do
    it "should print a single deprecation warning" do
      # install_gemfile calls `bundle :install, opts`
      install_gemfile <<-G
        source "file://#{gem_repo1}"
        gem "rack"
      G

      expect(err).to eq("DEPRECATION: Gemfile and Gemfile.lock are " \
       "deprecated and will be replaced with gems.rb and gems.locked in " \
       "Bundler 2.0.0.")
    end
  end

  context "when Bundler.setup is run in a ruby script" do
    it "should print a single deprecation warning" do
      install_gemfile <<-G
        source "file://#{gem_repo1}"
        gem "rack", :group => :test
      G

      ruby <<-RUBY
        require 'rubygems'
        require 'bundler'
        require 'bundler/vendored_thor'

        Bundler.ui = Bundler::UI::Shell.new
        Bundler.setup
        Bundler.setup
      RUBY

      expect(err).to eq("DEPRECATION: Gemfile and Gemfile.lock are " \
       "deprecated and will be replaced with gems.rb and gems.locked in " \
       "Bundler 2.0.0.")
    end
  end

  context "when `bundler/deployment` is required in a ruby script" do
    it "should print a capistrano deprecation warning" do
      install_gemfile <<-G
        source "file://#{gem_repo1}"
        gem "rack", :group => :test
      G

      ruby(<<-RUBY, :expect_err => true)
        require 'bundler/deployment'
      RUBY

      expect(err).to eq("DEPRECATION: Bundler no longer integrates " \
                             "with Capistrano, but Capistrano provides " \
                             "its own integration with Bundler via the " \
                             "capistrano-bundler gem. Use it instead.")
    end
  end
end