ra10ke 2.0.0 → 3.1.0

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.
data/ra10ke.gemspec CHANGED
@@ -1,30 +1,30 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'ra10ke/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "ra10ke"
6
+ spec.name = 'ra10ke'
7
7
  spec.version = Ra10ke::VERSION
8
- spec.authors = ["Theo Chatzimichos", "Vox Pupuli"]
9
- spec.email = ["voxpupuli@groups.io"]
10
- spec.description = %q{R10K and Puppetfile rake tasks}
11
- spec.summary = %q{Syntax check for the Puppetfile, check for outdated installed puppet modules}
12
- spec.homepage = "https://github.com/voxpupuli/ra10ke"
13
- spec.license = "MIT"
8
+ spec.authors = ['Theo Chatzimichos', 'Vox Pupuli']
9
+ spec.email = ['voxpupuli@groups.io']
10
+ spec.description = 'R10K and Puppetfile rake tasks'
11
+ spec.summary = 'Syntax check for the Puppetfile, check for outdated installed puppet modules'
12
+ spec.homepage = 'https://github.com/voxpupuli/ra10ke'
13
+ spec.license = 'MIT'
14
14
 
15
15
  spec.files = `git ls-files`.split($/)
16
- spec.require_paths = ["lib"]
17
- spec.required_ruby_version = '>= 2.6.0'
16
+ spec.require_paths = ['lib']
17
+ spec.required_ruby_version = '>= 2.7.0'
18
18
 
19
- spec.add_dependency "rake"
20
- spec.add_dependency "puppet_forge"
21
- spec.add_dependency "r10k", '>= 2.6.5'
22
- spec.add_dependency "git"
23
- spec.add_dependency "solve"
24
- spec.add_dependency 'semverse', '>= 2.0'
19
+ spec.add_dependency 'git', '>= 1.18', '< 3.0'
20
+ spec.add_dependency 'puppet_forge', '~> 5.0', '>= 5.0.1'
21
+ spec.add_dependency 'r10k', '>= 2.6.5', '< 5'
22
+ spec.add_dependency 'rake', '~> 13.0', '>= 13.0.6'
23
+ spec.add_dependency 'semverse', '>= 2.0', '< 4'
24
+ spec.add_dependency 'solve', '~> 4.0', '>= 4.0.4'
25
25
  spec.add_dependency 'table_print', '~> 1.5.6'
26
+ spec.add_development_dependency 'pry', '~> 0.14.2'
26
27
  spec.add_development_dependency 'rspec', '~> 3.6'
27
- spec.add_development_dependency 'pry'
28
- spec.add_development_dependency 'simplecov'
28
+ spec.add_development_dependency 'simplecov', '~> 0.22.0'
29
+ spec.add_development_dependency 'voxpupuli-rubocop', '~> 2.8.0'
29
30
  end
30
-
@@ -5,8 +5,8 @@ mod 'puppet/ferm', :latest
5
5
  mod 'puppet/borg', :latest
6
6
  mod 'puppet/wireguard', :latest
7
7
  mod 'puppet/bird', :latest
8
- mod 'herculesteam/augeasproviders_pam', :latest
9
- mod 'herculesteam/augeasproviders_shellvar', :latest
8
+ mod 'puppet/augeasproviders_pam', :latest
9
+ mod 'puppet/augeasproviders_shellvar', :latest
10
10
  mod 'puppetlabs/vcsrepo', :latest
11
11
  mod 'saz/ssh', :latest
12
12
  mod 'puppet/r10k', :latest
@@ -22,8 +22,8 @@ mod 'theforeman/foreman', :latest
22
22
  mod 'theforeman/puppet', :latest
23
23
  mod 'theforeman/foreman_proxy', :latest
24
24
  mod 'puppet/nftables', :latest
25
- mod 'herculesteam/augeasproviders_sysctl', :latest
26
- mod 'camptocamp/catalog_diff', :latest
25
+ mod 'puppet/augeasproviders_sysctl', :latest
26
+ mod 'puppet/catalog_diff', :latest
27
27
  mod 'puppet/unattended_upgrades', :latest
28
28
  mod 'puppet/selinux', :latest
29
29
  mod 'choria/choria', :latest
