polishgeeks-dev-tools 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +3 -2
  4. data/CHANGELOG.md +69 -0
  5. data/Gemfile.lock +76 -81
  6. data/README.md +28 -22
  7. data/Rakefile +4 -3
  8. data/config/rubocop.yml +16 -16
  9. data/config/rubocop_todo.yml +14 -0
  10. data/lib/polish_geeks/dev_tools.rb +26 -0
  11. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/allowed_extensions.rb +4 -4
  12. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/base.rb +18 -3
  13. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/brakeman.rb +5 -2
  14. data/lib/polish_geeks/dev_tools/commands/bundler_audit.rb +23 -0
  15. data/lib/{polishgeeks/dev-tools/commands/empty_method.rb → polish_geeks/dev_tools/commands/empty_methods.rb} +3 -13
  16. data/lib/{polishgeeks/dev-tools/commands/empty_method → polish_geeks/dev_tools/commands/empty_methods}/file_parser.rb +1 -1
  17. data/lib/{polishgeeks/dev-tools/commands/empty_method → polish_geeks/dev_tools/commands/empty_methods}/string_refinements.rb +2 -2
  18. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/examples_comparator.rb +13 -7
  19. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/expires_in.rb +6 -6
  20. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/final_blank_line.rb +1 -11
  21. data/lib/polish_geeks/dev_tools/commands/gemfile.rb +39 -0
  22. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/haml_lint.rb +0 -0
  23. data/lib/polish_geeks/dev_tools/commands/required_files.rb +38 -0
  24. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rspec.rb +24 -5
  25. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rspec_files_names.rb +1 -1
  26. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rspec_files_structure.rb +22 -9
  27. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rubocop.rb +10 -8
  28. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rubycritic.rb +0 -0
  29. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/simplecov.rb +0 -0
  30. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/tasks_files_names.rb +0 -0
  31. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/yard.rb +0 -0
  32. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/yml_parser.rb +0 -0
  33. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/config.rb +24 -16
  34. data/lib/polish_geeks/dev_tools/config_manager.rb +68 -0
  35. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/errors.rb +0 -0
  36. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/hash.rb +0 -0
  37. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/logger.rb +3 -3
  38. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/output_storer.rb +0 -0
  39. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/runner.rb +0 -0
  40. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/shell.rb +0 -0
  41. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/tasks/dev-tools.rake +0 -0
  42. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/validators/base.rb +2 -2
  43. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/validators/rails.rb +0 -0
  44. data/lib/polish_geeks/dev_tools/validators/rubocop.rb +12 -0
  45. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/validators/simplecov.rb +1 -1
  46. data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/version.rb +1 -1
  47. data/lib/polishgeeks-dev-tools.rb +6 -31
  48. data/polishgeeks_dev_tools.gemspec +6 -5
  49. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/allowed_extensions_spec.rb +5 -17
  50. data/spec/lib/polish_geeks/dev_tools/commands/base_spec.rb +90 -0
  51. data/spec/lib/polish_geeks/dev_tools/commands/brakeman_spec.rb +99 -0
  52. data/spec/lib/polish_geeks/dev_tools/commands/bundler_audit_spec.rb +52 -0
  53. data/spec/lib/{polishgeeks/dev-tools/commands/empty_method → polish_geeks/dev_tools/commands/empty_methods}/file_parser_spec.rb +1 -1
  54. data/spec/lib/{polishgeeks/dev-tools/commands/empty_method → polish_geeks/dev_tools/commands/empty_methods}/string_refinements_spec.rb +1 -1
  55. data/spec/lib/{polishgeeks/dev-tools/commands/empty_method_spec.rb → polish_geeks/dev_tools/commands/empty_methods_spec.rb} +7 -54
  56. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/examples_comparator_spec.rb +8 -8
  57. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/expires_in_spec.rb +1 -1
  58. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/final_blank_line_spec.rb +2 -45
  59. data/spec/lib/polish_geeks/dev_tools/commands/gemfile_spec.rb +91 -0
  60. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/haml_lint_spec.rb +13 -21
  61. data/spec/lib/polish_geeks/dev_tools/commands/required_files_spec.rb +51 -0
  62. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rspec_files_names_spec.rb +2 -2
  63. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rspec_files_structure_spec.rb +19 -32
  64. data/spec/lib/polish_geeks/dev_tools/commands/rspec_spec.rb +106 -0
  65. data/spec/lib/polish_geeks/dev_tools/commands/rubocop_spec.rb +131 -0
  66. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rubycritic_spec.rb +5 -3
  67. data/spec/lib/polish_geeks/dev_tools/commands/simplecov_spec.rb +136 -0
  68. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/tasks_files_names_spec.rb +8 -8
  69. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/yard_spec.rb +10 -10
  70. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/yml_parser_spec.rb +2 -2
  71. data/spec/lib/polish_geeks/dev_tools/config_manager_spec.rb +124 -0
  72. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/config_spec.rb +3 -3
  73. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/errors_spec.rb +0 -0
  74. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/hash_spec.rb +8 -8
  75. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/logger_spec.rb +9 -9
  76. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/output_storer_spec.rb +1 -1
  77. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/runner_spec.rb +0 -0
  78. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/shell_spec.rb +1 -1
  79. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/validators/base_spec.rb +0 -0
  80. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/validators/rails_spec.rb +0 -0
  81. data/spec/lib/polish_geeks/dev_tools/validators/rubocop_spec.rb +29 -0
  82. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/validators/simplecov_spec.rb +1 -1
  83. data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/version_spec.rb +0 -0
  84. data/spec/lib/{polishgeeks-dev-tools_spec.rb → polish_geeks/dev_tools_spec.rb} +2 -2
  85. data/spec/spec_helper.rb +1 -1
  86. metadata +141 -99
  87. data/lib/polishgeeks/dev-tools/commands/readme.rb +0 -32
  88. data/spec/lib/polishgeeks/dev-tools/commands/base_spec.rb +0 -55
  89. data/spec/lib/polishgeeks/dev-tools/commands/brakeman_spec.rb +0 -96
  90. data/spec/lib/polishgeeks/dev-tools/commands/readme_spec.rb +0 -38
  91. data/spec/lib/polishgeeks/dev-tools/commands/rspec_spec.rb +0 -63
  92. data/spec/lib/polishgeeks/dev-tools/commands/rubocop_spec.rb +0 -127
  93. data/spec/lib/polishgeeks/dev-tools/commands/simplecov_spec.rb +0 -134
