mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Remove dependency to Spree::TestingSupport code
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
module OpenFoodNetwork
|
||||
class EnterpriseIssueValidator
|
||||
include Rails.application.routes.url_helpers
|
||||
include Spree::TestingSupport::UrlHelpers
|
||||
|
||||
def initialize(enterprise)
|
||||
@enterprise = enterprise
|
||||
@@ -13,14 +12,14 @@ module OpenFoodNetwork
|
||||
unless shipping_methods_ok?
|
||||
issues << {
|
||||
description: I18n.t('admin.enterprise_issues.has_no_shipping_methods', enterprise: @enterprise.name),
|
||||
link: "<a class='button fullwidth' href='#{spree.new_admin_shipping_method_path}'>#{I18n.t('admin.enterprise_issues.create_new')}</a>"
|
||||
link: "<a class='button fullwidth' href='#{spree_routes_helper.new_admin_shipping_method_path}'>#{I18n.t('admin.enterprise_issues.create_new')}</a>"
|
||||
}
|
||||
end
|
||||
|
||||
unless payment_methods_ok?
|
||||
issues << {
|
||||
description: I18n.t('admin.enterprise_issues.has_no_payment_methods', enterprise: @enterprise.name),
|
||||
link: "<a class='button fullwidth' href='#{spree.new_admin_payment_method_path}'>#{I18n.t('admin.enterprise_issues.create_new')}</a>"
|
||||
link: "<a class='button fullwidth' href='#{spree_routes_helper.new_admin_payment_method_path}'>#{I18n.t('admin.enterprise_issues.create_new')}</a>"
|
||||
}
|
||||
end
|
||||
|
||||
@@ -64,5 +63,9 @@ module OpenFoodNetwork
|
||||
|
||||
@enterprise.payment_methods.available.any?
|
||||
end
|
||||
|
||||
def spree_routes_helper
|
||||
Spree::Core::Engine.routes.url_helpers
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
require 'spec_helper'
|
||||
require 'open_food_network/enterprise_issue_validator'
|
||||
|
||||
module OpenFoodNetwork
|
||||
|
||||
Reference in New Issue
Block a user