appraisal 2.5.0 → 3.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/dynamic-security.yml +19 -0
- data/.github/workflows/main.yml +55 -0
- data/.gitignore +1 -0
- data/Gemfile +5 -0
- data/README.md +14 -5
- data/Rakefile +8 -6
- data/SECURITY.md +20 -0
- data/appraisal.gemspec +14 -17
- data/bin/bundle +109 -0
- data/bin/rspec +27 -0
- data/{bin → exe}/appraisal +6 -4
- data/lib/appraisal/appraisal.rb +20 -17
- data/lib/appraisal/appraisal_file.rb +8 -6
- data/lib/appraisal/bundler_dsl.rb +17 -13
- data/lib/appraisal/cli.rb +49 -43
- data/lib/appraisal/command.rb +3 -1
- data/lib/appraisal/conditional.rb +4 -0
- data/lib/appraisal/customize.rb +22 -2
- data/lib/appraisal/dependency.rb +4 -2
- data/lib/appraisal/dependency_list.rb +4 -2
- data/lib/appraisal/errors.rb +2 -0
- data/lib/appraisal/gemfile.rb +2 -0
- data/lib/appraisal/gemspec.rb +5 -3
- data/lib/appraisal/git.rb +3 -1
- data/lib/appraisal/group.rb +7 -5
- data/lib/appraisal/path.rb +3 -1
- data/lib/appraisal/platform.rb +7 -5
- data/lib/appraisal/source.rb +7 -5
- data/lib/appraisal/task.rb +8 -6
- data/lib/appraisal/utils.rb +6 -7
- data/lib/appraisal/version.rb +3 -1
- data/lib/appraisal.rb +4 -2
- data/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb +55 -24
- data/spec/acceptance/bundle_with_custom_path_spec.rb +26 -20
- data/spec/acceptance/bundle_without_spec.rb +10 -10
- data/spec/acceptance/cli/clean_spec.rb +13 -11
- data/spec/acceptance/cli/generate_spec.rb +14 -12
- data/spec/acceptance/cli/help_spec.rb +15 -13
- data/spec/acceptance/cli/install_spec.rb +33 -47
- data/spec/acceptance/cli/list_spec.rb +11 -9
- data/spec/acceptance/cli/run_spec.rb +26 -24
- data/spec/acceptance/cli/update_spec.rb +20 -18
- data/spec/acceptance/cli/version_spec.rb +3 -1
- data/spec/acceptance/cli/with_no_arguments_spec.rb +10 -8
- data/spec/acceptance/gemfile_dsl_compatibility_spec.rb +38 -36
- data/spec/acceptance/gemspec_spec.rb +26 -24
- data/spec/appraisal/appraisal_file_spec.rb +66 -4
- data/spec/appraisal/appraisal_spec.rb +20 -23
- data/spec/appraisal/customize_spec.rb +133 -11
- data/spec/appraisal/dependency_list_spec.rb +3 -1
- data/spec/appraisal/gemfile_spec.rb +39 -38
- data/spec/appraisal/utils_spec.rb +21 -28
- data/spec/spec_helper.rb +14 -6
- data/spec/support/acceptance_test_helpers.rb +31 -24
- data/spec/support/dependency_helpers.rb +29 -15
- data/spec/support/stream_helpers.rb +2 -0
- metadata +10 -34
- data/.rspec +0 -1
@@ -1,20 +1,22 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
RSpec.describe "Gemfile DSL compatibility" do
|
6
|
+
it "supports all Bundler DSL in Gemfile" do
|
7
|
+
build_gems %w[bacon orange_juice waffle]
|
8
|
+
build_git_gem "egg"
|
7
9
|
build_gemspec
|
8
10
|
|
9
|
-
build_gemfile <<-
|
11
|
+
build_gemfile <<-GEMFILE
|
10
12
|
source "https://rubygems.org"
|
11
13
|
ruby RUBY_VERSION
|
12
14
|
|
13
|
-
git "../
|
15
|
+
git "../build/egg" do
|
14
16
|
gem "egg"
|
15
17
|
end
|
16
18
|
|
17
|
-
path "../
|
19
|
+
path "../build/orange_juice" do
|
18
20
|
gem "orange_juice"
|
19
21
|
end
|
20
22
|
|
@@ -29,9 +31,9 @@ describe 'Gemfile DSL compatibility' do
|
|
29
31
|
gem 'appraisal', :path => #{PROJECT_ROOT.inspect}
|
30
32
|
|
31
33
|
gemspec
|
32
|
-
|
34
|
+
GEMFILE
|
33
35
|
|
34
|
-
build_appraisal_file <<-
|
36
|
+
build_appraisal_file <<-APPRAISALS
|
35
37
|
appraise "japanese" do
|
36
38
|
gem "rice"
|
37
39
|
gem "miso_soup"
|
@@ -40,23 +42,23 @@ describe 'Gemfile DSL compatibility' do
|
|
40
42
|
appraise "english" do
|
41
43
|
gem "bread"
|
42
44
|
end
|
43
|
-
|
45
|
+
APPRAISALS
|
44
46
|
|
45
|
-
run
|
46
|
-
run
|
47
|
+
run "bundle install --local"
|
48
|
+
run "appraisal generate"
|
47
49
|
|
48
|
-
expect(content_of
|
50
|
+
expect(content_of("gemfiles/japanese.gemfile")).to eq <<-GEMFILE.strip_heredoc
|
49
51
|
# This file was generated by Appraisal
|
50
52
|
|
51
53
|
source "https://rubygems.org"
|
52
54
|
|
53
55
|
ruby "#{RUBY_VERSION}"
|
54
56
|
|
55
|
-
git "../../
|
57
|
+
git "../../build/egg" do
|
56
58
|
gem "egg"
|
57
59
|
end
|
58
60
|
|
59
|
-
path "../../
|
61
|
+
path "../../build/orange_juice" do
|
60
62
|
gem "orange_juice"
|
61
63
|
end
|
62
64
|
|
@@ -73,20 +75,20 @@ describe 'Gemfile DSL compatibility' do
|
|
73
75
|
end
|
74
76
|
|
75
77
|
gemspec :path => "../"
|
76
|
-
|
78
|
+
GEMFILE
|
77
79
|
|
78
|
-
expect(content_of
|
80
|
+
expect(content_of("gemfiles/english.gemfile")).to eq <<-GEMFILE.strip_heredoc
|
79
81
|
# This file was generated by Appraisal
|
80
82
|
|
81
83
|
source "https://rubygems.org"
|
82
84
|
|
83
85
|
ruby "#{RUBY_VERSION}"
|
84
86
|
|
85
|
-
git "../../
|
87
|
+
git "../../build/egg" do
|
86
88
|
gem "egg"
|
87
89
|
end
|
88
90
|
|
89
|
-
path "../../
|
91
|
+
path "../../build/orange_juice" do
|
90
92
|
gem "orange_juice"
|
91
93
|
end
|
92
94
|
|
@@ -102,7 +104,7 @@ describe 'Gemfile DSL compatibility' do
|
|
102
104
|
end
|
103
105
|
|
104
106
|
gemspec :path => "../"
|
105
|
-
|
107
|
+
GEMFILE
|
106
108
|
end
|
107
109
|
|
108
110
|
it "merges gem requirements" do
|
@@ -110,14 +112,14 @@ describe 'Gemfile DSL compatibility' do
|
|
110
112
|
build_gem "bacon", "1.1.0"
|
111
113
|
build_gem "bacon", "1.2.0"
|
112
114
|
|
113
|
-
build_gemfile <<-
|
115
|
+
build_gemfile <<-GEMFILE
|
114
116
|
source "https://rubygems.org"
|
115
117
|
|
116
118
|
gem "appraisal", :path => #{PROJECT_ROOT.inspect}
|
117
119
|
gem "bacon", "1.2.0"
|
118
|
-
|
120
|
+
GEMFILE
|
119
121
|
|
120
|
-
build_appraisal_file <<-
|
122
|
+
build_appraisal_file <<-APPRAISALS
|
121
123
|
appraise "1.0.0" do
|
122
124
|
gem "bacon", "1.0.0"
|
123
125
|
end
|
@@ -129,21 +131,21 @@ describe 'Gemfile DSL compatibility' do
|
|
129
131
|
appraise "1.2.0" do
|
130
132
|
gem "bacon", "1.2.0"
|
131
133
|
end
|
132
|
-
|
134
|
+
APPRAISALS
|
133
135
|
|
134
|
-
run
|
135
|
-
run
|
136
|
+
run "bundle install --local"
|
137
|
+
run "appraisal generate"
|
136
138
|
|
137
|
-
expect(content_of
|
138
|
-
expect(content_of
|
139
|
-
expect(content_of
|
139
|
+
expect(content_of("gemfiles/1.0.0.gemfile")).to include('gem "bacon", "1.0.0"')
|
140
|
+
expect(content_of("gemfiles/1.1.0.gemfile")).to include('gem "bacon", "1.1.0"')
|
141
|
+
expect(content_of("gemfiles/1.2.0.gemfile")).to include('gem "bacon", "1.2.0"')
|
140
142
|
end
|
141
143
|
|
142
144
|
it "supports gemspec in the group block" do
|
143
145
|
build_gem "bacon", "1.0.0"
|
144
146
|
build_gemspec
|
145
147
|
|
146
|
-
build_gemfile <<-
|
148
|
+
build_gemfile <<-GEMFILE
|
147
149
|
source "https://rubygems.org"
|
148
150
|
|
149
151
|
gem "appraisal", :path => #{PROJECT_ROOT.inspect}
|
@@ -151,18 +153,18 @@ describe 'Gemfile DSL compatibility' do
|
|
151
153
|
group :plugin do
|
152
154
|
gemspec
|
153
155
|
end
|
154
|
-
|
156
|
+
GEMFILE
|
155
157
|
|
156
|
-
build_appraisal_file <<-
|
158
|
+
build_appraisal_file <<-APPRAISALS
|
157
159
|
appraise "1.0.0" do
|
158
160
|
gem "bacon", "1.0.0"
|
159
161
|
end
|
160
|
-
|
162
|
+
APPRAISALS
|
161
163
|
|
162
164
|
run "bundle install --local"
|
163
165
|
run "appraisal generate"
|
164
166
|
|
165
|
-
expect(content_of
|
167
|
+
expect(content_of("gemfiles/1.0.0.gemfile")).to eq <<-GEMFILE.strip_heredoc
|
166
168
|
# This file was generated by Appraisal
|
167
169
|
|
168
170
|
source "https://rubygems.org"
|
@@ -173,6 +175,6 @@ describe 'Gemfile DSL compatibility' do
|
|
173
175
|
group :plugin do
|
174
176
|
gemspec :path => "../"
|
175
177
|
end
|
176
|
-
|
178
|
+
GEMFILE
|
177
179
|
end
|
178
180
|
end
|
@@ -1,57 +1,59 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
RSpec.describe "Gemspec" do
|
4
6
|
before do
|
5
7
|
build_appraisal_file
|
6
8
|
build_rakefile
|
7
9
|
end
|
8
10
|
|
9
|
-
it
|
11
|
+
it "supports gemspec syntax with default options" do
|
10
12
|
build_gemspec
|
11
13
|
|
12
|
-
write_file
|
14
|
+
write_file "Gemfile", <<-GEMFILE
|
13
15
|
source "https://rubygems.org"
|
14
16
|
|
15
17
|
gem 'appraisal', :path => #{PROJECT_ROOT.inspect}
|
16
18
|
|
17
19
|
gemspec
|
18
|
-
|
20
|
+
GEMFILE
|
19
21
|
|
20
|
-
run
|
21
|
-
run
|
22
|
-
output = run
|
22
|
+
run "bundle install --local"
|
23
|
+
run "appraisal install"
|
24
|
+
output = run "appraisal rake version"
|
23
25
|
|
24
|
-
expect(output).to include
|
26
|
+
expect(output).to include "Loaded 1.1.0"
|
25
27
|
end
|
26
28
|
|
27
|
-
it
|
28
|
-
build_gemspec
|
29
|
+
it "supports gemspec syntax with path option" do
|
30
|
+
build_gemspec "specdir"
|
29
31
|
|
30
|
-
write_file
|
32
|
+
write_file "Gemfile", <<-GEMFILE
|
31
33
|
source "https://rubygems.org"
|
32
34
|
|
33
35
|
gem 'appraisal', :path => #{PROJECT_ROOT.inspect}
|
34
36
|
|
35
37
|
gemspec :path => './specdir'
|
36
|
-
|
38
|
+
GEMFILE
|
37
39
|
|
38
|
-
run
|
39
|
-
run
|
40
|
-
output = run
|
40
|
+
run "bundle install --local"
|
41
|
+
run "appraisal install"
|
42
|
+
output = run "appraisal rake version"
|
41
43
|
|
42
|
-
expect(output).to include
|
44
|
+
expect(output).to include "Loaded 1.1.0"
|
43
45
|
end
|
44
46
|
|
45
47
|
def build_appraisal_file
|
46
|
-
super <<-
|
48
|
+
super <<-APPRAISALS
|
47
49
|
appraise 'stock' do
|
48
50
|
gem 'rake'
|
49
51
|
end
|
50
|
-
|
52
|
+
APPRAISALS
|
51
53
|
end
|
52
54
|
|
53
55
|
def build_rakefile
|
54
|
-
write_file
|
56
|
+
write_file "Rakefile", <<-RAKEFILE
|
55
57
|
require 'rubygems'
|
56
58
|
require 'bundler/setup'
|
57
59
|
require 'appraisal'
|
@@ -60,13 +62,13 @@ describe 'Gemspec' do
|
|
60
62
|
require 'dummy'
|
61
63
|
puts "Loaded \#{$dummy_version}"
|
62
64
|
end
|
63
|
-
|
65
|
+
RAKEFILE
|
64
66
|
end
|
65
67
|
|
66
|
-
def build_gemspec(path =
|
68
|
+
def build_gemspec(path = ".")
|
67
69
|
Dir.mkdir("tmp/stage/#{path}") rescue nil
|
68
70
|
|
69
|
-
write_file File.join(path,
|
71
|
+
write_file File.join(path, "gemspec_project.gemspec"), <<-GEMSPEC
|
70
72
|
Gem::Specification.new do |s|
|
71
73
|
s.name = 'gemspec_project'
|
72
74
|
s.version = '0.1'
|
@@ -75,6 +77,6 @@ describe 'Gemspec' do
|
|
75
77
|
|
76
78
|
s.add_development_dependency('dummy', '1.1.0')
|
77
79
|
end
|
78
|
-
|
80
|
+
GEMSPEC
|
79
81
|
end
|
80
82
|
end
|
@@ -1,14 +1,76 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
require "appraisal/appraisal_file"
|
3
5
|
|
4
6
|
# Requiring this to make the test pass on Rubinius 2.2.5
|
5
7
|
# https://github.com/rubinius/rubinius/issues/2934
|
6
|
-
require
|
8
|
+
require "rspec/matchers/composable"
|
9
|
+
require "rspec/matchers/built_in/raise_error"
|
7
10
|
|
8
|
-
describe Appraisal::AppraisalFile do
|
11
|
+
RSpec.describe Appraisal::AppraisalFile do
|
9
12
|
it "complains when no Appraisals file is found" do
|
10
13
|
allow(File).to receive(:exist?).with(/Gemfile/).and_return(true)
|
11
14
|
allow(File).to receive(:exist?).with("Appraisals").and_return(false)
|
12
15
|
expect { described_class.new }.to raise_error(Appraisal::AppraisalsNotFound)
|
13
16
|
end
|
17
|
+
|
18
|
+
describe "#customize_gemfiles" do
|
19
|
+
before(:each) do
|
20
|
+
allow(File).to receive(:exist?).with(anything).and_return(true)
|
21
|
+
allow(IO).to receive(:read).with(anything).and_return("")
|
22
|
+
end
|
23
|
+
|
24
|
+
context "when no arguments are given" do
|
25
|
+
subject { described_class.new.customize_gemfiles }
|
26
|
+
|
27
|
+
it "raises an error" do
|
28
|
+
expect { subject }.to raise_error(LocalJumpError)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "when a block is given" do
|
33
|
+
context "when the block returns a hash with :heading key" do
|
34
|
+
subject do
|
35
|
+
described_class.new.customize_gemfiles do
|
36
|
+
{ heading: "foo" }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it "sets the heading" do
|
41
|
+
pending("test is broken: wrong number of arguments (given 0, expected 1)")
|
42
|
+
|
43
|
+
expect { subject }.to change { Appraisal::Customize.heading }.to("foo")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "when the block returns a hash with :single_quotes key" do
|
48
|
+
subject do
|
49
|
+
described_class.new.customize_gemfiles do
|
50
|
+
{ single_quotes: true }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
it "sets the single_quotes" do
|
55
|
+
expect { subject }.to change { Appraisal::Customize.single_quotes }.to(true)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context "when the block returns a hash with :heading and :single_quotes keys" do
|
60
|
+
subject do
|
61
|
+
described_class.new.customize_gemfiles do
|
62
|
+
{ heading: "foo", single_quotes: true }
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it "sets the heading and single_quotes" do
|
67
|
+
pending("test is broken: wrong number of arguments (given 0, expected 1)")
|
68
|
+
|
69
|
+
subject
|
70
|
+
expect(Appraisal::Customize.heading).to eq("foo")
|
71
|
+
expect(Appraisal::Customize.single_quotes).to eq(true)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
14
76
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
-
|
2
|
-
require 'appraisal/appraisal'
|
3
|
-
require 'tempfile'
|
1
|
+
# frozen_string_literal: true
|
4
2
|
|
5
|
-
|
3
|
+
require "spec_helper"
|
4
|
+
require "appraisal/appraisal"
|
5
|
+
require "tempfile"
|
6
|
+
|
7
|
+
RSpec.describe Appraisal::Appraisal do
|
6
8
|
it "converts spaces to underscores in the gemfile path" do
|
7
9
|
appraisal = Appraisal::Appraisal.new("one two", "Gemfile")
|
8
10
|
expect(appraisal.gemfile_path).to match(/one_two\.gemfile$/)
|
@@ -85,50 +87,45 @@ describe Appraisal::Appraisal do
|
|
85
87
|
end
|
86
88
|
end
|
87
89
|
|
88
|
-
context
|
90
|
+
context "parallel installation" do
|
89
91
|
include StreamHelpers
|
90
92
|
|
91
93
|
before do
|
92
|
-
@appraisal = Appraisal::Appraisal.new(
|
94
|
+
@appraisal = Appraisal::Appraisal.new("fake", "fake")
|
93
95
|
allow(@appraisal).to receive(:gemfile_path).and_return("/home/test/test directory")
|
94
|
-
allow(@appraisal).to receive(:project_root).
|
95
|
-
|
96
|
-
allow(Appraisal::Command).to receive(:new).and_return(double(:run => true))
|
96
|
+
allow(@appraisal).to receive(:project_root).and_return(Pathname.new("/home/test"))
|
97
|
+
allow(Appraisal::Command).to receive(:new).and_return(double(run: true))
|
97
98
|
end
|
98
99
|
|
99
|
-
it
|
100
|
-
stub_const(
|
100
|
+
it "runs single install command on Bundler < 1.4.0" do
|
101
|
+
stub_const("Bundler::VERSION", "1.3.0")
|
101
102
|
|
102
103
|
warning = capture(:stderr) do
|
103
104
|
@appraisal.install("jobs" => 42)
|
104
105
|
end
|
105
106
|
|
106
|
-
expect(Appraisal::Command).to have_received(:new).
|
107
|
-
|
108
|
-
expect(warning).to include 'Please upgrade Bundler'
|
107
|
+
expect(Appraisal::Command).to have_received(:new).with("#{bundle_check_command} || #{bundle_single_install_command}")
|
108
|
+
expect(warning).to include "Please upgrade Bundler"
|
109
109
|
end
|
110
110
|
|
111
|
-
it
|
112
|
-
stub_const(
|
111
|
+
it "runs parallel install command on Bundler >= 1.4.0" do
|
112
|
+
stub_const("Bundler::VERSION", "1.4.0")
|
113
113
|
|
114
114
|
@appraisal.install("jobs" => 42)
|
115
115
|
|
116
|
-
expect(Appraisal::Command).to have_received(:new).
|
117
|
-
with("#{bundle_check_command} || #{bundle_parallel_install_command}")
|
116
|
+
expect(Appraisal::Command).to have_received(:new).with("#{bundle_check_command} || #{bundle_parallel_install_command}")
|
118
117
|
end
|
119
118
|
|
120
|
-
it
|
119
|
+
it "runs install command with retries on Bundler" do
|
121
120
|
@appraisal.install("retry" => 3)
|
122
121
|
|
123
|
-
expect(Appraisal::Command).to have_received(:new).
|
124
|
-
with("#{bundle_check_command} || #{bundle_install_command_with_retries}")
|
122
|
+
expect(Appraisal::Command).to have_received(:new).with("#{bundle_check_command} || #{bundle_install_command_with_retries}")
|
125
123
|
end
|
126
124
|
|
127
125
|
it "runs install command with path on Bundler" do
|
128
126
|
@appraisal.install("path" => "vendor/appraisal")
|
129
127
|
|
130
|
-
expect(Appraisal::Command).to have_received(:new).
|
131
|
-
with("#{bundle_check_command} || #{bundle_install_command_with_path}")
|
128
|
+
expect(Appraisal::Command).to have_received(:new).with("#{bundle_check_command} || #{bundle_install_command_with_path}")
|
132
129
|
end
|
133
130
|
|
134
131
|
def bundle_check_command
|
@@ -1,18 +1,140 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
4
|
+
require "appraisal/appraisal"
|
2
5
|
require "appraisal/customize"
|
3
6
|
|
4
|
-
describe Appraisal::Customize do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
RSpec.describe Appraisal::Customize do
|
8
|
+
let(:appraisal) { Appraisal::Appraisal.new("test", "Gemfile") }
|
9
|
+
let(:single_line_heading) { "This file was generated with a custom heading!" }
|
10
|
+
let(:multi_line_heading) do
|
11
|
+
<<~HEADING
|
12
|
+
frozen_string_literal: true
|
13
|
+
|
14
|
+
This file was generated with a custom heading!
|
15
|
+
HEADING
|
16
|
+
end
|
17
|
+
let(:subject) { described_class.new }
|
18
|
+
let(:single_line_subject) do
|
19
|
+
described_class.new(heading: single_line_heading)
|
20
|
+
end
|
21
|
+
let(:multi_line_single_quotes_subject) do
|
22
|
+
described_class.new(heading: multi_line_heading, single_quotes: true)
|
23
|
+
end
|
24
|
+
|
25
|
+
describe ".heading" do
|
26
|
+
it "returns nil if no heading is set" do
|
27
|
+
subject
|
28
|
+
expect(described_class.heading(appraisal)).to eq(nil)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "returns the heading if set" do
|
32
|
+
single_line_subject
|
33
|
+
expect(described_class.heading(appraisal)).to eq(single_line_heading)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns the heading without an trailing newline" do
|
37
|
+
multi_line_single_quotes_subject
|
38
|
+
expect(described_class.heading(appraisal)).to eq(multi_line_heading.chomp)
|
39
|
+
expect(described_class.heading(appraisal)).to_not end_with("\n")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe ".single_quotes" do
|
44
|
+
it "returns false if not set" do
|
45
|
+
subject
|
46
|
+
expect(described_class.single_quotes).to eq(false)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "returns true if set" do
|
50
|
+
multi_line_single_quotes_subject
|
51
|
+
expect(described_class.single_quotes).to eq(true)
|
52
|
+
end
|
11
53
|
end
|
12
54
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
55
|
+
describe ".customize" do
|
56
|
+
let(:appraisal_name) { "test" }
|
57
|
+
let(:gemfile) { "test.gemfile" }
|
58
|
+
let(:lockfile) { "#{gemfile}.lock" }
|
59
|
+
let(:gemfile_relative_path) { "gemfiles/#{gemfile}" }
|
60
|
+
let(:lockfile_relative_path) { "gemfiles/#{lockfile}" }
|
61
|
+
let(:gemfile_full_path) { "/path/to/project/#{gemfile_relative_path}" }
|
62
|
+
let(:lockfile_full_path) { "/path/to/project/#{lockfile_relative_path}" }
|
63
|
+
before do
|
64
|
+
allow(appraisal).to receive(:gemfile_name).and_return(gemfile)
|
65
|
+
allow(appraisal).to receive(:gemfile_path).and_return(gemfile_full_path)
|
66
|
+
allow(appraisal).to receive(:lockfile_path).and_return(lockfile_full_path)
|
67
|
+
allow(appraisal).to receive(:relative_gemfile_path).and_return(gemfile_relative_path)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "returns nil if no heading is set" do
|
71
|
+
subject
|
72
|
+
expect(described_class.send(:customize, nil, appraisal)).to eq(nil)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "returns the heading unchanged" do
|
76
|
+
single_line_subject
|
77
|
+
expect(described_class.send(
|
78
|
+
:customize,
|
79
|
+
single_line_heading,
|
80
|
+
appraisal
|
81
|
+
)).to eq(single_line_heading)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "returns the heading with the appraisal name" do
|
85
|
+
expect(described_class.send(
|
86
|
+
:customize,
|
87
|
+
"Appraisal: %{appraisal}", # rubocop:disable Style/FormatStringToken
|
88
|
+
appraisal
|
89
|
+
)).to eq("Appraisal: #{appraisal_name}")
|
90
|
+
end
|
91
|
+
|
92
|
+
it "returns the heading with the gemfile name" do
|
93
|
+
expect(described_class.send(
|
94
|
+
:customize,
|
95
|
+
"Gemfile: %{gemfile}", # rubocop:disable Style/FormatStringToken
|
96
|
+
appraisal
|
97
|
+
)).to eq("Gemfile: #{gemfile}")
|
98
|
+
end
|
99
|
+
|
100
|
+
it "returns the heading with the gemfile path" do
|
101
|
+
expect(described_class.send(
|
102
|
+
:customize,
|
103
|
+
"Gemfile: %{gemfile_path}", # rubocop:disable Style/FormatStringToken
|
104
|
+
appraisal
|
105
|
+
)).to eq("Gemfile: #{gemfile_full_path}")
|
106
|
+
end
|
107
|
+
|
108
|
+
it "returns the heading with the lockfile name" do
|
109
|
+
expect(described_class.send(
|
110
|
+
:customize,
|
111
|
+
"Lockfile: %{lockfile}", # rubocop:disable Style/FormatStringToken
|
112
|
+
appraisal
|
113
|
+
)).to eq("Lockfile: #{lockfile}")
|
114
|
+
end
|
115
|
+
|
116
|
+
it "returns the heading with the lockfile path" do
|
117
|
+
expect(described_class.send(
|
118
|
+
:customize,
|
119
|
+
"Lockfile: %{lockfile_path}", # rubocop:disable Style/FormatStringToken
|
120
|
+
appraisal
|
121
|
+
)).to eq("Lockfile: #{lockfile_full_path}")
|
122
|
+
end
|
123
|
+
|
124
|
+
it "returns the heading with the relative gemfile path" do
|
125
|
+
expect(described_class.send(
|
126
|
+
:customize,
|
127
|
+
"Gemfile: %{relative_gemfile_path}", # rubocop:disable Style/FormatStringToken
|
128
|
+
appraisal
|
129
|
+
)).to eq("Gemfile: #{gemfile_relative_path}")
|
130
|
+
end
|
131
|
+
|
132
|
+
it "returns the heading with the relative lockfile path" do
|
133
|
+
expect(described_class.send(
|
134
|
+
:customize,
|
135
|
+
"Gemfile: %{relative_lockfile_path}", # rubocop:disable Style/FormatStringToken
|
136
|
+
appraisal
|
137
|
+
)).to eq("Gemfile: #{lockfile_relative_path}")
|
138
|
+
end
|
17
139
|
end
|
18
140
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
require "appraisal/dependency_list"
|
3
5
|
|
4
|
-
describe Appraisal::DependencyList do
|
6
|
+
RSpec.describe Appraisal::DependencyList do
|
5
7
|
describe "#add" do
|
6
8
|
let(:dependency_list) { Appraisal::DependencyList.new }
|
7
9
|
|