Skip to content

Commit

Permalink
Remove Test ENV condition
Browse files Browse the repository at this point in the history
  • Loading branch information
stanleylhs committed Sep 20, 2024
1 parent 0784b41 commit ca4e087
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 22 deletions.
4 changes: 1 addition & 3 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ def upload_avatar
end
end
responds_to_parent do
# Without return RSpec2 screams bloody murder about rendering twice:
# within the block and after yield in responds_to_parent.
render && (return if Rails.env.test?)
render
end
end
end
Expand Down
16 changes: 7 additions & 9 deletions lib/fat_free_crm/gem_ext/action_controller/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
unless Rails.env.test?
class ActionController::Base
# Remove helpers residing in subdirectories from the list of application
# helpers. Basically we don't want helpers in app/helpers/admin/* to
# override the ones in app/helpers/*.
#----------------------------------------------------------------------------
def self.all_application_helpers
super.delete_if { |helper| helper.include?(File::SEPARATOR) }
end
class ActionController::Base
# Remove helpers residing in subdirectories from the list of application
# helpers. Basically we don't want helpers in app/helpers/admin/* to
# override the ones in app/helpers/*.
#----------------------------------------------------------------------------
def self.all_application_helpers
super.delete_if { |helper| helper.include?(File::SEPARATOR) }
end
end
16 changes: 6 additions & 10 deletions lib/fat_free_crm/mail_processor/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,8 @@ def with_new_emails
discard(uid)
end
rescue Exception => e
if %w[test development].include?(Rails.env)
warn e
warn e.backtrace
end
warn e
warn e.backtrace
log "error processing email: #{e.inspect}", email
discard(uid)
end
Expand Down Expand Up @@ -181,12 +179,10 @@ def sender_has_permissions_for?(asset)
# Centralized logging.
#--------------------------------------------------------------------------------------
def log(message, email = nil)
unless %w[test cucumber].include?(Rails.env)
klass = self.class.to_s.split("::").last
klass << " [Dry Run]" if @dry_run
puts "[#{Time.now.rfc822}] #{klass}: #{message}"
puts "[#{Time.now.rfc822}] #{klass}: From: #{email.from}, Subject: #{email.subject} (#{email.message_id})" if email
end
klass = self.class.to_s.split("::").last
klass << " [Dry Run]" if @dry_run
Rails.logger.info("[#{Time.now.rfc822}] #{klass}: #{message}")
Rails.logger.info("[#{Time.now.rfc822}] #{klass}: From: #{email.from}, Subject: #{email.subject} (#{email.message_id})") if email
end

# Returns the plain-text version of an email, or strips html tags
Expand Down

0 comments on commit ca4e087

Please sign in to comment.