@@ -34,7 +34,7 @@ mod 'jsok/vault',
34
34
  ref: 'test'
35
35
 
36
36
  # dependencies
37
- mod 'herculesteam/augeasproviders_core', :latest
37
+ mod 'puppet/augeasproviders_core', :latest
38
38
  mod 'puppetlabs/stdlib', :latest
39
39
  mod 'choria/mcollective', :latest
40
40
  mod 'puppetlabs/concat', :latest
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'r10k/puppetfile'
3
4
  require 'spec_helper'
4
5
  require 'ra10ke/dependencies'
@@ -8,7 +9,7 @@ RSpec::Mocks.configuration.allow_message_expectations_on_nil = true
8
9
 
9
10
  RSpec.describe 'Ra10ke::Dependencies::Verification' do
10
11
  let(:instance) do
11
- pfile = R10K::Puppetfile.new(File.basename(puppetfile), nil,puppetfile, nil, false)
12
+ pfile = R10K::Puppetfile.new(File.basename(puppetfile), nil, puppetfile, nil, false)
12
13
  Ra10ke::Dependencies::Verification.new(pfile)
13
14
  end
14
15
 
@@ -20,8 +21,9 @@ RSpec.describe 'Ra10ke::Dependencies::Verification' do
20
21
  it 'default contains semver' do
21
22
  expect(Ra10ke::Dependencies::Verification.version_formats).to have_key(:semver)
22
23
  end
24
+
23
25
  it 'add new version format' do
24
- Ra10ke::Dependencies::Verification.register_version_format(:test) do |tags|
26
+ Ra10ke::Dependencies::Verification.register_version_format(:test) do |_tags|
25
27
  nil
26
28
  end
27
29
  expect(Ra10ke::Dependencies::Verification.version_formats).to have_key(:test)
@@ -30,10 +32,10 @@ RSpec.describe 'Ra10ke::Dependencies::Verification' do
30
32
 
31
33
  context 'show output in table format' do
32
34
  let(:instance) do
33
- pfile = R10K::Puppetfile.new(File.basename(puppetfile), nil,puppetfile, nil, false)
35
+ pfile = R10K::Puppetfile.new(File.basename(puppetfile), nil, puppetfile, nil, false)
34
36
  Ra10ke::Dependencies::Verification.new(pfile)
35
37
  end
36
-
38
+
37
39
  let(:puppetfile) do
38
40
  File.join(fixtures_dir, 'Puppetfile')
39
41
  end
@@ -49,26 +51,24 @@ RSpec.describe 'Ra10ke::Dependencies::Verification' do
49
51
  it 'show dependencies as table' do
50
52
  instance.print_table(processed_modules)
51
53
  end
52
-
53
54
  end
54
55
 
55
56
  context 'get_latest_ref' do
56
-
57
57
  context 'find latest semver tag' do
58
58
  let(:latest_tag) do
59
- 'v1.1.0'
59
+ 'v1.1.0'
60
60
  end
61
61
  let(:test_tags) do
62
62
  {
63
- 'v1.0.0' => nil,
63
+ 'v1.0.0' => nil,
64
64
  latest_tag => nil,
65
65
  }
66
66
  end
67
67
 
68
68
  it do
69
69
  expect(instance.get_latest_ref({
70
- 'tags' => test_tags,
71
- })).to eq(latest_tag)
70
+ 'tags' => test_tags,
71
+ })).to eq(latest_tag)
72
72
  end
73
73
  end
74
74
 
@@ -78,7 +78,7 @@ RSpec.describe 'Ra10ke::Dependencies::Verification' do
78
78
  end
79
79
  let(:test_tags) do
80
80
  {
81
- 'dev' => nil,
81
+ 'dev' => nil,
82
82
  latest_tag => nil,
83
83
  }
84
84
  end
@@ -88,20 +88,19 @@ RSpec.describe 'Ra10ke::Dependencies::Verification' do
88
88
  tags.detect { |tag| tag == latest_tag }
89
89
  end
90
90
  expect(instance.get_latest_ref({
91
- 'tags' => test_tags,
92
- })).to eq(latest_tag)
91
+ 'tags' => test_tags,
92
+ })).to eq(latest_tag)
93
93
  end
94
94
  end
95
95
 
