appraisal 2.5.0 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dynamic-security.yml +19 -0
  3. data/.github/workflows/main.yml +55 -0
  4. data/.gitignore +1 -0
  5. data/Gemfile +5 -0
  6. data/README.md +14 -5
  7. data/Rakefile +8 -6
  8. data/SECURITY.md +20 -0
  9. data/appraisal.gemspec +14 -17
  10. data/bin/bundle +109 -0
  11. data/bin/rspec +27 -0
  12. data/{bin → exe}/appraisal +6 -4
  13. data/lib/appraisal/appraisal.rb +20 -17
  14. data/lib/appraisal/appraisal_file.rb +8 -6
  15. data/lib/appraisal/bundler_dsl.rb +17 -13
  16. data/lib/appraisal/cli.rb +49 -43
  17. data/lib/appraisal/command.rb +3 -1
  18. data/lib/appraisal/conditional.rb +4 -0
  19. data/lib/appraisal/customize.rb +22 -2
  20. data/lib/appraisal/dependency.rb +4 -2
  21. data/lib/appraisal/dependency_list.rb +4 -2
  22. data/lib/appraisal/errors.rb +2 -0
  23. data/lib/appraisal/gemfile.rb +2 -0
  24. data/lib/appraisal/gemspec.rb +5 -3
  25. data/lib/appraisal/git.rb +3 -1
  26. data/lib/appraisal/group.rb +7 -5
  27. data/lib/appraisal/path.rb +3 -1
  28. data/lib/appraisal/platform.rb +7 -5
  29. data/lib/appraisal/source.rb +7 -5
  30. data/lib/appraisal/task.rb +8 -6
  31. data/lib/appraisal/utils.rb +6 -7
  32. data/lib/appraisal/version.rb +3 -1
  33. data/lib/appraisal.rb +4 -2
  34. data/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb +55 -24
  35. data/spec/acceptance/bundle_with_custom_path_spec.rb +26 -20
  36. data/spec/acceptance/bundle_without_spec.rb +10 -10
  37. data/spec/acceptance/cli/clean_spec.rb +13 -11
  38. data/spec/acceptance/cli/generate_spec.rb +14 -12
  39. data/spec/acceptance/cli/help_spec.rb +15 -13
  40. data/spec/acceptance/cli/install_spec.rb +33 -47
  41. data/spec/acceptance/cli/list_spec.rb +11 -9
  42. data/spec/acceptance/cli/run_spec.rb +26 -24
  43. data/spec/acceptance/cli/update_spec.rb +20 -18
  44. data/spec/acceptance/cli/version_spec.rb +3 -1
  45. data/spec/acceptance/cli/with_no_arguments_spec.rb +10 -8
  46. data/spec/acceptance/gemfile_dsl_compatibility_spec.rb +38 -36
  47. data/spec/acceptance/gemspec_spec.rb +26 -24
  48. data/spec/appraisal/appraisal_file_spec.rb +66 -4
  49. data/spec/appraisal/appraisal_spec.rb +20 -23
  50. data/spec/appraisal/customize_spec.rb +133 -11
  51. data/spec/appraisal/dependency_list_spec.rb +3 -1
  52. data/spec/appraisal/gemfile_spec.rb +39 -38
  53. data/spec/appraisal/utils_spec.rb +21 -28
  54. data/spec/spec_helper.rb +14 -6
  55. data/spec/support/acceptance_test_helpers.rb +31 -24
  56. data/spec/support/dependency_helpers.rb +29 -15
  57. data/spec/support/stream_helpers.rb +2 -0
  58. metadata +10 -34
  59. data/.rspec +0 -1
@@ -1,51 +1,57 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
- describe "Bundle with custom path" do
4
- let(:gem_name) { 'rack' }
5
- let(:path) { 'vendor/bundle' }
5
+ RSpec.describe "Bundle with custom path" do
6
+ let(:gem_name) { "rack" }
7
+ let(:path) { "vendor/bundle" }
6
8
 
7
9
  shared_examples :gemfile_dependencies_are_satisfied do
