Skip to content

Commit

Permalink
Fix rubocop errors
Browse files Browse the repository at this point in the history
  • Loading branch information
benbaumann95 committed Jul 22, 2020
1 parent 733685d commit 341a94e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/controllers/concerns/file_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ def upload_csv_to_s3(basename, body)

directory = connection.directories.get(ENV["AWS_CSV_EXPORT_BUCKET_NAME"])

timestamp = Time.now.utc.strftime("%Y-%m-%d-%H-%M-%S")
timestamp = Time.zone.now.utc.strftime("%Y-%m-%d-%H-%M-%S")
filename = "#{basename}.csv"
key = "#{timestamp}/#{filename}"

# rubocop:disable Rails/SaveBang
file = directory.files.create(
key: key,
body: body,
public: true,
content_disposition: "attachment; filename=\"#{filename}\"",
content_type: "text/csv",
)
# rubocop:enable Rails/SaveBang

file.public_url
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/metrics_formatter_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ def format_duration(minutes)
return nil unless minutes

dur = ActiveSupport::Duration.build(minutes * 60)
Time.at(dur).utc.to_s(:reading_time)
Time.zone.at(dur).utc.to_s(:reading_time)
end
end
2 changes: 2 additions & 0 deletions spec/features/index_page/export_csv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@
aws_secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"],
)
connection.directories.each(&:destroy)
# rubocop:disable Rails/SaveBang
@directory = connection.directories.create(key: ENV["AWS_CSV_EXPORT_BUCKET_NAME"])
# rubocop:enable Rails/SaveBang

allow(GovukStatsd).to receive(:count)

Expand Down
2 changes: 2 additions & 0 deletions spec/workers/concerns/file_storage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
aws_access_key_id: ENV["AWS_ACCESS_KEY_ID"],
aws_secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"],
)
# rubocop:disable Rails/SaveBang
@directory = connection.directories.create(key: ENV["AWS_CSV_EXPORT_BUCKET_NAME"])
# rubocop:enable Rails/SaveBang
end

after do
Expand Down
2 changes: 2 additions & 0 deletions spec/workers/csv_export_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@
aws_access_key_id: ENV["AWS_ACCESS_KEY_ID"],
aws_secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"],
)
# rubocop:disable Rails/SaveBang
@directory = connection.directories.create(key: ENV["AWS_CSV_EXPORT_BUCKET_NAME"])
# rubocop:enable Rails/SaveBang
end

around do |example|
Expand Down

0 comments on commit 341a94e

Please sign in to comment.