96
96
  context 'convert to ref' do
97
-
98
97
  it 'run rake task' do
99
98
  output_conversion = File.read(File.join(fixtures_dir, 'Puppetfile_git_conversion'))
100
99
  require 'ra10ke'
101
100
  Ra10ke::RakeTask.new do |t|
102
101
  t.basedir = fixtures_dir
103
102
  end
104
- expect{Rake::Task['r10k:print_git_conversion'].invoke}.to output(output_conversion).to_stdout
103
+ expect { Rake::Task['r10k:print_git_conversion'].invoke }.to output(output_conversion).to_stdout
105
104
  end
106
105
  end
107
106
  end
@@ -14,21 +14,24 @@ RSpec.describe 'Ra10ke::Deprecation::Validation' do
14
14
  end
15
15
 
16
16
  it 'only checks forge modules' do
17
- expect(PuppetForge::Module).to_not receive(:find).with('puppet')
17
+ expect(PuppetForge::Module).not_to receive(:find).with('puppet')
18
18
  allow(PuppetForge::Module).to receive(:find).and_raise(Faraday::ResourceNotFound.new(nil))
19
19
  expect(instance.deprecated_modules.count).to eq(0)
20
20
  end
21
21
 
22
22
  it 'handles deprecated modules' do
23
- expect(PuppetForge::Module).to receive(:find).with('puppetlabs-ruby').and_return(double(slug: 'puppetlabs-ruby', deprecated_at: '2021-04-22 10:29:42 -0700'))
23
+ expect(PuppetForge::Module).to receive(:find).with('puppetlabs-ruby').and_return(double(slug: 'puppetlabs-ruby',
24
+ deprecated_at: '2021-04-22 10:29:42 -0700'))
24
25
  allow(PuppetForge::Module).to receive(:find).and_return(double(slug: 'module-module', deprecated_at: nil))
25
26
 
26
27
  expect(instance.bad_mods?).to eq(true)
27
- expect(instance.deprecated_modules.first).to eq(name: 'puppetlabs-ruby', deprecated_at: Time.parse('2021-04-22 10:29:42 -0700'))
28
+ expect(instance.deprecated_modules.first).to eq(name: 'puppetlabs-ruby',
29
+ deprecated_at: Time.parse('2021-04-22 10:29:42 -0700'))
28
30
  end
29
31
 
30
32
  it 'handles missing modules' do
31
- expect(PuppetForge::Module).to receive(:find).with('choria-choria').and_return(double(slug: 'choria-choria', deprecated_at: nil))
33
+ expect(PuppetForge::Module).to receive(:find).with('choria-choria').and_return(double(slug: 'choria-choria',
34
+ deprecated_at: nil))
32
35
  expect(PuppetForge::Module).to receive(:find).with('puppetlabs-ruby').and_raise(Faraday::ResourceNotFound.new(nil))
33
36
  allow(PuppetForge::Module).to receive(:find).and_return(double(slug: 'module-module', deprecated_at: nil))
34
37
 
@@ -10,7 +10,7 @@ RSpec.describe 'Ra10ke::GitRepo' do
10
10
  expect(Ra10ke::GitRepo.new(url)).to be_a Ra10ke::GitRepo
11
11
  end
12
12
 
13
- it 'should not run_command more than once' do
13
+ it 'does not run_command more than once' do
14
14
  i = Ra10ke::GitRepo.new(url)
15
15
  expect(i).to receive(:run_command).with("git ls-remote --symref #{url}").once
16
16
  i.valid_url?
@@ -26,7 +26,7 @@ RSpec.describe 'Ra10ke::GitRepo' do
26
26
 
27
27
  let(:reflist) { File.read(File.join(fixtures_dir, 'refs', 'gitlab.txt')) }
28
28
 
29
- before(:each) do
29
+ before do
30
30
  allow(instance).to receive(:run_command).with("git ls-remote --symref #{url}").and_return([reflist, true])
31
31
  end
32
32
 
@@ -68,22 +68,22 @@ RSpec.describe 'Ra10ke::GitRepo' do
68
68
  refs = instance.all_refs
69
69
  expect(refs).to be_a Array