@@ -0,0 +1,106 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe PolishGeeks::DevTools::Commands::Rspec do
4
+ subject { described_class.new }
5
+
6
+ describe '#execute' do
7
+ let(:instance) { instance_double(PolishGeeks::DevTools::Shell) }
8
+
9
+ context 'when we run rspec' do
10
+ before do
11
+ allow(PolishGeeks::DevTools::Shell).to receive(:new) { instance }
12
+ expect(instance).to receive(:execute)
13
+ .with('bundle exec rspec spec')
14
+ end
15
+
16
+ it { subject.execute }
17
+ end
18
+ end
19
+
20
+ describe '#valid?' do
21
+ context 'when there are failures' do
22
+ before { subject.instance_variable_set(:@output, '2 failures') }
23
+
24
+ it { expect(subject.valid?).to eq false }
25
+ end
26
+
27
+ context 'when there are no failures' do
28
+ before { subject.instance_variable_set(:@output, '0 failures') }
29
+
30
+ it { expect(subject.valid?).to eq true }
31
+ end
32
+
33
+ context 'when there are no failures' do
34
+ let(:config) { double }
35
+
36
+ context 'and disallow pending false' do
37
+ before do
38
+ expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
39
+ expect(config).to receive(:rspec_disallow_pending?) { false }
40
+ subject.instance_variable_set(:@output, '0 failures, 2 pending')
41
+ end
42
+
43
+ it { expect(subject.valid?).to eq true }
44
+ end
45
+
46
+ context 'and disallow pending true' do
47
+ before do
48
+ expect(PolishGeeks::DevTools::Config).to receive(:config) { config }
49
+ expect(config).to receive(:rspec_disallow_pending?) { true }
50
+ end
51
+
52
+ context 'and there are pendings' do
53
+ before do
54
+ subject.instance_variable_set(:@output, '0 failures, 2 pending')
55
+ end
56
+
57
+ it { expect(subject.valid?).to eq false }
58
+ end
59
+
60
+ context 'and there are no pendings' do
61
+ before do
62
+ subject.instance_variable_set(:@output, '0 failures, 0 pending')
63
+ end
64
+
65
+ it { expect(subject.valid?).to eq true }
66
+ end
67
+ end
68
+ end
69
+ end
70
+
71
+ describe '#label' do
72
+ context 'when we run rspec' do
73
+ let(:label) { '10 examples, 5 failures, 2 pending' }
74
+
75
+ before { subject.instance_variable_set(:@output, label) }
76
+
77
+ it { expect(subject.label).to eq 'Rspec (10 ex, 5 fa, 2 pe)' }
78
+ end
79
+ end
80
+
81
+ describe '#examples_count' do
82
+ before { subject.instance_variable_set(:@output, '10 examples') }
83
+
84
+ it { expect(subject.send(:examples_count)).to eq(10) }
85
+ end
86
+
87
+ describe '#failures_count' do
88
+ before { subject.instance_variable_set(:@output, '10 failures') }
89
+
90
+ it { expect(subject.send(:failures_count)).to eq(10) }
91
+ end
92
+
93
+ describe '#pending_count' do
94
+ before { subject.instance_variable_set(:@output, '10 pending') }
95
+
96
+ it { expect(subject.send(:pending_count)).to eq(10) }
97
+ end
98
+
99
+ describe '.generator?' do
100
+ it { expect(described_class.generator?).to eq false }
101
+ end
102
+
103
+ describe '.validator?' do
104
+ it { expect(described_class.validator?).to eq true }
105
+ end
106
+ end
@@ -0,0 +1,131 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe PolishGeeks::DevTools::Commands::Rubocop do
4
+ subject { described_class.new }
5
+ let(:config) { double }
6
+ before { allow(PolishGeeks::DevTools::Config).to receive(:config) { config } }
7
+
8
+ describe '#execute' do
9
+ let(:instance) { instance_double(PolishGeeks::DevTools::Shell) }
10
+ let(:path) { '/' }
11
+
12
+ before do
13
+ expect(ENV)
14
+ .to receive(:[])
15
+ .with('BUNDLE_GEMFILE')
16
+ .and_return(path)
17
+ .at_least(:once)
18
+ allow(PolishGeeks::DevTools::Shell).to receive(:new) { instance }
19
+ end
20
+
21
+ context 'when app config exists' do
22
+ let(:cmd) do
23
+ "bundle exec rubocop #{PolishGeeks::DevTools.app_root}" \
24
+ " -c #{subject.class.config_manager.path}" \
25
+ ' --require rubocop-rspec'
26
+ end
27
+
28
+ before do
29
+ expect(config).to receive(:rubocop_rspec?) { true }
30
+ allow(subject.class.config_manager).to receive(:application?) { true }
31
+ allow(subject.class.config_manager).to receive(:application_path) { path }
32
+ expect(instance).to receive(:execute).with(cmd)
33
+ end
34
+
35
+ it { subject.execute }
36
+ end
37
+
38
+ context 'when app config does not exist' do
39
+ let(:path) { Dir.pwd }
40
+ let(:cmd) do
41
+ "bundle exec rubocop #{PolishGeeks::DevTools.app_root} " \
42
+ "-c #{subject.class.config_manager.path}"
43
+ end
44
+
45
+ before do
46
+ allow(PolishGeeks::DevTools).to receive(:gem_root).and_return(path)
47
+ expect(config).to receive(:rubocop_rspec?) { false }
48
+ allow(subject.class.config_manager).to receive(:application?) { false }
49
+ allow(subject.class.config_manager).to receive(:local_path) { path }
50
+ expect(instance).to receive(:execute).with(cmd)
51
+ end
52
+
53
+ it { subject.execute }
54
+ end
55
+ end
56
+
57
+ describe '#valid?' do
58
+ context 'when offenses count is equal 0' do
59
+ before do
60
+ expect(subject)
61
+ .to receive(:offenses_count)
62
+ .and_return(0)
63
+ end
64
+
65
+ it 'returns true' do
66
+ expect(subject.valid?).to eq true
67
+ end
68
+ end
69
+
70
+ context 'when offenses count is different from 0' do
71
+ before do
72
+ expect(subject)
73
+ .to receive(:offenses_count)
74
+ .and_return(100)
75
+ end
76
+
77
+ it 'returns false' do
78
+ expect(subject.valid?).to eq false
79
+ end
80
+ end
81
+ end
82
+
83
+ describe '#label' do
84
+ before do
85
+ expect(subject).to receive(:files_count) { 10 }
86
+ expect(subject).to receive(:offenses_count) { 5 }
87
+ end
88
+
89
+ context 'when we run rubocop' do
90
+ before { expect(config).to receive(:rubocop_rspec?) { false } }
91
+ it { expect(subject.label).to eq 'Rubocop (10 files, 5 offenses)' }
92
+ end
93
+
94
+ context 'when we run rubocop with rspec' do
95
+ before { expect(config).to receive(:rubocop_rspec?) { true } }
96
+ it { expect(subject.label).to eq 'Rubocop with RSpec (10 files, 5 offenses)' }
97
+ end
98
+ end
99
+
100
+ describe '#files_count' do
101
+ context 'when we count files' do
102
+ before do
103
+ subject.instance_variable_set(:@output, '10 files inspected')
104
+ end
105
+
106
+ it 'returns a proper value' do
107
+ expect(subject.send(:files_count)).to eq 10
108
+ end
109
+ end
110
+ end
111
+
112
+ describe '#offenses_count' do
113
+ context 'when we count offenses' do
114
+ before do
115
+ subject.instance_variable_set(:@output, '5 offenses detected')
116
+ end
117
+
118
+ it 'returns a proper value' do
119
+ expect(subject.send(:offenses_count)).to eq 5
120
+ end
121
+ end
122
+ end
123
+
124
+ describe '.generator?' do
125
+ it { expect(described_class.generator?).to eq false }
126
+ end
127
+
128
+ describe '.validator?' do
129
+ it { expect(described_class.validator?).to eq true }
130
+ end
131
+ end
@@ -4,14 +4,16 @@ RSpec.describe PolishGeeks::DevTools::Commands::Rubycritic do
4
4
  subject { described_class.new }
