Skip to content

Commit

Permalink
Address linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
phinze committed Sep 6, 2024
1 parent 2e9d99f commit 6c25631
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion lib/mjml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def self.check_for_custom_mjml_binary
def self.check_for_mjml_package(package_manager, bin_command, binary_path)
stdout, _, status = Open3.capture3("which #{package_manager}")
return unless status.success?

pm_bin = stdout.chomp

stdout, _, status = Open3.capture3("#{pm_bin} #{bin_command}")
Expand All @@ -94,14 +95,16 @@ def self.check_for_package_mjml_binary
end

def self.check_for_global_mjml_binary
stdout, _, status = Open3.capture3("which mjml")
stdout, _, status = Open3.capture3('which mjml')
return unless status.success?

mjml_bin = stdout.chomp
return mjml_bin if mjml_bin.present? && check_version(mjml_bin)
end

def self.check_for_mrml_binary
return unless Mjml.use_mrml

MRML.present?
rescue NameError
Mjml.mjml_binary_error_string = 'Couldn\'t find MRML - did you add \'mrml\' to your Gemfile?'
Expand Down
8 changes: 4 additions & 4 deletions test/mjml_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ class NotifierMailerTest < ActiveSupport::TestCase
expect(Mjml.mjml_binary_error_string).must_equal 'Couldn\'t find MRML - did you add \'mrml\' to your Gemfile?'
end

it "with nothing on the path, sets valid_mjml_binary to nil" do
old_path = ENV["PATH"]
ENV["PATH"] = "./test/fixtures/valid-mjml-binary/empty-path/"
it 'with nothing on the path, sets valid_mjml_binary to nil' do
old_path = ENV['PATH']
ENV['PATH'] = './test/fixtures/valid-mjml-binary/empty-path/'

Mjml.stubs(:puts) # silence printed error message from test output
assert_nil(Mjml.valid_mjml_binary)
ensure
ENV["PATH"] = old_path
ENV['PATH'] = old_path
end
end
end

0 comments on commit 6c25631

Please sign in to comment.