70
70
  expect(refs.last).to eq(
71
- { name: 'v5.0.0^{}', ref: 'refs/tags/v5.0.0^{}', sha: '1febd15f90d32e6b3d6c242a70db386b2ef1942c', subtype: nil, type: :tag }
71
+ { name: 'v5.0.0^{}', ref: 'refs/tags/v5.0.0^{}', sha: '1febd15f90d32e6b3d6c242a70db386b2ef1942c', subtype: nil,
72
+ type: :tag, },
72
73
  )
73
74
  end
74
75
  end
75
76
 
76
77
  describe 'bad url' do
77
78
  let(:url) { 'https://github.com/nwops/typo' }
78
-
79
- before(:each) do
80
- allow(instance).to receive(:run_command).with("git ls-remote --symref #{url}").and_return(['', false])
81
- end
82
-
83
79
  let(:instance) do
84
80
  Ra10ke::GitRepo.new(url)
85
81
  end
86
82
 
83
+ before do
84
+ allow(instance).to receive(:run_command).with("git ls-remote --symref #{url}").and_return(['', false])
85
+ end
86
+
87
87
  it '#all_refs' do
88
88
  expect(instance.all_refs).to be_a Array
89
89
  expect(instance.all_refs).to eq []
@@ -2,110 +2,99 @@ require 'spec_helper'
2
2
  require 'ra10ke/puppetfile_parser'
3
3
 
4
4
  RSpec.describe 'Ra10ke::PuppetfileParser' do
5
- include Ra10ke::PuppetfileParser
5
+ include Ra10ke::PuppetfileParser
6
6
 
7
- let(:puppetfile) do
8
- File.join(fixtures_dir, 'Puppetfile')
9
- end
7
+ let(:puppetfile) do
8
+ File.join(fixtures_dir, 'Puppetfile')
9
+ end
10
10
 
