From 6dd4a866e5188367ea4205fbf8553ee7001048c6 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Fri, 17 Apr 2020 17:00:11 +0200 Subject: [PATCH] Address some Rubocop violations --- .rubocop_todo.yml | 2 -- app/mailers/producer_mailer.rb | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 6b7b8ddfde..3d3889f7d0 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -173,7 +173,6 @@ Naming/MethodParameterName: Naming/PredicateName: Exclude: - 'spec/**/*' - - 'app/mailers/producer_mailer.rb' - 'app/models/enterprise.rb' - 'app/models/enterprise_relationship.rb' - 'app/models/order_cycle.rb' @@ -630,7 +629,6 @@ Style/FrozenStringLiteralComment: - 'app/jobs/subscription_placement_job.rb' - 'app/jobs/welcome_enterprise_job.rb' - 'app/mailers/enterprise_mailer.rb' - - 'app/mailers/producer_mailer.rb' - 'app/mailers/spree/base_mailer_decorator.rb' - 'app/mailers/spree/order_mailer_decorator.rb' - 'app/mailers/spree/user_mailer.rb' diff --git a/app/mailers/producer_mailer.rb b/app/mailers/producer_mailer.rb index ee4e25bce5..5fc8e6419d 100644 --- a/app/mailers/producer_mailer.rb +++ b/app/mailers/producer_mailer.rb @@ -17,7 +17,7 @@ class ProducerMailer < Spree::BaseMailer order_cycle_subject = I18n.t('producer_mailer.order_cycle.subject', producer: producer.name) subject = "[#{Spree::Config.site_name}] #{order_cycle_subject}" - return unless has_orders?(order_cycle, producer) + return unless orders?(order_cycle, producer) mail( to: @producer.contact.email, @@ -32,7 +32,7 @@ class ProducerMailer < Spree::BaseMailer private - def has_orders?(order_cycle, producer) + def orders?(order_cycle, producer) line_items_from(order_cycle, producer).any? end