5
5
 
6
6
  describe '#execute' do
7
+ let(:instance) { instance_double(PolishGeeks::DevTools::Shell) }
8
+
7
9
  context 'when we run rubycritic' do
8
10
  before do
9
- expect_any_instance_of(PolishGeeks::DevTools::Shell)
10
- .to receive(:execute)
11
+ allow(PolishGeeks::DevTools::Shell).to receive(:new) { instance }
12
+ expect(instance).to receive(:execute)
11
13
  .with('bundle exec rubycritic ./app ./lib/')
12
14
  end
13
15
 
14
- it 'should execute the command' do
16
+ it 'executes the command' do
15
17
  subject.execute
16
18
  end
17
19
  end
@@ -0,0 +1,136 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe PolishGeeks::DevTools::Commands::Simplecov do
4
+ context 'class' do
5
+ subject { described_class }
6
+
7
+ describe '#validators' do
8
+ it 'works only when we have Simplecov' do
9
+ expect(subject.validators).to eq [PolishGeeks::DevTools::Validators::Simplecov]
10
+ end
11
+ end
12
+ end
13
+
14
+ context 'instance' do
15
+ subject { described_class.new }
16
+
17
+ let(:label) { '(95.00%) covered' }
18
+ let(:config) { double }
19
+
20
+ describe '#to_f' do
21
+ context 'when we run simplecov' do
22
+ before do
23
+ subject.instance_variable_set(:@output, label)
24
+ end
25
+
26
+ it 'returns number of coverage as a float value' do
27
+ expect(subject.to_f).to eq 95.00
28
+ end
29
+ end
30
+ end
31
+
32
+ describe '#execute' do
33
+ context 'when we run simplecov' do
34
+ let(:output) { OpenStruct.new(rspec: label) }
35
+
36
+ before do
37
+ subject.instance_variable_set(:@stored_output, output)
38
+ end
39
+
40
+ it 'executes the command' do
41
+ expect(subject.execute).to eq label
42
+ end
43
+ end
44
+ end
45
+
46
+ describe '#valid?' do
47
+ context 'when cc level is greater or equal than expected' do
48
+ before do
49
+ expect(subject)
50
+ .to receive(:to_f)
51
+ .and_return(95.0)
52
+ expect(PolishGeeks::DevTools::Config)
53
+ .to receive(:config)
54
+ .and_return(config)
55
+ expect(config)
56
+ .to receive(:simplecov_threshold)
57
+ .and_return(65.0)
58
+ end
59
+
60
+ it 'returns true' do
61
+ expect(subject.valid?).to eq true
62
+ end
63
+ end
64
+
65
+ context 'when cc level is less than expected' do
66
+ before do
67
+ expect(subject)
68
+ .to receive(:to_f)
69
+ .and_return(65.0)
70
+ expect(PolishGeeks::DevTools::Config)
71
+ .to receive(:config)
72
+ .and_return(config)
73
+ expect(config)
74
+ .to receive(:simplecov_threshold)
75
+ .and_return(95.0)
76
+ end
77
+
78
+ it 'returns false' do
79
+ expect(subject.valid?).to eq false
80
+ end
81
+ end
82
+ end
83
+
84
+ describe '#label' do
85
+ context 'when we run simplecov and cc is greater or equal than expected' do
86
+ before do
87
+ expect(subject)
88
+ .to receive(:to_f)
89
+ .and_return(95.0)
90
+ expect(PolishGeeks::DevTools::Config)
91
+ .to receive(:config)
92
+ .and_return(config)
93
+ expect(config)
94
+ .to receive(:simplecov_threshold)
95
+ .and_return(65.0)
96
+ end
97
+
98
+ it 'returns the label' do
99
+ expect(subject.label).to eq 'SimpleCov covered 95.0%, required 65.0%'
100
+ end
101
+ end
102
+ end
103
+
104
+ describe '#error_message' do
105
+ context 'when we run simplecov and cc is less than expected' do
106
+ before { allow(subject).to receive(:to_f) { 65.0 } }
107
+
108
+ context 'and threshold is 95%' do
109
+ before { allow(subject).to receive(:threshold) { 95.0 } }
110
+
111
+ it 'returns the error message' do
112
+ expect(subject.error_message)
113
+ .to eq 'SimpleCov coverage level needs to be 95.0% or more, was 65.0%'
114
+ end
115
+ end
116
+
117
+ context 'and threshold is 100%' do
118
+ before { allow(subject).to receive(:threshold) { 100.0 } }
119
+
120
+ it 'returns the error message' do
121
+ expect(subject.error_message)
122
+ .to eq 'SimpleCov coverage level needs to be 100.0%, was 65.0%'
123
+ end
124
+ end
125
+ end
126
+ end
127
+
128
+ describe '.generator?' do
129
+ it { expect(described_class.generator?).to eq false }
130
+ end
131
+
132
+ describe '.validator?' do
133
+ it { expect(described_class.validator?).to eq true }
134
+ end
135
+ end
136
+ end
@@ -68,12 +68,12 @@ RSpec.describe PolishGeeks::DevTools::Commands::TasksFilesNames do
68
68
  )
