Skip to content

Commit

Permalink
Appease Rubocop 👮
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenharman committed May 13, 2024
1 parent e10ca34 commit db9be59
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/brakeman-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ jobs:
# Upload the SARIF file generated in the previous step
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v1
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: output.sarif.json
1 change: 1 addition & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Style/Documentation:
- 'spec/**/*'
- 'test/**/*'
- 'app/controllers/letter_opener_web/letters_controller.rb'
- 'app/controllers/letter_opener_web/application_controller.rb'
- 'app/models/letter_opener_web/letter.rb'
- 'lib/letter_opener_web.rb'
- 'lib/letter_opener_web/delivery_method.rb'
Expand Down
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ gemspec
group :test do
gem 'codecov', require: false
end

gem 'rails', '~> 6.1'
gem 'rspec-rails', '~> 5.0'
gem 'rubocop', '~> 1.22'
gem 'rubocop-rails', '~> 2.12'
gem 'rubocop-rspec', '~> 2.5'
gem 'shoulda-matchers', '~> 5.0'
4 changes: 2 additions & 2 deletions app/controllers/letter_opener_web/letters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def index

def show
text = @letter.send("#{params[:style]}_text")
.gsub(/"plain\.html"/, "\"#{routes.letter_path(id: @letter.id, style: 'plain')}\"")
.gsub(/"rich\.html"/, "\"#{routes.letter_path(id: @letter.id, style: 'rich')}\"")
.gsub('"plain.html"', "\"#{routes.letter_path(id: @letter.id, style: 'plain')}\"")
.gsub('"rich.html"', "\"#{routes.letter_path(id: @letter.id, style: 'rich')}\"")

render html: text.html_safe
end
Expand Down
8 changes: 1 addition & 7 deletions letter_opener_web.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,12 @@ Gem::Specification.new do |gem|

gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
gem.executables = gem.files.grep(%r{^exe/}).map { |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ['lib']

gem.add_dependency 'actionmailer', '>= 5.2'
gem.add_dependency 'letter_opener', '~> 1.7'
gem.add_dependency 'railties', '>= 5.2'
gem.add_dependency 'rexml'

gem.add_development_dependency 'rails', '~> 6.1'
gem.add_development_dependency 'rspec-rails', '~> 5.0'
gem.add_development_dependency 'rubocop', '~> 1.22'
gem.add_development_dependency 'rubocop-rails', '~> 2.12'
gem.add_development_dependency 'rubocop-rspec', '~> 2.5'
gem.add_development_dependency 'shoulda-matchers', '~> 5.0'
gem.metadata['rubygems_mfa_required'] = 'true'
end
2 changes: 1 addition & 1 deletion lib/letter_opener_web/delivery_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module LetterOpenerWeb
class DeliveryMethod < LetterOpener::DeliveryMethod
def deliver!(mail)
original = ENV['LAUNCHY_DRY_RUN']
original = ENV.fetch('LAUNCHY_DRY_RUN', nil)
ENV['LAUNCHY_DRY_RUN'] = 'true'

super
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
config.active_support.disallowed_deprecation_warnings = []

# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
config.log_formatter = Logger::Formatter.new

# Use a different logger for distributed setups.
# require "syslog/logger"
Expand Down
8 changes: 3 additions & 5 deletions spec/models/letter_opener_web/letter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ def rich_text(mail_id)

%w[1111_1111 2222_2222].each do |folder|
FileUtils.mkdir_p("#{location}/#{folder}")
File.open("#{location}/#{folder}/plain.html", 'w') { |f| f.write("Plain text for #{folder}") }
File.open("#{location}/#{folder}/rich.html", 'w') { |f| f.write(rich_text(folder)) }
File.write("#{location}/#{folder}/plain.html", "Plain text for #{folder}")
File.write("#{location}/#{folder}/rich.html", rich_text(folder))
FileUtils.mkdir_p("#{Rails.root.join('tmp', 'letter_opener')}/#{folder}")
File.open("#{Rails.root.join('tmp', 'letter_opener')}/#{folder}/rich.html", 'w') do |f|
f.write("Rich text for #{folder}")
end
File.write("#{Rails.root.join('tmp', 'letter_opener')}/#{folder}/rich.html", "Rich text for #{folder}")
end
end

Expand Down

0 comments on commit db9be59

Please sign in to comment.