Skip to content

Commit

Permalink
Rubocop fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
elohanlon committed Dec 17, 2024
1 parent 9482955 commit f8881a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
10 changes: 6 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ Metrics/ClassLength:
Metrics/MethodLength:
Exclude:
- lib/atc/aip_reader.rb
- 'lib/atc/loaders/checksum_loader.rb'
- 'lib/atc/utils/aws_multipart_checksum_utils.rb'
- 'lib/atc/aws/s3_uploader.rb'
- 'lib/atc/utils/aws_checksum_utils.rb'
- lib/atc/directory_reader.rb
- lib/atc/loaders/checksum_loader.rb
- lib/atc/utils/aws_multipart_checksum_utils.rb
- lib/atc/aws/s3_uploader.rb
- lib/atc/utils/aws_checksum_utils.rb

Rails/Output:
Exclude:
- 'lib/atc/aws/s3_uploader.rb'
- 'lib/atc/aip_reader.rb'
- 'lib/atc/directory_reader.rb'

Lint/MissingCopEnableDirective:
Enabled: false
Expand Down
14 changes: 10 additions & 4 deletions spec/atc/directory_reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

let(:path_to_directory_fixture_copy) do
tmpdir_path = Dir.mktmpdir('sample_directory_')
FileUtils.cp_r("#{file_fixture('sample_directory')}/.", tmpdir_path) # copy the CONTENTS of path_to_directory_fixture to tmpdir_path
# copy the CONTENTS of path_to_directory_fixture to tmpdir_path
FileUtils.cp_r("#{file_fixture('sample_directory')}/.", tmpdir_path)
tmpdir_path
end

Expand Down Expand Up @@ -51,13 +52,18 @@
expect(described_class.generate_file_list(path_to_directory_fixture_copy).sort).to eq(expected_file_list.sort)
end

it 'raises an exception when some files in the directory are not readable, and the error message lists the unreadable files' do
it 'raises an exception when some files in the directory are not readable, '\
'and the error message lists the unreadable files' do
# all files readable by default
allow(File).to receive(:readable?).and_return(true)
# pretend that sample-file1.txt is not readable
allow(File).to receive(:readable?).with(File.join(path_to_directory_fixture_copy, 'sample-file1.txt')).and_return(false)
allow(File).to receive(:readable?).with(
File.join(path_to_directory_fixture_copy, 'sample-file1.txt')
).and_return(false)
# pretend that sample-file2.txt is not readable
allow(File).to receive(:readable?).with(File.join(path_to_directory_fixture_copy, 'sample-file2.txt')).and_return(false)
allow(File).to receive(:readable?).with(
File.join(path_to_directory_fixture_copy, 'sample-file2.txt')
).and_return(false)
expect {
described_class.generate_file_list(path_to_directory_fixture_copy)
}.to raise_error(
Expand Down

0 comments on commit f8881a1

Please sign in to comment.