69
69
  end
70
70
 
71
- it 'should not be empty' do
72
- expect(subject.send(:files, dummy_type)).to_not be_empty
71
+ it 'does not be empty' do
72
+ expect(subject.send(:files, dummy_type)).not_to be_empty
73
73
  end
74
74
 
75
- it 'should not contain directories' do
76
- expect(subject.send(:files, dummy_type)).to_not include('command')
75
+ it 'does not contain directories' do
76
+ expect(subject.send(:files, dummy_type)).not_to include('command')
77
77
  end
78
78
  end
79
79
 
@@ -93,16 +93,16 @@ RSpec.describe PolishGeeks::DevTools::Commands::TasksFilesNames do
93
93
  .and_return(example_rake_files)
94
94
  end
95
95
 
96
- it 'should set counter' do
96
+ it 'sets counter' do
97
97
  expected = example_cap_files.count + example_rake_files.count
98
98
  subject.execute
99
99
  expect(subject.counter).to eq expected
100
100
  end
101
101
 
102
- it 'should mark all inapropriate files' do
102
+ it 'marks all inapropriate files' do
103
103
  subject.execute
104
- expect(subject.output).to_not include('test.cap')
105
- expect(subject.output).to_not include('test.rake')
104
+ expect(subject.output).not_to include('test.cap')
105
+ expect(subject.output).not_to include('test.rake')
106
106
  end
