summaryrefslogtreecommitdiff
path: root/spec/bundler/bundler/dependency_spec.rb
blob: a953372742a5402ad6edca8c551a1526e6672832 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# frozen_string_literal: true

RSpec.describe Bundler::Dependency do
  let(:options) do
    {}
  end
  let(:dependency) do
    described_class.new(
      "test_gem",
      "1.0.0",
      options
    )
  end

  describe "to_lock" do
    it "returns formatted string" do
      expect(dependency.to_lock).to eq("  test_gem (= 1.0.0)")
    end

    it "matches format of Gem::Dependency#to_lock" do
      gem_dependency = Gem::Dependency.new("test_gem", "1.0.0")
      expect(dependency.to_lock).to eq(gem_dependency.to_lock)
    end

    context "when source is passed" do
      let(:options) do
        {
          "source" => Bundler::Source::Git.new({}),
        }
      end

      it "returns formatted string with exclamation mark" do
        expect(dependency.to_lock).to eq("  test_gem (= 1.0.0)!")
      end
    end
  end

  describe "PLATFORM_MAP" do
    subject { described_class::PLATFORM_MAP }

    # rubocop:disable Naming/VariableNumber
    let(:platforms) do
      { ruby: Gem::Platform::RUBY,
        ruby_18: Gem::Platform::RUBY,
        ruby_19: Gem::Platform::RUBY,
        ruby_20: Gem::Platform::RUBY,
        ruby_21: Gem::Platform::RUBY,
        ruby_22: Gem::Platform::RUBY,
        ruby_23: Gem::Platform::RUBY,
        ruby_24: Gem::Platform::RUBY,
        ruby_25: Gem::Platform::RUBY,
        ruby_26: Gem::Platform::RUBY,
        ruby_27: Gem::Platform::RUBY,
        ruby_30: Gem::Platform::RUBY,
        ruby_31: Gem::Platform::RUBY,
        ruby_32: Gem::Platform::RUBY,
        ruby_33: Gem::Platform::RUBY,
        ruby_34: Gem::Platform::RUBY,
        mri: Gem::Platform::RUBY,
        mri_18: Gem::Platform::RUBY,
        mri_19: Gem::Platform::RUBY,
        mri_20: Gem::Platform::RUBY,
        mri_21: Gem::Platform::RUBY,
        mri_22: Gem::Platform::RUBY,
        mri_23: Gem::Platform::RUBY,
        mri_24: Gem::Platform::RUBY,
        mri_25: Gem::Platform::RUBY,
        mri_26: Gem::Platform::RUBY,
        mri_27: Gem::Platform::RUBY,
        mri_30: Gem::Platform::RUBY,
        mri_31: Gem::Platform::RUBY,
        mri_32: Gem::Platform::RUBY,
        mri_33: Gem::Platform::RUBY,
        mri_34: Gem::Platform::RUBY,
        rbx: Gem::Platform::RUBY,
        truffleruby: Gem::Platform::RUBY,
        jruby: Gem::Platform::JAVA,
        jruby_18: Gem::Platform::JAVA,
        jruby_19: Gem::Platform::JAVA,
        windows: Gem::Platform::WINDOWS,
        windows_18: Gem::Platform::WINDOWS,
        windows_19: Gem::Platform::WINDOWS,
        windows_20: Gem::Platform::WINDOWS,
        windows_21: Gem::Platform::WINDOWS,
        windows_22: Gem::Platform::WINDOWS,
        windows_23: Gem::Platform::WINDOWS,
        windows_24: Gem::Platform::WINDOWS,
        windows_25: Gem::Platform::WINDOWS,
        windows_26: Gem::Platform::WINDOWS,
        windows_27: Gem::Platform::WINDOWS,
        windows_30: Gem::Platform::WINDOWS,
        windows_31: Gem::Platform::WINDOWS,
        windows_32: Gem::Platform::WINDOWS,
        windows_33: Gem::Platform::WINDOWS,
        windows_34: Gem::Platform::WINDOWS }
    end

    let(:deprecated) do
      { mswin: Gem::Platform::MSWIN,
        mswin_18: Gem::Platform::MSWIN,
        mswin_19: Gem::Platform::MSWIN,
        mswin_20: Gem::Platform::MSWIN,
        mswin_21: Gem::Platform::MSWIN,
        mswin_22: Gem::Platform::MSWIN,
        mswin_23: Gem::Platform::MSWIN,
        mswin_24: Gem::Platform::MSWIN,
        mswin_25: Gem::Platform::MSWIN,
        mswin_26: Gem::Platform::MSWIN,
        mswin_27: Gem::Platform::MSWIN,
        mswin_30: Gem::Platform::MSWIN,
        mswin_31: Gem::Platform::MSWIN,
        mswin_32: Gem::Platform::MSWIN,
        mswin_33: Gem::Platform::MSWIN,
        mswin_34: Gem::Platform::MSWIN,
        mswin64: Gem::Platform::MSWIN64,
        mswin64_19: Gem::Platform::MSWIN64,
        mswin64_20: Gem::Platform::MSWIN64,
        mswin64_21: Gem::Platform::MSWIN64,
        mswin64_22: Gem::Platform::MSWIN64,
        mswin64_23: Gem::Platform::MSWIN64,
        mswin64_24: Gem::Platform::MSWIN64,
        mswin64_25: Gem::Platform::MSWIN64,
        mswin64_26: Gem::Platform::MSWIN64,
        mswin64_27: Gem::Platform::MSWIN64,
        mswin64_30: Gem::Platform::MSWIN64,
        mswin64_31: Gem::Platform::MSWIN64,
        mswin64_32: Gem::Platform::MSWIN64,
        mswin64_33: Gem::Platform::MSWIN64,
        mswin64_34: Gem::Platform::MSWIN64,
        mingw: Gem::Platform::MINGW,
        mingw_18: Gem::Platform::MINGW,
        mingw_19: Gem::Platform::MINGW,
        mingw_20: Gem::Platform::MINGW,
        mingw_21: Gem::Platform::MINGW,
        mingw_22: Gem::Platform::MINGW,
        mingw_23: Gem::Platform::MINGW,
        mingw_24: Gem::Platform::MINGW,
        mingw_25: Gem::Platform::MINGW,
        mingw_26: Gem::Platform::MINGW,
        mingw_27: Gem::Platform::MINGW,
        mingw_30: Gem::Platform::MINGW,
        mingw_31: Gem::Platform::MINGW,
        mingw_32: Gem::Platform::MINGW,
        mingw_33: Gem::Platform::MINGW,
        mingw_34: Gem::Platform::MINGW,
        x64_mingw: Gem::Platform::X64_MINGW,
        x64_mingw_20: Gem::Platform::X64_MINGW,
        x64_mingw_21: Gem::Platform::X64_MINGW,
        x64_mingw_22: Gem::Platform::X64_MINGW,
        x64_mingw_23: Gem::Platform::X64_MINGW,
        x64_mingw_24: Gem::Platform::X64_MINGW,
        x64_mingw_25: Gem::Platform::X64_MINGW,
        x64_mingw_26: Gem::Platform::X64_MINGW,
        x64_mingw_27: Gem::Platform::X64_MINGW,
        x64_mingw_30: Gem::Platform::X64_MINGW,
        x64_mingw_31: Gem::Platform::X64_MINGW,
        x64_mingw_32: Gem::Platform::X64_MINGW,
        x64_mingw_33: Gem::Platform::X64_MINGW,
        x64_mingw_34: Gem::Platform::X64_MINGW }
    end
    # rubocop:enable Naming/VariableNumber

    it "includes all platforms" do
      expect(subject).to eq(platforms.merge(deprecated))
    end
  end
end