-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed ENABLE_OJ from tests and travis config
- Loading branch information
Showing
5 changed files
with
36 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,5 @@ matrix: | |
- rvm: 3.0 | ||
gemfile: ci-gemfiles/ruby-3.0 | ||
env: | ||
- ENABLE_OJ=true | ||
- RUN_RUBOCOP=true | ||
- RUN_CODECOV=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'oj' | ||
require_relative '../../test_helper' | ||
require 'pagy/extras/shared' | ||
|
||
require_relative 'shared_test' |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 \ | ||
"<script type=\"application/json\" class=\"pagy-json\">[\"test_function\",\"some-id\",\"some-string\",123,true,null]</script>" | ||
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 \ | ||
"<script type=\"application/json\" class=\"pagy-json\">[\"test_function\",\"some-id\",\"some-string\",123,true,null]</script>" | ||
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("<a href=\"/foo?page=__pagy_page__\" style=\"display: none;\"></a>") | ||
pagy = Pagy.new(count: 100, page: 4, page_param: 'p') | ||
_(view.pagy_marked_link(view.pagy_link_proc(pagy))).must_equal("<a href=\"/foo?p=__pagy_page__\" style=\"display: none;\"></a>") | ||
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("<a href=\"/foo?page=__pagy_page__\" style=\"display: none;\"></a>") | ||
pagy = Pagy.new(count: 100, page: 4, page_param: 'p') | ||
_(view.pagy_marked_link(view.pagy_link_proc(pagy))).must_equal("<a href=\"/foo?p=__pagy_page__\" style=\"display: none;\"></a>") | ||
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 |