107
107
  end
108
108
  end
@@ -4,17 +4,17 @@ RSpec.describe PolishGeeks::DevTools::Commands::Yard do
4
4
  subject { described_class.new }
5
5
 
6
6
  describe '#execute' do
7
+ let(:instance) { instance_double(PolishGeeks::DevTools::Shell) }
8
+
7
9
  context 'when we run yard' do
8
10
  before do
9
- expect(subject)
10
- .to receive(:options)
11
- .and_return('--list-undoc')
12
- expect_any_instance_of(PolishGeeks::DevTools::Shell)
13
- .to receive(:execute)
11
+ expect(subject).to receive(:options) { '--list-undoc' }
12
+ allow(PolishGeeks::DevTools::Shell).to receive(:new) { instance }
13
+ expect(instance).to receive(:execute)
14
14
  .with('bundle exec yard stats --list-undoc')
15
15
  end
16
16
 
17
- it 'should execute the command' do
17
+ it 'executes the command' do
18
18
  subject.execute
19
19
  end
20
20
  end
@@ -26,7 +26,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::Yard do
26
26
  subject.instance_variable_set(:@output, 'OK')
27
27
  end
28
28
 
29
- it 'should return true' do
29
+ it 'returns true' do
30
30
  expect(subject.valid?).to eq true
31
31
  end
32
32
  end
@@ -36,7 +36,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::Yard do
36
36
  subject.instance_variable_set(:@output, 'warn')
37
37
  end
38
38
 
39
- it 'should return false' do
39
+ it 'returns false' do
40
40
  expect(subject.valid?).to eq false
41
41
  end
42
42
  end
@@ -46,7 +46,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::Yard do
46
46
  subject.instance_variable_set(:@output, 'undocumented objects')
47
47
  end
48
48
 
49
- it 'should return false' do
49
+ it 'returns false' do
50
50
  expect(subject.valid?).to eq false
51
51
  end
52
52
  end
@@ -70,7 +70,7 @@ RSpec.describe PolishGeeks::DevTools::Commands::Yard do
70
70
  .and_return('--private')
71
71
  end
72
72
 
73
- it 'should return lines with options' do
73
+ it 'returns lines with options' do
74
74
  expect(subject.send(:options)).to eq '--private --list-undoc'
75
75
  end
76
76
  end