Skip to content

Commit 1c5d3df

Browse files
committed
rubocop + composition spec refactoring
1 parent d8f490e commit 1c5d3df

File tree

8 files changed

+10
-20
lines changed

8 files changed

+10
-20
lines changed

lib/bashly/script/argument.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Bashly
44
module Script
55
class Argument < Base
66
include Introspection::Validate
7-
7+
88
class << self
99
def option_keys
1010
@option_keys ||= %i[

spec/bashly/commands/preview_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@
2121
end
2222
end
2323
end
24-
25-

spec/bashly/integration/examples_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
# Allow up to a certain string distance from the approval text in CI
2525
leeway = ENV['CI'] ? 40 : 0
2626

27-
# For certain examples, allow some exceptions (replacements) since they
27+
# For certain examples, allow some exceptions (replacements) since they
2828
# are too volatile (e.g. line number changes)
2929
exceptions = {
30-
'examples/stacktrace' => [/download:\d+/, 'download:<line>'],
30+
'examples/stacktrace' => [/download:\d+/, 'download:<line>'],
3131
'examples/render-mandoc' => [/Version 0.1.0.*download\(1\)/, '<footer>'],
3232
}
3333

spec/bashly/script/argument_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
describe 'composition' do
1010
it 'includes the necessary modules' do
1111
modules = [Script::Introspection::Validate]
12-
modules.each do |mod|
13-
expect(described_class.ancestors).to include(mod)
14-
end
12+
expect(described_class.ancestors).to include(*modules)
1513
end
1614
end
1715

spec/bashly/script/command_spec.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@
1919
Script::Introspection::Flags,
2020
Script::Introspection::Variables,
2121
Script::Introspection::Visibility,
22-
Completions::Command
22+
Completions::Command,
2323
]
24-
modules.each do |mod|
25-
expect(described_class.ancestors).to include(mod)
26-
end
24+
expect(described_class.ancestors).to include(*modules)
2725
end
2826
end
2927

spec/bashly/script/environment_variable_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
describe 'composition' do
1010
it 'includes the necessary modules' do
1111
modules = [Script::Introspection::Visibility, Script::Introspection::Validate]
12-
modules.each do |mod|
13-
expect(described_class.ancestors).to include(mod)
14-
end
12+
expect(described_class.ancestors).to include(*modules)
1513
end
1614
end
1715

spec/bashly/script/flag_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
Script::Introspection::Visibility, Script::Introspection::Validate,
1313
Completions::Flag
1414
]
15-
modules.each do |mod|
16-
expect(described_class.ancestors).to include(mod)
17-
end
15+
expect(described_class.ancestors).to include(*modules)
1816
end
1917
end
2018

spec/bashly/script/introspection/validate_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
let(:fixture) { :validate_array }
2020

2121
it 'returns it as is' do
22-
expect(subject.validate).to eq ['file_exists', 'file_is_writable']
22+
expect(subject.validate).to eq %w[file_exists file_is_writable]
2323
end
2424
end
2525
end
@@ -29,7 +29,7 @@
2929
expect(subject.validate?).to be false
3030
end
3131

32-
context 'when validations are defined' do
32+
context 'when validations are defined' do
3333
let(:fixture) { :validate_string }
3434

3535
it 'returns true' do

0 commit comments

Comments
 (0)