11
- let(:puppetfile_modules) do
12
- [{:args=>{:version=>'0.26.2'}, :name=>'choria', :namespace=>nil},
13
- {:args=>{:version=>"2.2.0"}, :name=>"inifile", :namespace=>"puppetlabs"},
14
- {:args=>{:version=>"1.0.1"}, :name=>"ruby", :namespace=>"puppetlabs"},
15
- {:args=>{:version=>"4.24.0"}, :name=>"stdlib", :namespace=>"puppetlabs"},
16
- {:args=>{:version=>"4.0.0"}, :name=>"concat", :namespace=>"puppetlabs"},
17
- {:args=>{:version=>"6.4.1"}, :name=>"ntp", :namespace=>"puppetlabs"},
18
- {:args=>{:version=>"3.1.1"}, :name=>"archive", :namespace=>"puppet"},
19
- {:args=>
20
- {:git=>"https://github.com/vshn/puppet-gitlab",
21
- :ref=>"00397b86dfb3487d9df768cbd3698d362132b5bf"},
22
- :name=>"gitlab",
23
- :namespace=>nil},
24
- {:args=>{:git=>"https://github.com/acidprime/r10k", :tag=>"v3.1.1"},
25
- :name=>"r10k",
26
- :namespace=>nil},
27
- {:args=>
28
- {:branch=>"gitlab_disable_ssl_verify_support",
29
- :git=>"https://github.com/npwalker/abrader-gms"},
30
- :name=>"gms",
31
- :namespace=>nil},
32
- {:args=>
33
- {:git=>"https://github.com/puppetlabs/pltraining-rbac",
34
- :ref=>"2f60e1789a721ce83f8df061e13f8bf81cd4e4ce"},
35
- :name=>"rbac",
36
- :namespace=>"pltraining"},
37
- {:args=>
38
- {:branch=>"master", :git=>"https://github.com/dobbymoodge/puppet-acl.git"},
39
- :name=>"acl",
40
- :namespace=>"puppet"},
41
- {:args=>{:branch=>"master", :git=>"https://github.com/cudgel/deploy.git"},
42
- :name=>"deploy",
43
- :namespace=>nil},
44
- {:args=>
45
- {:branch=>"master", :git=>"https://github.com/cudgel/puppet-dotfiles.git"},
46
- :name=>"dotfiles",
47
- :namespace=>nil},
48
- {:args=>{:branch=>"dev", :git=>"https://github.com/cudgel/splunk.git"},
49
- :name=>"splunk",
50
- :namespace=>nil},
51
- {:args=>{:branch=>"master", :git=>"https://github.com/voxpupuli/puppet-module.git"},
52
- :name=>"puppet",
53
- :namespace=>nil}]
54
- end
11
+ let(:puppetfile_modules) do
12
+ [{ args: { version: '0.26.2' }, name: 'choria', namespace: nil },
13
+ { args: { version: '2.2.0' }, name: 'inifile', namespace: 'puppetlabs' },
14
+ { args: { version: '1.0.1' }, name: 'ruby', namespace: 'puppetlabs' },
15
+ { args: { version: '4.24.0' }, name: 'stdlib', namespace: 'puppetlabs' },
16
+ { args: { version: '4.0.0' }, name: 'concat', namespace: 'puppetlabs' },
17
+ { args: { version: '6.4.1' }, name: 'ntp', namespace: 'puppetlabs' },
18
+ { args: { version: '3.1.1' }, name: 'archive', namespace: 'puppet' },
19
+ { args: { git: 'https://github.com/vshn/puppet-gitlab',
20
+ ref: '00397b86dfb3487d9df768cbd3698d362132b5bf', },
21
+ name: 'gitlab',
22
+ namespace: nil, },
23
+ { args: { git: 'https://github.com/acidprime/r10k', tag: 'v3.1.1' },
24
+ name: 'r10k',
25
+ namespace: nil, },
26
+ { args: { branch: 'gitlab_disable_ssl_verify_support',
27
+ git: 'https://github.com/npwalker/abrader-gms', },
28
+ name: 'gms',
29
+ namespace: nil, },
30
+ { args: { git: 'https://github.com/puppetlabs/pltraining-rbac',
31
+ ref: '2f60e1789a721ce83f8df061e13f8bf81cd4e4ce', },
32
+ name: 'rbac',
33
+ namespace: 'pltraining', },
34
+ { args: { branch: 'master', git: 'https://github.com/dobbymoodge/puppet-acl.git' },
35
+ name: 'acl',
36
+ namespace: 'puppet', },
37
+ { args: { branch: 'master', git: 'https://github.com/cudgel/deploy.git' },
38
+ name: 'deploy',
39
+ namespace: nil, },
40
+ { args: { branch: 'master', git: 'https://github.com/cudgel/puppet-dotfiles.git' },
41
+ name: 'dotfiles',
42
+ namespace: nil, },
43
+ { args: { branch: 'dev', git: 'https://github.com/cudgel/splunk.git' },
44
+ name: 'splunk',
45
+ namespace: nil, },
46
+ { args: { branch: 'master', git: 'https://github.com/voxpupuli/puppet-module.git' },
47
+ name: 'puppet',
48
+ namespace: nil, },]
49
+ end
55
50
 
51
+ it '#modules' do
52
+ expect(modules(puppetfile)).to eq(puppetfile_modules)
53
+ end
56
54
 
57
- it '#modules' do
58
- expect(modules(puppetfile)).to eq(puppetfile_modules)
59
- end
55
+ it '#git_modules' do
56
+ expected = [{ args: { git: 'https://github.com/vshn/puppet-gitlab',
57
+ ref: '00397b86dfb3487d9df768cbd3698d362132b5bf', },
58
+ name: 'gitlab',
59
+ namespace: nil, },
60
+ { args: { git: 'https://github.com/acidprime/r10k', tag: 'v3.1.1' },
61
+ name: 'r10k',
62
+ namespace: nil, },
63
+ { args: { branch: 'gitlab_disable_ssl_verify_support',
64
+ git: 'https://github.com/npwalker/abrader-gms', },
65
+ name: 'gms',
66
+ namespace: nil, },
67
+ { args: { git: 'https://github.com/puppetlabs/pltraining-rbac',
68
+ ref: '2f60e1789a721ce83f8df061e13f8bf81cd4e4ce', },
69
+ name: 'rbac',
70
+ namespace: 'pltraining', },
71
+ { args: { branch: 'master', git: 'https://github.com/dobbymoodge/puppet-acl.git' },
72
+ name: 'acl',
73
+ namespace: 'puppet', },
74
+ { args: { branch: 'master', git: 'https://github.com/cudgel/deploy.git' },
75
+ name: 'deploy',
76
+ namespace: nil, },
77
+ { args: { branch: 'master', git: 'https://github.com/cudgel/puppet-dotfiles.git' },
78
+ name: 'dotfiles',
79
+ namespace: nil, },
80
+ { args: { branch: 'dev', git: 'https://github.com/cudgel/splunk.git' },
81
+ name: 'splunk',
82
+ namespace: nil, },
83
+ { args: { branch: 'master', git: 'https://github.com/voxpupuli/puppet-module.git' },
84
+ name: 'puppet',
85
+ namespace: nil, },]
86
+ expect(git_modules(puppetfile)).to eq(expected)
87
+ end
60
88
 