8
-
9
- it 'installs gems in the --path directory' do
10
- build_gemfile <<-Gemfile
10
+ it "installs gems in the --path directory" do
11
+ build_gemfile <<-GEMFILE
11
12
  source "https://rubygems.org"
12
13
 
13
14
  gem 'appraisal', :path => #{PROJECT_ROOT.inspect}
14
- Gemfile
15
+ GEMFILE
15
16
 
16
- build_appraisal_file <<-Appraisals
17
+ build_appraisal_file <<-APPRAISALS
17
18
  appraise "#{gem_name}" do
18
19
  gem '#{gem_name}'
19
20
  end
20
- Appraisals
21
+ APPRAISALS
21
22
 
22
- run %(bundle install --path="#{path}")
23
- run 'bundle exec appraisal install'
23
+ run "bundle config set --local path #{path}"
24
+ run "bundle install"
25
+ run "bundle exec appraisal install"
24
26
 
25
- installed_gem = Dir.glob("tmp/stage/#{path}/#{Gem.ruby_engine}/*/gems/*").
26
- map { |path| path.split('/').last }.
27
- select { |gem| gem.include?(gem_name) }
27
+ installed_gem = Dir.glob("tmp/stage/#{path}/#{Gem.ruby_engine}/*/gems/*")
28
+ .map { |path| path.split("/").last }
29
+ .select { |gem| gem.include?(gem_name) }
28
30
  expect(installed_gem).not_to be_empty
29
31
 
30
- bundle_output = run 'bundle check'
32
+ bundle_output = run "bundle check"
31
33
  expect(bundle_output).to include("The Gemfile's dependencies are satisfied")
32
34
 
33
- appraisal_output = run 'bundle exec appraisal install'
35
+ appraisal_output = run "bundle exec appraisal install"
34
36
  expect(appraisal_output).to include("The Gemfile's dependencies are satisfied")
37
+
38
+ run "bundle config unset --local path"
35
39
  end
36
40
  end
37
41
 
38
42
  include_examples :gemfile_dependencies_are_satisfied
39
43
 
40
- context 'when already installed in vendor/another' do
44
+ context "when already installed in vendor/another" do
41
45
  before do
42
- build_gemfile <<-Gemfile
46
+ build_gemfile <<-GEMFILE
43
47
  source "https://rubygems.org"
44
48
 
45
49
  gem '#{gem_name}'
46
- Gemfile
50
+ GEMFILE
47
51
 
48
- run 'bundle install --path vendor/another'
52
+ run "bundle config set --local path vendor/another"
53
+ run "bundle install"
54
+ run "bundle config unset --local path"
49
55
  end
50
56
 
51
57
  include_examples :gemfile_dependencies_are_satisfied
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
- describe "Bundler without flag" do
5
+ RSpec.describe "Bundler without flag" do
4
6
  it "passes --without flag to Bundler on install" do
5
- build_gems %w(pancake orange_juice waffle coffee sausage soda)
7
+ build_gems %w[pancake orange_juice waffle coffee sausage soda]
6
8
 
7
- build_gemfile <<-Gemfile
9
+ build_gemfile <<-GEMFILE
8
10
  source "https://rubygems.org"
9
11
 
10
12
  gem "pancake"
@@ -15,9 +17,9 @@ describe "Bundler without flag" do
15
17
  end
16
18
 
17
19
  gem "appraisal", :path => #{PROJECT_ROOT.inspect}
18
- Gemfile
20
+ GEMFILE
19
21
 
20
- build_appraisal_file <<-Appraisals
22
+ build_appraisal_file <<-APPRAISALS
21
23
  appraise "breakfast" do
22
24
  gem "waffle"
23
25
 
@@ -33,15 +35,13 @@ describe "Bundler without flag" do
33
35
  gem "soda"
34
36
  end
35
37
  end
36
- Appraisals
38
+ APPRAISALS
37
39
 
38
40
  run "bundle install --local"
39
- output = run "appraisal install --without drinks"
41
+ run "bundle config set --local without 'drinks'"
42
+ output = run "appraisal install"
40
43
 
41
44
  expect(output).to include("Bundle complete")
