Skip to content

Commit fce3aa6

Browse files
committed
rubocop
1 parent fcf0172 commit fce3aa6

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

lib/completely/commands/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def script
3636

3737
def completions
3838
@completions ||= if config_path == '-'
39-
raise Error, "Nothing is piped on stdin" if $stdin.tty?
39+
raise Error, 'Nothing is piped on stdin' if $stdin.tty?
4040

4141
Completions.read $stdin, function_name: args['--function']
4242
else

lib/completely/commands/generate.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ class Generate < Base
1515
param 'CONFIG_PATH', <<~USAGE
1616
Path to the YAML configuration file [default: completely.yaml].
1717
Use '-' to read from stdin.
18-
18+
1919
Can also be set by an environment variable.
2020
USAGE
2121

2222
param 'OUTPUT_PATH', <<~USAGE
2323
Path to the output bash script.
2424
Use '-' for stdout.
25-
25+
2626
When not provided, the name of the input file will be used with a .bash extension, unless the input is stdin - in this case the default will be to output to stdout.
27-
27+
2828
Can also be set by an environment variable.
2929
USAGE
3030

lib/completely/completions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def patterns
2929
end
3030

3131
def valid?
32-
pattern_prefixes.uniq.count == 1
32+
pattern_prefixes.uniq.one?
3333
end
3434

3535
def script

spec/completely/commands/generate_spec.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@
8989

9090
context 'with stdin and stdout' do
9191
it 'reads config from stdin and writes to stdout' do
92-
allow($stdin).to receive(:tty?).and_return false
93-
allow($stdin).to receive(:read).and_return File.read('completely.yaml')
92+
allow($stdin).to receive_messages(tty?: false, read: File.read('completely.yaml'))
9493

9594
expect { subject.execute %w[generate -] }
9695
.to output_approval('cli/generated-script')
@@ -101,8 +100,7 @@
101100
let(:outfile) { 'spec/tmp/stdin-to-file.bash' }
102101

103102
it 'reads config from stdin and writes to file' do
104-
allow($stdin).to receive(:tty?).and_return false
105-
allow($stdin).to receive(:read).and_return File.read('completely.yaml')
103+
allow($stdin).to receive_messages(tty?: false, read: File.read('completely.yaml'))
106104

107105
expect { subject.execute %W[generate - #{outfile}] }.to output_approval('cli/generate/custom-path-stdin')
108106
expect(File.read outfile).to match_approval('cli/generated-script')

0 commit comments

Comments
 (0)