61
- it '#git_modules' do
62
- expected = [{:args=>
63
- {:git=>"https://github.com/vshn/puppet-gitlab",
64
- :ref=>"00397b86dfb3487d9df768cbd3698d362132b5bf"},
65
- :name=>"gitlab",
66
- :namespace=>nil},
67
- {:args=>{:git=>"https://github.com/acidprime/r10k", :tag=>"v3.1.1"},
68
- :name=>"r10k",
69
- :namespace=>nil},
70
- {:args=>
71
- {:branch=>"gitlab_disable_ssl_verify_support",
72
- :git=>"https://github.com/npwalker/abrader-gms"},
73
- :name=>"gms",
74
- :namespace=>nil},
75
- {:args=>
76
- {:git=>"https://github.com/puppetlabs/pltraining-rbac",
77
- :ref=>"2f60e1789a721ce83f8df061e13f8bf81cd4e4ce"},
78
- :name=>"rbac",
79
- :namespace=>"pltraining"},
80
- {:args=>
81
- {:branch=>"master", :git=>"https://github.com/dobbymoodge/puppet-acl.git"},
82
- :name=>"acl",
83
- :namespace=>"puppet"},
84
- {:args=>{:branch=>"master", :git=>"https://github.com/cudgel/deploy.git"},
85
- :name=>"deploy",
86
- :namespace=>nil},
87
- {:args=>
88
- {:branch=>"master", :git=>"https://github.com/cudgel/puppet-dotfiles.git"},
89
- :name=>"dotfiles",
90
- :namespace=>nil},
91
- {:args=>{:branch=>"dev", :git=>"https://github.com/cudgel/splunk.git"},
92
- :name=>"splunk",
93
- :namespace=>nil},
94
- {:args=>{:branch=>"master", :git=>"https://github.com/voxpupuli/puppet-module.git"},
95
- :name=>"puppet",
96
- :namespace=>nil}]
97
- expect(git_modules(puppetfile)).to eq(expected)
98
- end
89
+ it '#parse_modules_args' do
90
+ data = " 'puppet-acl', :git => 'https://github.com/dobbymoodge/puppet-acl.git', :branch => 'master'"
91
+ expect(parse_module_args(data)).to eq({ args: { branch: 'master',
92
+ git: 'https://github.com/dobbymoodge/puppet-acl.git', },
93
+ name: 'acl', namespace: 'puppet', })
94
+ end
99
95
 
100
- it '#parse_modules_args' do
101
- data = " 'puppet-acl', :git => 'https://github.com/dobbymoodge/puppet-acl.git', :branch => 'master'"
102
- expect(parse_module_args(data)).to eq({:args=>{:branch=>"master",
103
- :git=>"https://github.com/dobbymoodge/puppet-acl.git"},
104
- :name=>"acl", :namespace=>"puppet"})
105
- end
106
-
107
- it '#parse_modules_args when empty' do
108
- data = ""
109
- expect(parse_module_args(data)).to eq({})
110
- end
96
+ it '#parse_modules_args when empty' do
97
+ data = ''
98
+ expect(parse_module_args(data)).to eq({})
99
+ end
111
100
  end
@@ -13,7 +13,7 @@ RSpec.describe 'Ra10ke::Validate::Validation' do
13
13
  File.join(fixtures_dir, 'Puppetfile')
14
14
  end
15
15
 
16
- before(:each) do
16
+ before do
17
17
  allow_any_instance_of(Ra10ke::GitRepo).to receive(:valid_ref?).and_return(true)
