From 9efb9084045536b037e8c310a29029ef2f0f21e4 Mon Sep 17 00:00:00 2001 From: Domizio Demichelis Date: Fri, 9 Apr 2021 14:59:36 +0700 Subject: [PATCH] removed ENABLE_OJ from tests and travis config --- .travis.yml | 1 - Rakefile | 3 +- test/pagy/extras/oj_shared_test.rb | 7 +++ ...ombo_test.rb => shared_items_trim_test.rb} | 0 test/pagy/extras/shared_test.rb | 60 +++++++++---------- 5 files changed, 36 insertions(+), 35 deletions(-) create mode 100644 test/pagy/extras/oj_shared_test.rb rename test/pagy/extras/{shared_combo_test.rb => shared_items_trim_test.rb} (100%) diff --git a/.travis.yml b/.travis.yml index 5e57a6c44..ffb5501df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,5 @@ matrix: - rvm: 3.0 gemfile: ci-gemfiles/ruby-3.0 env: - - ENABLE_OJ=true - RUN_RUBOCOP=true - RUN_CODECOV=true diff --git a/Rakefile b/Rakefile index 69ab8db06..4904d4e3f 100644 --- a/Rakefile +++ b/Rakefile @@ -25,8 +25,9 @@ define_test_task :test_extra_overflow, 'test/**/overflow_test.rb' define_test_task :test_extra_trim, 'test/**/trim_test.rb' define_test_task :test_extra_elasticsearch, 'test/**/elasticsearch_rails_test.rb', 'test/**/searchkick_test.rb' define_test_task :test_support, 'test/**/support_test.rb' +define_test_task :test_shared,'test/**/oj_shared_test.rb' define_test_task :test_shared,'test/**/shared_test.rb' -define_test_task :test_shared_combo, 'test/**/shared_combo_test.rb' +define_test_task :test_shared_items_trim, 'test/**/shared_items_trim_test.rb' # We exclude the files of the other tasks from the :test_main task Rake::TestTask.new(:test_main) do |t| diff --git a/test/pagy/extras/oj_shared_test.rb b/test/pagy/extras/oj_shared_test.rb new file mode 100644 index 000000000..22ece17cd --- /dev/null +++ b/test/pagy/extras/oj_shared_test.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'oj' +require_relative '../../test_helper' +require 'pagy/extras/shared' + +require_relative 'shared_test' diff --git a/test/pagy/extras/shared_combo_test.rb b/test/pagy/extras/shared_items_trim_test.rb similarity index 100% rename from test/pagy/extras/shared_combo_test.rb rename to test/pagy/extras/shared_items_trim_test.rb diff --git a/test/pagy/extras/shared_test.rb b/test/pagy/extras/shared_test.rb index 08c096080..a878ef86b 100644 --- a/test/pagy/extras/shared_test.rb +++ b/test/pagy/extras/shared_test.rb @@ -1,53 +1,47 @@ # frozen_string_literal: true -if ENV['ENABLE_OJ'] == 'true' +require_relative '../../test_helper' +require 'pagy/extras/shared' - require_relative '../../test_helper' - require 'oj' # all the other tests run without Oj - require 'pagy/extras/shared' +describe Pagy::Frontend do - describe Pagy::Frontend do + let(:view) { MockView.new('http://example.com:3000/foo?') } - let(:view) { MockView.new('http://example.com:3000/foo?') } - - describe '#pagy_json_tag' do - - it 'should use oj' do - _(view.pagy_json_tag(Pagy.new(count: 10), :test_function, 'some-id', 'some-string', 123, true)).must_equal \ - "" - end + describe '#pagy_json_tag' do + it 'should use oj/json' do + _(view.pagy_json_tag(Pagy.new(count: 10), :test_function, 'some-id', 'some-string', 123, true)).must_equal \ + "" end + end - describe '#pagy_id' do - - it 'should return different SHA1 ids' do - id1 = call_pagy_id - id2 = call_pagy_id - _(id1).must_be_kind_of String - _(id2).must_be_kind_of String - _(id1).must_be :!=, id2 - end + describe '#pagy_id' do + it 'should return different SHA1 ids' do + id1 = call_pagy_id + id2 = call_pagy_id + _(id1).must_be_kind_of String + _(id2).must_be_kind_of String + _(id1).must_be :!=, id2 end - describe '#pagy_marked_link' do + end - it 'should return only the "standard" link' do - pagy = Pagy.new(count: 100, page: 4) - _(view.pagy_marked_link(view.pagy_link_proc(pagy))).must_equal("") - pagy = Pagy.new(count: 100, page: 4, page_param: 'p') - _(view.pagy_marked_link(view.pagy_link_proc(pagy))).must_equal("") - end + describe '#pagy_marked_link' do + it 'should return only the "standard" link' do + pagy = Pagy.new(count: 100, page: 4) + _(view.pagy_marked_link(view.pagy_link_proc(pagy))).must_equal("") + pagy = Pagy.new(count: 100, page: 4, page_param: 'p') + _(view.pagy_marked_link(view.pagy_link_proc(pagy))).must_equal("") end - # we need an intermediate call to get the right caller - def call_pagy_id - view.pagy_id - end + end + # we need an intermediate call to get the right caller + def call_pagy_id + view.pagy_id end end