From 3eef450e51a83bc5d0663911bbec059ebf38749c Mon Sep 17 00:00:00 2001
From: Domizio Demichelis
Date: Thu, 8 Apr 2021 19:53:32 +0700
Subject: [PATCH] Simpler test for I18n namespace conflict
---
test/mock_helpers/application_helper.rb | 8 --------
test/mock_helpers/view.rb | 4 ++++
test/pagy/extras/i18n_test.rb | 8 +++-----
3 files changed, 7 insertions(+), 13 deletions(-)
delete mode 100644 test/mock_helpers/application_helper.rb
diff --git a/test/mock_helpers/application_helper.rb b/test/mock_helpers/application_helper.rb
deleted file mode 100644
index b742b8505..000000000
--- a/test/mock_helpers/application_helper.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-module ApplicationHelper
- include Pagy::Frontend
-
- def any_method_name()
- I18n.t("test")
- end
-
-end
\ No newline at end of file
diff --git a/test/mock_helpers/view.rb b/test/mock_helpers/view.rb
index e7d0fa897..6909d7ad0 100644
--- a/test/mock_helpers/view.rb
+++ b/test/mock_helpers/view.rb
@@ -8,6 +8,10 @@ def initialize(url='http://example.com:3000/foo?page=2')
@url = url
end
+ def test_i18n_call
+ I18n.t('test')
+ end
+
def request
Rack::Request.new(Rack::MockRequest.env_for(@url))
end
diff --git a/test/pagy/extras/i18n_test.rb b/test/pagy/extras/i18n_test.rb
index 4975a362d..33766bd73 100644
--- a/test/pagy/extras/i18n_test.rb
+++ b/test/pagy/extras/i18n_test.rb
@@ -7,16 +7,14 @@
SimpleCov.command_name 'i18n' if ENV['RUN_SIMPLECOV'] == 'true'
-require_relative '../../mock_helpers/application_helper'
-include ApplicationHelper
-
describe Pagy::Frontend do
let(:view) { MockView.new }
describe "#pagy_t with I18n" do
- it 'works with an included Module' do
- ApplicationHelper.any_method_name()
+
+ it 'does not conflict with the I18n gem namespace' do
+ view.test_i18n_call
end
it 'pluralizes' do