18
18
  allow_any_instance_of(Ra10ke::GitRepo).to receive(:valid_url?).and_return(true)
19
19
  end
@@ -25,7 +25,7 @@ RSpec.describe 'Ra10ke::Validate::Validation' do
25
25
 
26
26
  it '#data is a hash with values' do
27
27
  keys = instance.all_modules.first.values
28
- expect(keys).to eq(["ntp", "https://github.com/puppetlabs/puppetlabs-ntp", "81b34c6", true, true, "👍"])
28
+ expect(keys).to eq(['ntp', 'https://github.com/puppetlabs/puppetlabs-ntp', '81b34c6', true, true, '👍'])
29
29
  end
30
30
  end
31
31
 
@@ -38,7 +38,7 @@ RSpec.describe 'Ra10ke::Validate::Validation' do
38
38
  File.join(fixtures_dir, 'Puppetfile_with_bad_refs')
39
39
  end
40
40
 
41
- before(:each) do
41
+ before do
42
42
  working = double('Ra1ke::GitRepo', url: 'https://github.com/vshn/puppet-gitlab')
43
43
  expect(working).to receive(:valid_ref?).with('00397b86dfb3487d9df768cbd3698d362132b5bf').and_return(false)
44
44
  expect(working).to receive(:valid_commit?).with('00397b86dfb3487d9df768cbd3698d362132b5bf').and_return(true)
@@ -62,7 +62,7 @@ RSpec.describe 'Ra10ke::Validate::Validation' do
62
62
  end
63
63
 
64
64
  describe 'control_branch' do
65
- before(:each) do
65
+ before do
66
66
  ENV.delete 'CONTROL_BRANCH'
67
67
  ENV.delete 'CONTROL_BRANCH_FALLBACK'
68
68
  end
@@ -99,7 +99,9 @@ RSpec.describe 'Ra10ke::Validate::Validation' do
99
99
  it 'correctly falls back to fallback if no current branch but default branch' do
100
100
  ENV['CONTROL_BRANCH_FALLBACK'] = 'env-control_branch_fallback'
101
101
  allow(Ra10ke::GitRepo).to receive(:current_branch).and_return(nil)
102
- expect(instance.all_modules.find { |m| m[:name] == 'hiera_controlwithdefault' }[:ref]).to eq('env-control_branch_fallback')
102
+ expect(instance.all_modules.find do |m|
103
+ m[:name] == 'hiera_controlwithdefault'
104
+ end[:ref]).to eq('env-control_branch_fallback')
103
105
  end
104
106
 
105
107
  it 'correctly falls back to default_branch if no current branch with override' do
@@ -138,6 +140,6 @@ RSpec.describe 'Ra10ke::Validate::Validation' do
138
140
  keys = instance.all_modules.first.values
139
141
 
140
142
  expect(keys).to eq(['gitlab', 'https://github.com/vshn/puppet-gitlab',
141
- '00397b86dfb3487d9df768cbd3698d362132b5bf', true, true, '👍'])
143
+ '00397b86dfb3487d9df768cbd3698d362132b5bf', true, true, '👍',])
142
144
  end
143
145
  end
data/spec/ra10ke_spec.rb CHANGED
@@ -63,13 +63,13 @@ RSpec.describe 'Ra10ke::RakeTask' do
63
63
  File.join(fixtures_dir, 'Puppetfile_with_bad_refs')
64
64
  end
65
65
 
66
- # I suspect rake is caching something here and the puppetfile is
67
- # not being sent correctly as it is not using the file I specify.
66
+ # I suspect rake is caching something here and the puppetfile is
67
+ # not being sent correctly as it is not using the file I specify.
68
68
  # The output should be different.
69
69
  # Testing this by itself works
70
70
  it '#run_validate_task' do
71
71
  task2 = instance.define_task_validate(args)
72
- expect(task2.invoke).to be nil
72
+ expect(task2.invoke).to be_nil
73
73
  end
74
74
  end
75
75
  end
data/spec/spec_helper.rb CHANGED
@@ -27,5 +27,5 @@ end
27
27
  require 'rspec/core'
28
28
 
29
29
  def fixtures_dir
30
- File.join(__dir__, 'fixtures')
30
+ File.join(__dir__, 'fixtures')
31
31
  end