42
- expect(output).to(
43
- match(/Gems in the group ['"]?drinks['"]? were not installed/),
44
- )
45
45
  expect(output).not_to include("orange_juice")
46
46
  expect(output).not_to include("coffee")
47
47
  expect(output).not_to include("soda")
@@ -1,20 +1,22 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
2
 
3
- describe 'CLI', 'appraisal clean' do
4
- it 'remove all gemfiles from gemfiles directory' do
5
- build_appraisal_file <<-Appraisal
3
+ require "spec_helper"
4
+
5
+ RSpec.describe "CLI", "appraisal clean" do
6
+ it "remove all gemfiles from gemfiles directory" do
7
+ build_appraisal_file <<-APPRAISAL
6
8
  appraise '1.0.0' do
7
9
  gem 'dummy', '1.0.0'
8
10
  end
9
- Appraisal
11
+ APPRAISAL
10
12
 
11
- run 'appraisal install'
12
- write_file 'gemfiles/non_related_file', ''
13
+ run "appraisal install"
14
+ write_file "gemfiles/non_related_file", ""
13
15
 
14
- run 'appraisal clean'
16
+ run "appraisal clean"
15
17
 
16
- expect(file 'gemfiles/1.0.0.gemfile').not_to be_exists
17
- expect(file 'gemfiles/1.0.0.gemfile.lock').not_to be_exists
18
- expect(file 'gemfiles/non_related_file').to be_exists
18
+ expect(file("gemfiles/1.0.0.gemfile")).not_to be_exists
19
+ expect(file("gemfiles/1.0.0.gemfile.lock")).not_to be_exists
20
+ expect(file("gemfiles/non_related_file")).to be_exists
19
21
  end
20
22
  end
@@ -1,14 +1,16 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
2
 
3
- describe 'CLI', 'appraisal generate' do
4
- it 'generates the gemfiles' do
5
- build_gemfile <<-Gemfile
3
+ require "spec_helper"
4
+
5
+ RSpec.describe "CLI", "appraisal generate" do
6
+ it "generates the gemfiles" do
7
+ build_gemfile <<-GEMFILE
6
8
  source "https://rubygems.org"
7
9
 
8
10
  gem "appraisal", :path => "#{PROJECT_ROOT}"
9
- Gemfile
11
+ GEMFILE
10
12
 
11
- build_appraisal_file <<-Appraisal
13
+ build_appraisal_file <<-APPRAISAL
12
14
  appraise '1.0.0' do
13
15
  gem 'dummy', '1.0.0'
14
16
  end
@@ -16,19 +18,19 @@ describe 'CLI', 'appraisal generate' do
16
18
  appraise '1.1.0' do
17
19
  gem 'dummy', '1.1.0'
18
20
  end
19
- Appraisal
21
+ APPRAISAL
20
22
 
21
- run 'appraisal generate'
23
+ run "appraisal generate"
22
24
 
23
- expect(file 'gemfiles/1.0.0.gemfile').to be_exists
24
- expect(file 'gemfiles/1.1.0.gemfile').to be_exists
25
- expect(content_of 'gemfiles/1.0.0.gemfile').to eq <<-gemfile.strip_heredoc
25
+ expect(file("gemfiles/1.0.0.gemfile")).to be_exists
26
+ expect(file("gemfiles/1.1.0.gemfile")).to be_exists
27
+ expect(content_of("gemfiles/1.0.0.gemfile")).to eq <<-GEMFILE.strip_heredoc
26
28
  # This file was generated by Appraisal
27
29
 
28
30
  source "https://rubygems.org"
29
31
 
30
32
  gem "appraisal", :path => "#{PROJECT_ROOT}"
31
33
  gem "dummy", "1.0.0"
32
- gemfile
34
+ GEMFILE
33
35
  end
34
36
  end
@@ -1,24 +1,26 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
2
 
3
- describe 'CLI', 'appraisal help' do
4
- it 'prints usage along with commands, and list of appraisals' do
5
- build_appraisal_file <<-Appraisal
3
+ require "spec_helper"
4
+
5
+ RSpec.describe "CLI", "appraisal help" do
6
+ it "prints usage along with commands, and list of appraisals" do
7
+ build_appraisal_file <<-APPRAISAL
6
8
  appraise '1.0.0' do
7
9
  gem 'dummy', '1.0.0'
8
10
  end
9
- Appraisal
11
+ APPRAISAL
10
12
 
11
- output = run 'appraisal help'
13
+ output = run "appraisal help"
12
14
 
13
- expect(output).to include 'Usage:'
14
- expect(output).to include 'appraisal [APPRAISAL_NAME] EXTERNAL_COMMAND'
15
- expect(output).to include '1.0.0'
15
+ expect(output).to include "Usage:"
16
+ expect(output).to include "appraisal [APPRAISAL_NAME] EXTERNAL_COMMAND"
17
+ expect(output).to include "1.0.0"
16
18
  end
17
19
 
18
- it 'prints out usage even Appraisals file does not exist' do
19
- output = run 'appraisal help'
20
+ it "prints out usage even Appraisals file does not exist" do
21
+ output = run "appraisal help"
20
22
 
21
- expect(output).to include 'Usage:'
22
- expect(output).not_to include 'Unable to locate'
23
+ expect(output).to include "Usage:"
24
+ expect(output).not_to include "Unable to locate"
23
25
  end
24
26
  end
@@ -1,14 +1,16 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
2
 
3
- describe 'CLI', 'appraisal install' do
4
- it 'raises error when there is no Appraisals file' do
5
- output = run 'appraisal install 2>&1', false
3
+ require "spec_helper"
4
+
5
+ RSpec.describe "CLI", "appraisal install" do
6
+ it "raises error when there is no Appraisals file" do
7
+ output = run "appraisal install 2>&1", false
6
8
 
7
9
  expect(output).to include "Unable to locate 'Appraisals' file"
8
10
  end
9
11
 
10
- it 'installs the dependencies' do
11
- build_appraisal_file <<-Appraisal
12
+ it "installs the dependencies" do
13
+ build_appraisal_file <<-APPRAISAL
12
14
  appraise '1.0.0' do
13
15
  gem 'dummy', '1.0.0'
14
16
  end
@@ -16,28 +18,27 @@ describe 'CLI', 'appraisal install' do
16
18
  appraise '1.1.0' do
17
19
  gem 'dummy', '1.1.0'
18
20
  end
19
- Appraisal
21
+ APPRAISAL
20
22
 
21
- run 'appraisal install'
23
+ run "appraisal install"
22
24
 
23
- expect(file 'gemfiles/1.0.0.gemfile.lock').to be_exists
24
- expect(file 'gemfiles/1.1.0.gemfile.lock').to be_exists
25
+ expect(file("gemfiles/1.0.0.gemfile.lock")).to be_exists
26
+ expect(file("gemfiles/1.1.0.gemfile.lock")).to be_exists
25
27
  end
26
28
 
27
- it 'relativize directory in gemfile.lock' do
29
+ it "relativize directory in gemfile.lock" do
28
30
  build_gemspec
29
31
  add_gemspec_to_gemfile
30
32
 
31
- build_appraisal_file <<-Appraisal
33
+ build_appraisal_file <<-APPRAISAL
32
34
  appraise '1.0.0' do
33
35
  gem 'dummy', '1.0.0'
34
36
  end
35
- Appraisal
37
+ APPRAISAL
36
38
 
37
- run 'appraisal install'
39
+ run "appraisal install"
38
40
 
39
- expect(content_of("gemfiles/1.0.0.gemfile.lock")).
40
- not_to include(current_directory)
41
+ expect(content_of("gemfiles/1.0.0.gemfile.lock")).not_to include(current_directory)
41
42
  end
42
43
 
43
44
  it "does not relativize directory of uris in gemfile.lock" do
@@ -46,7 +47,7 @@ describe 'CLI', 'appraisal install' do
46
47
 
47
48
  build_git_gem("uri_dummy")
48
49
  uri_dummy_path = "#{current_directory}/uri_dummy"
49
- FileUtils.symlink(File.absolute_path("tmp/gems/uri_dummy"), uri_dummy_path)
50
+ FileUtils.symlink(File.absolute_path("tmp/build/uri_dummy"), uri_dummy_path)
50
51
 
51
52
  build_appraisal_file <<-APPRAISAL
52
53
  appraise '1.0.0' do
@@ -56,39 +57,30 @@ describe 'CLI', 'appraisal install' do
56
57
 
57
58
  run "appraisal install"
58
59
 
59
- expect(content_of("gemfiles/1.0.0.gemfile.lock")).
60
- to include("file://#{uri_dummy_path}")
60
+ expect(content_of("gemfiles/1.0.0.gemfile.lock")).to include("file://#{uri_dummy_path}")
61
61
  end
62
62
 
63
- context 'with job size', :parallel => true do
63
+ context "with job size", parallel: true do
64
64
  before do
65
- build_appraisal_file <<-Appraisal
65
+ build_appraisal_file <<-APPRAISAL
66
66
  appraise '1.0.0' do
67
67
  gem 'dummy', '1.0.0'
68
68
  end
69
- Appraisal
69
+ APPRAISAL
70
70
  end
71
71
 
72
- it 'accepts --jobs option to set job size' do
73
- output = run 'appraisal install --jobs=2'
72
+ it "accepts --jobs option to set job size" do
73
+ output = run "appraisal install --jobs=2"
74
74
 
75
- expect(output).to include(
76
- "bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=2"
77
- )
75
+ expect(output).to include("bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=2")
78
76
  end
79
77
 
80
- it 'ignores --jobs option if the job size is less than or equal to 1' do
81
- output = run 'appraisal install --jobs=0'
82
-
83
- expect(output).to include(
84
- "bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}'"
85
- )
86
- expect(output).not_to include(
87
- "bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=0"
88
- )
89
- expect(output).not_to include(
90
- "bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=1"
91
- )
78
+ it "ignores --jobs option if the job size is less than or equal to 1" do
79
+ output = run "appraisal install --jobs=0"
80
+
81
+ expect(output).to include("bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}'")
82
+ expect(output).not_to include("bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=0")
83
+ expect(output).not_to include("bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --jobs=1")
92
84
  end
93
85
  end
94
86
 
@@ -104,10 +96,7 @@ describe 'CLI', 'appraisal install' do
104
96
  it "accepts --full-index option to pull the full RubyGems index" do
105
97
  output = run("appraisal install --full-index")
106
98
 
107
- expect(output).to include(
108
- "bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' " \
109
- "--retry 1 --full-index true"
110
- )
99
+ expect(output).to include("bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --retry 1 --full-index true")
111
100
  end
112
101
  end
113
102
 
@@ -123,10 +112,7 @@ describe 'CLI', 'appraisal install' do
123
112
  it "accepts --path option to specify the location to install gems into" do
124
113
  output = run("appraisal install --path vendor/appraisal")
125
114
 
126
- expect(output).to include(
127
- "bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' " \
128
- "--path #{file('vendor/appraisal')} --retry 1",
129
- )
115
+ expect(output).to include("bundle install --gemfile='#{file('gemfiles/1.0.0.gemfile')}' --path #{file('vendor/appraisal')} --retry 1")
130
116
  end
131
117
  end
132
118
  end
@@ -1,8 +1,10 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
2
 
3
- describe 'CLI', 'appraisal list' do
4
- it 'prints list of appraisals' do
5
- build_appraisal_file <<-Appraisal
3
+ require "spec_helper"
4
+
5
+ RSpec.describe "CLI", "appraisal list" do
6
+ it "prints list of appraisals" do
7
+ build_appraisal_file <<-APPRAISAL
6
8
  appraise '1.0.0' do
7
9
  gem 'dummy', '1.0.0'
8
10
  end
@@ -12,16 +14,16 @@ describe 'CLI', 'appraisal list' do
12
14
  appraise '1.1.0' do
13
15
  gem 'dummy', '1.0.0'
14
16
  end
15
- Appraisal
17
+ APPRAISAL
16
18
 
17
- output = run 'appraisal list'
19
+ output = run "appraisal list"
18
20
 
19
21
  expect(output).to eq("1.0.0\n2.0.0\n1.1.0\n")
20
22
  end
21
23
 
22
- it 'prints nothing if there are no appraisals in the file' do
23
- build_appraisal_file ''
24
- output = run 'appraisal list'
24
+ it "prints nothing if there are no appraisals in the file" do
25
+ build_appraisal_file ""
26
+ output = run "appraisal list"
25
27
 
26
28
  expect(output.length).to eq(0)
27
29
  end
@@ -1,8 +1,10 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
2
 
3
- describe 'CLI appraisal (with arguments)' do
3
+ require "spec_helper"
4
+
5
+ RSpec.describe "CLI appraisal (with arguments)" do
4
6
  before do
5
- build_appraisal_file <<-Appraisal
7
+ build_appraisal_file <<-APPRAISAL
6
8
  appraise '1.0.0' do
7
9
  gem 'dummy', '1.0.0'
8
10
  end
@@ -10,47 +12,47 @@ describe 'CLI appraisal (with arguments)' do
10
12
  appraise '1.1.0' do
11
13
  gem 'dummy', '1.1.0'
12
14
  end
13
- Appraisal
15
+ APPRAISAL
14
16
 
15
- run 'appraisal install'
16
- write_file 'test.rb', 'puts "Running: #{$dummy_version}"'
17
- write_file 'test with spaces.rb', 'puts "Running: #{$dummy_version}"'
17
+ run "appraisal install"
18
+ write_file "test.rb", 'puts "Running: #{$dummy_version}"'
19
+ write_file "test with spaces.rb", 'puts "Running: #{$dummy_version}"'
18
20
  end
19
21
 
20
- it 'sets APPRAISAL_INITIALIZED environment variable' do
21
- write_file 'test.rb', <<-TEST_FILE.strip_heredoc
22
+ it "sets APPRAISAL_INITIALIZED environment variable" do
23
+ write_file "test.rb", <<-TEST_FILE.strip_heredoc
22
24
  if ENV['APPRAISAL_INITIALIZED']
23
25
  puts "Appraisal initialized!"
24
26
  end
25
27
  TEST_FILE
26
28
 
27
- output = run 'appraisal 1.0.0 ruby -rbundler/setup -rdummy test.rb'
28
- expect(output).to include 'Appraisal initialized!'
29
+ output = run "appraisal 1.0.0 ruby -rbundler/setup -rdummy test.rb"
30
+ expect(output).to include "Appraisal initialized!"
29
31
  end
30
32
 
31
- context 'with appraisal name' do
32
- it 'runs the given command against a correct versions of dependency' do
33
- output = run 'appraisal 1.0.0 ruby -rbundler/setup -rdummy test.rb'
33
+ context "with appraisal name" do
34
+ it "runs the given command against a correct versions of dependency" do
35
+ output = run "appraisal 1.0.0 ruby -rbundler/setup -rdummy test.rb"
34
36
 
35
- expect(output).to include 'Running: 1.0.0'
36
- expect(output).not_to include 'Running: 1.1.0'
37
+ expect(output).to include "Running: 1.0.0"
38
+ expect(output).not_to include "Running: 1.1.0"
37
39
  end
38
40
  end
39
41
 
40
- context 'without appraisal name' do
41
- it 'runs the given command against all versions of dependency' do
42
- output = run 'appraisal ruby -rbundler/setup -rdummy test.rb'
42
+ context "without appraisal name" do
43
+ it "runs the given command against all versions of dependency" do
44
+ output = run "appraisal ruby -rbundler/setup -rdummy test.rb"
43
45
 
44
- expect(output).to include 'Running: 1.0.0'
45
- expect(output).to include 'Running: 1.1.0'
46
+ expect(output).to include "Running: 1.0.0"
47
+ expect(output).to include "Running: 1.1.0"
46
48
  end
47
49
  end
48
50
 
49
- context 'when one of the arguments contains spaces' do
50
- it 'preserves those spaces' do
51
+ context "when one of the arguments contains spaces" do
52
+ it "preserves those spaces" do
51
53
  command = 'appraisal 1.0.0 ruby -rbundler/setup -rdummy "test with spaces.rb"'
52
54
  output = run(command)
53
- expect(output).to include 'Running: 1.0.0'
55
+ expect(output).to include "Running: 1.0.0"
54
56
  end
55
57
  end
56
58
  end
@@ -1,19 +1,21 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
2
 
3
- describe 'CLI', 'appraisal update' do
3
+ require "spec_helper"
4
+
5
+ RSpec.describe "CLI", "appraisal update" do
4
6
  before do
5
- build_gem 'dummy2', '1.0.0'
7
+ build_gem "dummy2", "1.0.0"
6
8
 
7
- build_appraisal_file <<-Appraisal
9
+ build_appraisal_file <<-APPRAISAL
8
10
  appraise 'dummy' do
9
11
  gem 'dummy', '~> 1.0.0'
10
12
  gem 'dummy2', '~> 1.0.0'
11
13
  end
12
- Appraisal
14
+ APPRAISAL
13
15
 
14
- run 'appraisal install'
15
- build_gem 'dummy', '1.0.1'
16
- build_gem 'dummy2', '1.0.1'
16
+ run "appraisal install"
17
+ build_gem "dummy", "1.0.1"
18
+ build_gem "dummy2", "1.0.1"
17
19
  end
18
20
 
19
21
  after do
@@ -23,22 +25,22 @@ describe 'CLI', 'appraisal update' do
23
25
  end
24
26
  end
25
27
 
26
- context 'with no arguments' do
27
- it 'updates all the gems' do
28
- output = run 'appraisal update'
28
+ context "with no arguments" do
29
+ it "updates all the gems" do
30
+ output = run "appraisal update"
29
31
 
30
32
  expect(output).to include("gemfiles/dummy.gemfile bundle update")
31
- expect(content_of 'gemfiles/dummy.gemfile.lock').to include 'dummy (1.0.1)'
32
- expect(content_of 'gemfiles/dummy.gemfile.lock').to include 'dummy2 (1.0.1)'
33
+ expect(content_of("gemfiles/dummy.gemfile.lock")).to include "dummy (1.0.1)"
34
+ expect(content_of("gemfiles/dummy.gemfile.lock")).to include "dummy2 (1.0.1)"
33
35
  end
34
36
  end
35
37
 
36
- context 'with a list of gems' do
37
- it 'only updates specified gems' do
38
- run 'appraisal update dummy'
38
+ context "with a list of gems" do
39
+ it "only updates specified gems" do
40
+ run "appraisal update dummy"
39
41
 
40
- expect(content_of 'gemfiles/dummy.gemfile.lock').to include 'dummy (1.0.1)'
41
- expect(content_of 'gemfiles/dummy.gemfile.lock').to include 'dummy2 (1.0.0)'
42
+ expect(content_of("gemfiles/dummy.gemfile.lock")).to include "dummy (1.0.1)"
43
+ expect(content_of("gemfiles/dummy.gemfile.lock")).to include "dummy2 (1.0.0)"
42
44
  end
43
45
  end
44
46
  end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
- describe "CLI", "appraisal version" do
5
+ RSpec.describe "CLI", "appraisal version" do
4
6
  context "with version subcommand" do
5
7
  it "prints out version string" do
6
8
  output = run "appraisal version"
@@ -1,16 +1,18 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
2
 
3
- describe 'CLI appraisal (with no arguments)' do
4
- it 'runs install command' do
5
- build_appraisal_file <<-Appraisal
3
+ require "spec_helper"
4
+
5
+ RSpec.describe "CLI appraisal (with no arguments)" do
6
+ it "runs install command" do
7
+ build_appraisal_file <<-APPRAISAL
6
8
  appraise '1.0.0' do
7
9
  gem 'dummy', '1.0.0'
8
10
  end
9
- Appraisal
11
+ APPRAISAL
10
12
 
11
- run 'appraisal'
13
+ run "appraisal"
12
14
 
13
- expect(file 'gemfiles/1.0.0.gemfile').to be_exists
14
- expect(file 'gemfiles/1.0.0.gemfile.lock').to be_exists
15
+ expect(file("gemfiles/1.0.0.gemfile")).to be_exists
16
+ expect(file("gemfiles/1.0.0.gemfile.lock")).to be_exists
15
17
  end
16
18
  end