source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb | Ruby | mit | 4,996 | master | 9,698 | require 'spec_helper'
RSpec.describe 'Acts As Taggable On' do
it "should provide a class method 'taggable?' that is false for untaggable models" do
expect(UntaggableModel).to_not be_taggable
end
describe 'Taggable Method Generation To Preserve Order' do
before(:each) do
TaggableModel.tag_types = ... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | spec/acts_as_taggable_on/utils_spec.rb | Ruby | mit | 4,996 | master | 906 | require 'spec_helper'
RSpec.describe ActsAsTaggableOn::Utils do
describe '#like_operator' do
it 'should return \'ILIKE\' when the adapter is PostgreSQL' do
allow(ActsAsTaggableOn::Utils.connection).to receive(:adapter_name) { 'PostgreSQL' }
expect(ActsAsTaggableOn::Utils.like_operator).to eq('ILIKE')... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | spec/acts_as_taggable_on/acts_as_tagger_spec.rb | Ruby | mit | 4,996 | master | 3,815 | require 'spec_helper'
RSpec.describe 'acts_as_tagger' do
describe 'Tagger Method Generation' do
before(:each) do
@tagger = User.new
end
it 'should add #is_tagger? query method to the class-side' do
expect(User).to respond_to(:is_tagger?)
end
it 'should return true from the class-si... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | spec/acts_as_taggable_on/tag_spec.rb | Ruby | mit | 4,996 | master | 12,751 | require 'spec_helper'
RSpec.shared_examples_for 'without unique index' do
prepend_before(:all) do
ActiveRecord::Migration.suppress_messages { ActiveRecord::Migration.remove_index ActsAsTaggableOn.tags_table, :name }
end
append_after(:all) do
ActsAsTaggableOn::Tag.delete_all
ActiveRecord::Migration.su... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | spec/acts_as_taggable_on/dirty_spec.rb | Ruby | mit | 4,996 | master | 4,208 | require 'spec_helper'
RSpec.describe 'Dirty behavior of taggable objects' do
context 'with un-contexted tags' do
before(:each) do
@taggable = TaggableModel.create(tag_list: 'awesome, epic')
end
context 'when tag_list changed' do
before(:each) do
expect(@taggable.changes).to be_empty
... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | spec/acts_as_taggable_on/related_spec.rb | Ruby | mit | 4,996 | master | 4,374 | require 'spec_helper'
RSpec.describe 'Acts As Taggable On' do
describe 'Related Objects' do
#TODO, shared example
it 'should find related objects based on tag names on context' do
taggable1 = TaggableModel.create!(name: 'Taggable 1',tag_list: 'one, two')
taggable2 = TaggableModel.create!(name: ... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | spec/acts_as_taggable_on/default_parser_spec.rb | Ruby | mit | 4,996 | master | 1,622 | require 'spec_helper'
RSpec.describe ActsAsTaggableOn::DefaultParser do
it '#parse should return empty array if empty array is passed' do
parser = ActsAsTaggableOn::DefaultParser.new([])
expect(parser.parse).to be_empty
end
describe 'Multiple Delimiter' do
before do
@old_delimiter = ActsAsTagg... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | spec/acts_as_taggable_on/single_table_inheritance_spec.rb | Ruby | mit | 4,996 | master | 9,452 | require 'spec_helper'
RSpec.describe 'Single Table Inheritance' do
let(:taggable) { TaggableModel.new(name: 'taggable model') }
let(:inheriting_model) { InheritingTaggableModel.new(name: 'Inheriting Taggable Model') }
let(:altered_inheriting) { AlteredInheritingTaggableModel.new(name: 'Altered Inheriting Model'... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | spec/acts_as_taggable_on/generic_parser_spec.rb | Ruby | mit | 4,996 | master | 431 | require 'spec_helper'
RSpec.describe ActsAsTaggableOn::GenericParser do
it '#parse should return empty array if empty tag string is passed' do
tag_list = ActsAsTaggableOn::GenericParser.new('')
expect(tag_list.parse).to be_empty
end
it '#parse should separate tags by comma' do
tag_list = ActsAsTagga... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | spec/acts_as_taggable_on/tags_helper_spec.rb | Ruby | mit | 4,996 | master | 1,282 | require 'spec_helper'
RSpec.describe ActsAsTaggableOn::TagsHelper do
before(:each) do
@bob = TaggableModel.create(name: 'Bob Jones', language_list: 'ruby, php')
@tom = TaggableModel.create(name: 'Tom Marley', language_list: 'ruby, java')
@eve = TaggableModel.create(name: 'Eve Nodd', language_list: 'ruby,... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | spec/acts_as_taggable_on/tag_list_spec.rb | Ruby | mit | 4,996 | master | 5,864 | require 'spec_helper'
RSpec.describe ActsAsTaggableOn::TagList do
let(:tag_list) { ActsAsTaggableOn::TagList.new('awesome', 'radical') }
let(:another_tag_list) { ActsAsTaggableOn::TagList.new('awesome','crazy', 'alien') }
it { should be_kind_of Array }
describe '#add' do
it 'should be able to be add a ... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | db/migrate/1_setup_acts_as_taggable_on.rb | Ruby | mit | 4,996 | master | 2,843 | # frozen_string_literal: true
# Combined migration for acts_as_taggable_on setup
# Combines migrations 1-7 from acts_as_taggable_on_engine
class SetupActsAsTaggableOn < ActiveRecord::Migration[7.1]
def up
# Create tags table
unless table_exists?(ActsAsTaggableOn.tags_table)
create_table ActsAsTaggableO... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on.rb | Ruby | mit | 4,996 | master | 3,194 | require 'active_record'
require 'active_record/version'
require 'active_support/core_ext/module'
require 'zeitwerk'
loader = Zeitwerk::Loader.for_gem
loader.inflector.inflect "acts-as-taggable-on" => "ActsAsTaggableOn"
loader.setup
begin
require 'rails/engine'
require 'acts-as-taggable-on/engine'
rescue LoadError... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/tasks/install_initializer.rake | Ruby | mit | 4,996 | master | 540 | namespace :acts_as_taggable_on do
namespace :sharded_db do
desc "Install initializer setting custom base class"
task :install_initializer => [:environment, "config/initializers/foo"] do
source = File.join(
Gem.loaded_specs["acts-as-taggable-on"].full_gem_path,
"lib",
"tasks",
... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/tasks/tags_collate_utf8.rake | Ruby | mit | 4,996 | master | 641 | # These rake tasks are to be run by MySql users only, they fix the management of
# binary-encoded strings for tag 'names'. Issues:
# https://github.com/mbleigh/acts-as-taggable-on/issues/623
namespace :acts_as_taggable_on_engine do
namespace :tag_names do
desc "Forcing collate of tag names to utf8_bin"
tas... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/tags_helper.rb | Ruby | mit | 4,996 | master | 442 | # frozen_string_literal: true
module ActsAsTaggableOn
module TagsHelper
# See the wiki for an example using tag_cloud.
def tag_cloud(tags, classes)
return [] if tags.empty?
max_count = tags.max_by(&:taggings_count).taggings_count.to_f
tags.each do |tag|
index = ((tag.taggings_coun... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/tagger.rb | Ruby | mit | 4,996 | master | 2,476 | # frozen_string_literal: true
module ActsAsTaggableOn
module Tagger
extend ActiveSupport::Concern
class_methods do
##
# Make a model a tagger. This allows an instance of a model to claim ownership
# of tags.
#
# Example:
# class User < ActiveRecord::Base
# act... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/tag_list.rb | Ruby | mit | 4,996 | master | 2,823 | # frozen_string_literal: true
require 'active_support/core_ext/module/delegation'
module ActsAsTaggableOn
class TagList < Array
attr_accessor :owner, :parser
def initialize(*args)
@parser = ActsAsTaggableOn.default_parser
add(*args)
end
##
# Add tags to the tag_list. Duplicate or b... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/generic_parser.rb | Ruby | mit | 4,996 | master | 484 | # frozen_string_literal: true
module ActsAsTaggableOn
##
# Returns a new TagList using the given tag string.
#
# Example:
# tag_list = ActsAsTaggableOn::GenericParser.new.parse("One , Two, Three")
# tag_list # ["One", "Two", "Three"]
class GenericParser
def initialize(tag_list)
@tag_list = tag_... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/taggable.rb | Ruby | mit | 4,996 | master | 3,318 | # frozen_string_literal: true
module ActsAsTaggableOn
module Taggable
def taggable?
false
end
##
# This is an alias for calling <tt>acts_as_taggable_on :tags</tt>.
#
# Example:
# class Book < ActiveRecord::Base
# acts_as_taggable
# end
def acts_as_taggable
... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/default_parser.rb | Ruby | mit | 4,996 | master | 2,537 | # frozen_string_literal: true
module ActsAsTaggableOn
##
# Returns a new TagList using the given tag string.
#
# Example:
# tag_list = ActsAsTaggableOn::DefaultParser.parse("One , Two, Three")
# tag_list # ["One", "Two", "Three"]
class DefaultParser < GenericParser
def parse
string = @tag_... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/tag.rb | Ruby | mit | 4,996 | master | 3,744 | # frozen_string_literal: true
module ActsAsTaggableOn
class Tag < ActsAsTaggableOn.base_class.constantize
self.table_name = ActsAsTaggableOn.tags_table
### ASSOCIATIONS:
has_many :taggings, dependent: :destroy, class_name: '::ActsAsTaggableOn::Tagging'
### VALIDATIONS:
validates_presence_of :... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/utils.rb | Ruby | mit | 4,996 | master | 832 | # frozen_string_literal: true
# This module is deprecated and will be removed in the incoming versions
module ActsAsTaggableOn
module Utils
class << self
# Use ActsAsTaggableOn::Tag connection
def connection
ActsAsTaggableOn::Tag.connection
end
def using_postgresql?
conn... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/tagging.rb | Ruby | mit | 4,996 | master | 1,272 | # frozen_string_literal: true
module ActsAsTaggableOn
class Tagging < ActsAsTaggableOn.base_class.constantize # :nodoc:
self.table_name = ActsAsTaggableOn.taggings_table
DEFAULT_CONTEXT = 'tags'
belongs_to :tag, class_name: '::ActsAsTaggableOn::Tag', counter_cache: ActsAsTaggableOn.tags_counter
belo... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/taggable/tagged_with_query.rb | Ruby | mit | 4,996 | master | 596 | # frozen_string_literal: true
module ActsAsTaggableOn
module Taggable
module TaggedWithQuery
def self.build(taggable_model, tag_model, tagging_model, tag_list, options)
if options[:exclude].present?
ExcludeTagsQuery.new(taggable_model, tag_model, tagging_model, tag_list, options).build
... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/taggable/caching.rb | Ruby | mit | 4,996 | master | 1,263 | # frozen_string_literal: true
module ActsAsTaggableOn
module Taggable
module Caching
extend ActiveSupport::Concern
included do
initialize_tags_cache
before_save :save_cached_tag_list
end
class_methods do
def initialize_tags_cache
tag_types.map(&:to_s).e... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/taggable/related.rb | Ruby | mit | 4,996 | master | 3,868 | # frozen_string_literal: true
module ActsAsTaggableOn
module Taggable
module Related
def self.included(base)
base.extend ActsAsTaggableOn::Taggable::Related::ClassMethods
base.initialize_acts_as_taggable_on_related
end
module ClassMethods
def initialize_acts_as_taggable... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/taggable/ownership.rb | Ruby | mit | 4,996 | master | 4,684 | # frozen_string_literal: true
module ActsAsTaggableOn
module Taggable
module Ownership
extend ActiveSupport::Concern
included do
after_save :save_owned_tags
initialize_acts_as_taggable_on_ownership
end
class_methods do
def acts_as_taggable_on(*args)
in... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/taggable/collection.rb | Ruby | mit | 4,996 | master | 10,237 | # frozen_string_literal: true
module ActsAsTaggableOn
module Taggable
module Collection
extend ActiveSupport::Concern
included do
initialize_acts_as_taggable_on_collection
end
class_methods do
def initialize_acts_as_taggable_on_collection
tag_types.map(&:to_s).... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/taggable/core.rb | Ruby | mit | 4,996 | master | 13,232 | # frozen_string_literal: true
module ActsAsTaggableOn
module Taggable
module Core
extend ActiveSupport::Concern
included do
attr_writer :custom_contexts
after_save :save_tags
initialize_acts_as_taggable_on_core
end
class_methods do
def initialize_ac... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/taggable/tagged_with_query/any_tags_query.rb | Ruby | mit | 4,996 | master | 2,835 | # frozen_string_literal: true
module ActsAsTaggableOn
module Taggable
module TaggedWithQuery
class AnyTagsQuery < QueryBase
def build
taggable_model.select(all_fields)
.where(model_has_at_least_one_tag)
.order(Arel.sql(order_conditions))
... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/taggable/tagged_with_query/exclude_tags_query.rb | Ruby | mit | 4,996 | master | 3,003 | # frozen_string_literal: true
module ActsAsTaggableOn
module Taggable
module TaggedWithQuery
class ExcludeTagsQuery < QueryBase
def build
taggable_model.joins(owning_to_tagger)
.where(tags_not_in_list)
.having(tags_that_matches_count)
... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/taggable/tagged_with_query/query_base.rb | Ruby | mit | 4,996 | master | 2,648 | # frozen_string_literal: true
module ActsAsTaggableOn
module Taggable
module TaggedWithQuery
class QueryBase
def initialize(taggable_model, tag_model, tagging_model, tag_list, options)
@taggable_model = taggable_model
@tag_model = tag_model
@tagging_model = taggi... |
github | mbleigh/acts-as-taggable-on | https://github.com/mbleigh/acts-as-taggable-on | lib/acts-as-taggable-on/taggable/tagged_with_query/all_tags_query.rb | Ruby | mit | 4,996 | master | 4,332 | # frozen_string_literal: true
module ActsAsTaggableOn
module Taggable
module TaggedWithQuery
class AllTagsQuery < QueryBase
def build
taggable_model.joins(each_tag_in_list)
.group(by_taggable)
.having(tags_that_matches_count)
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | Gemfile | Ruby | mit | 4,963 | master | 943 | # frozen_string_literal: true
source 'https://rubygems.org'
gemspec path: './gem'
gem 'rake'
group :development, :test do
gem 'activesupport'
gem 'childprocess'
gem 'debug'
gem 'ferrum'
gem 'http' # used by the scripts/contributor-list.rb
gem 'i18n'
gem 'irb'
gem 'minitest'
gem 'minitest-holdify'
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/test_helper.rb | Ruby | mit | 4,963 | master | 656 | # frozen_string_literal: true
require 'simplecov' if ENV['COVERAGE']
$LOAD_PATH.unshift __dir__
$LOAD_PATH.unshift File.expand_path('../gem/lib', __dir__)
require 'pagy'
require 'minitest'
require 'minitest/spec'
Minitest.load :holdify
require 'minitest/autorun'
require 'minitest/mock'
require 'minitest/reporters'
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/test_helper.rb | Ruby | mit | 4,963 | master | 207 | # frozen_string_literal: true
require_relative '../test_helper'
$LOAD_PATH.unshift __dir__
require_relative 'helpers/url_assertions'
require_relative 'helpers/models'
require_relative 'helpers/test_case' |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy_test.rb | Ruby | mit | 4,963 | master | 3,455 | # frozen_string_literal: true
require_relative 'test_helper'
describe 'Pagy Specs' do
it 'has version' do
_(Pagy::VERSION).wont_be_nil
end
it 'has root' do
_(Pagy::ROOT).must_be_kind_of Pathname
end
it 'has default' do
_(Pagy::DEFAULT).must_be_kind_of Hash
_(Pagy::DEFAULT[:limit]).must_equ... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/helpers/test_case.rb | Ruby | mit | 4,963 | master | 257 | # frozen_string_literal: true
require 'minitest/autorun'
class Pagy
class TestCase < Minitest::Spec
def teardown
Pagy::I18n.locale = 'en' # reset to default
super
end
end
end
Minitest::Spec.register_spec_type(/.*/, Pagy::TestCase) |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/helpers/url_assertions.rb | Ruby | mit | 4,963 | master | 645 | # frozen_string_literal: true
require 'uri'
module Minitest
module Assertions
def assert_url_equal(expected, actual, msg = nil)
normalize = lambda do |url_str|
u = URI(url_str)
if u.query
sorted = URI.decode_www_form(u.query).sort
u.query = URI.encode_www_form(sorted)
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/helpers/models.rb | Ruby | mit | 4,963 | master | 16,935 | # frozen_string_literal: true
require 'active_record'
require 'sequel'
require 'sqlite3'
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
Time.zone = 'Etc/UTC'
Sequel.default_timezone = 'Etc/UTC'
DB = Sequel.connect(adapter: 'sqlite', database: ':memory:')
ActiveRecord::Migration.su... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/mocks/meilisearch.rb | Ruby | mit | 4,963 | master | 1,096 | # frozen_string_literal: true
require 'pagy/classes/offset/search'
module MockMeilisearch
RESULTS = { 'a' => ('a-1'..'a-1000').to_a,
'b' => ('b-1'..'b-1000').to_a }.freeze
class Results
attr_reader :options, :term
def initialize(term, options = {})
@term = term
@options = op... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/mocks/searchkick.rb | Ruby | mit | 4,963 | master | 1,199 | # frozen_string_literal: true
require 'pagy/classes/offset/search'
module MockSearchkick
RESULTS = { 'a' => ('a-1'..'a-1000').to_a,
'b' => ('b-1'..'b-1000').to_a }.freeze
class Results
attr_reader :options
def initialize(query, options = {}, &block)
query = 'a' if query == '*' # t... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/mocks/app.rb | Ruby | mit | 4,963 | master | 1,840 | # frozen_string_literal: true
require 'active_support/core_ext/hash/indifferent_access'
require 'groupdate'
require 'rack'
require 'uri'
class MockApp
include Pagy::Method
public :pagy # make public for testing
attr_reader :request, :params
# Initializer for a Rack::Request with defaults for test
def ini... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/mocks/elasticsearch_rails.rb | Ruby | mit | 4,963 | master | 2,607 | # frozen_string_literal: true
require 'pagy/classes/offset/search'
module MockElasticsearchRails
RESULTS = { 'a' => ('a-1'..'a-1000').to_a,
'b' => ('b-1'..'b-1000').to_a }.freeze
# Simulates a DSL object that responds to to_hash
class DslSearch
def initialize(hash)
@hash = hash
end
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/mocks/typesense_rails.rb | Ruby | mit | 4,963 | master | 976 | # frozen_string_literal: true
require 'pagy/classes/offset/search'
module MockTypesenseRails
RESULTS = {
'*' => (1..1000).map { |n| "doc-#{n}" },
'a' => (1..1000).map { |n| "a-#{n}" },
'b' => (1..1000).map { |n| "b-#{n}" }
}.freeze
class Results
attr_reader :term, :options
def initialize(t... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/cli_test.rb | Ruby | mit | 4,963 | master | 3,227 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/cli'
describe 'Pagy::CLI Specs' do
let(:cli) { Pagy::CLI.new }
describe 'Options' do
it 'shows help with no args' do
# Capture stdout and expect exit(0)
out, = capture_io do
_ { cli.start([]) }.must_raise SystemExit
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/version_test.rb | Ruby | mit | 4,963 | master | 2,281 | # frozen_string_literal: true
require_relative '../test_helper'
# Load PagyApps::INDEX
# Using Pagy::ROOT to locate the file robustly regardless of test file location
require Pagy::ROOT.join('apps/index').to_s
describe 'Version match' do
let(:version) { Pagy::VERSION }
let(:major) { version.split('.')[0] }
l... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/paginators/elasticsearch_rails_test.rb | Ruby | mit | 4,963 | master | 4,327 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/paginators/elasticsearch_rails'
require 'mocks/app'
require 'mocks/elasticsearch_rails'
describe 'Pagy::ElasticsearchRailsPaginator' do
let(:app) { MockApp.new }
describe '#paginate' do
describe 'Active Mode (pagy_search)' do
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/paginators/keyset_test.rb | Ruby | mit | 4,963 | master | 2,252 | # frozen_string_literal: true
require 'unit/test_helper'
require 'mocks/app'
describe 'Pagy::KeysetPaginator' do
# We test via the public API provided by the App/Controller mixin (MockApp)
# which delegates to KeysetPaginator when the first argument is :keyset.
describe 'with ActiveRecord' do
let(:collecti... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/paginators/countless_test.rb | Ruby | mit | 4,963 | master | 1,843 | # frozen_string_literal: true
require 'unit/test_helper'
require 'mocks/app'
describe 'Pagy::CountlessPaginator' do
let(:collection) { Pet.all }
describe 'with ActiveRecord' do
it 'paginates with defaults' do
# MockApp default params: { page: 3 }. Rack converts 3 to "3".
# options[:page] becomes ... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/paginators/method_test.rb | Ruby | mit | 4,963 | master | 2,557 | # frozen_string_literal: true
require 'unit/test_helper'
require 'mocks/app'
describe 'Pagy::Method' do
let(:collection) { Pet.all }
describe '#pagy (Offset default)' do
it 'paginates with defaults' do
# MockApp defaults to params: { page: 3 }
app = MockApp.new
pagy, records = app.pagy(coll... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/paginators/meilisearch_test.rb | Ruby | mit | 4,963 | master | 1,902 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/paginators/meilisearch'
require 'mocks/app'
require 'mocks/meilisearch'
describe 'Pagy::MeilisearchPaginator' do
let(:app) { MockApp.new }
describe '#paginate' do
describe 'Active Mode (pagy_search)' do
it 'paginates with de... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/paginators/offset_test.rb | Ruby | mit | 4,963 | master | 2,513 | # frozen_string_literal: true
require 'unit/test_helper'
require 'mocks/app'
describe 'Pagy::OffsetPaginator Specs' do
# We test via the public API provided by the App/Controller mixin (MockApp)
# which delegates to OffsetPaginator.
let(:collection) { (1..20).to_a }
describe 'with Array' do
it 'paginate... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/paginators/countish_test.rb | Ruby | mit | 4,963 | master | 2,927 | # frozen_string_literal: true
require 'unit/test_helper'
require 'mocks/app'
describe 'Pagy::CountishPaginator' do
let(:collection) { Pet.all }
let(:paginator) { Pagy::CountishPaginator }
describe 'with ActiveRecord' do
it 'paginates with defaults (recount)' do
# No page param -> Page 1, Count calcul... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/paginators/searchkick_test.rb | Ruby | mit | 4,963 | master | 2,328 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/paginators/searchkick'
require 'mocks/app'
require 'mocks/searchkick'
describe 'Pagy::SearchkickPaginator' do
let(:app) { MockApp.new }
describe '#paginate' do
describe 'Active Mode (pagy_search)' do
it 'paginates with defau... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/paginators/keynav_test.rb | Ruby | mit | 4,963 | master | 2,000 | # frozen_string_literal: true
require 'unit/test_helper'
require 'mocks/app'
require 'pagy/modules/b64'
describe 'Pagy::KeynavJsPaginator Specs' do
let(:collection) { Pet.order(:id) }
it 'paginates with defaults (page 1)' do
app = MockApp.new(params: {})
pagy, records = app.pagy(:keynav_js, collection, l... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/paginators/calendar_test.rb | Ruby | mit | 4,963 | master | 2,857 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/paginators/calendar'
require 'mocks/app'
describe 'Pagy::CalendarPaginator' do
let(:collection) { Event.all }
# Period covering the seeded events (2021-10-21 to 2023-11-13)
let(:period) { [Time.zone.local(2021, 10, 21), Time.zone.loc... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/paginators/typesense_rails_test.rb | Ruby | mit | 4,963 | master | 1,706 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/paginators/typesense_rails'
require 'mocks/app'
require 'mocks/typesense_rails'
describe 'Pagy::TypesenseRailsPaginator' do
let(:app) { MockApp.new }
describe '#paginate' do
describe 'Active Mode (pagy_search)' do
it 'pagina... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/series_nav_test.rb | Ruby | mit | 4,963 | master | 2,043 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/series_nav'
describe 'Pagy#series_nav' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
# Mock dependencies
def series(**)
[1, '2', :gap]
end
def previous_tag(_lam... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/loaders_test.rb | Ruby | mit | 4,963 | master | 1,541 | # frozen_string_literal: true
require 'unit/test_helper'
describe 'Pagy::Helpers Loader Specs' do
let(:loader) { Pagy::HelperLoader }
let(:numeric_loader) { Pagy::NumericHelperLoader }
it 'defines public methods for HelperLoader' do
# From paths[:public] in source
public_methods = %i[page_url data_hash... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/limit_tag_js_test.rb | Ruby | mit | 4,963 | master | 2,111 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/limit_tag_js'
describe 'Pagy#limit_tag_js' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
attr_accessor :limit, :from, :options
def initialize(limit: 20, from: 1, options: {})
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/headers_hash_test.rb | Ruby | mit | 4,963 | master | 2,367 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/headers_hash'
describe 'Pagy#headers_hash' do
let(:pagy_class) do
Class.new(Pagy) do
attr_accessor :page, :limit, :last, :count, :options
def initialize(vars = {})
@options = vars[:options] || {}
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/data_hash_test.rb | Ruby | mit | 4,963 | master | 2,686 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/data_hash'
describe 'Pagy#data_hash' do
let(:pagy_class) do
Class.new(Pagy) do
attr_accessor :count, :page, :limit, :last, :in, :from, :to, :previous, :next, :options, :series
def initialize(vars = {})
@o... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/page_url_test.rb | Ruby | mit | 4,963 | master | 1,787 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/page_url'
describe 'Pagy#page_url' do
let(:pagy_class) do
Class.new(Pagy) do
attr_accessor :page, :previous, :next, :last
def initialize(vars = {})
@page = vars[:page]
@previous = vars[:previo... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/input_nav_js_test.rb | Ruby | mit | 4,963 | master | 2,101 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/input_nav_js'
describe 'Pagy#input_nav_js' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
attr_accessor :page, :last
def initialize(page: 1, last: 10)
@page = page
@... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/anchor_tags_test.rb | Ruby | mit | 4,963 | master | 3,193 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/anchor_tags'
describe 'Pagy anchor_tags' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
attr_accessor :previous, :next
# Renamed 'next' argument to 'next_page' to avoid keyword coll... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/urls_hash_test.rb | Ruby | mit | 4,963 | master | 2,007 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/urls_hash'
describe 'Pagy#urls_hash' do
let(:pagy_class) do
Class.new(Pagy) do
attr_accessor :previous, :next, :count, :last
def initialize(vars = {})
@previous = vars[:previous]
@next = vars[... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/series_nav_js_test.rb | Ruby | mit | 4,963 | master | 1,722 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/series_nav_js'
describe 'Pagy#series_nav_js' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
attr_reader :wrap_args
# Mock dependencies
def a_lambda(**)
->(page, text =... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/info_tag_test.rb | Ruby | mit | 4,963 | master | 2,183 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/info_tag'
describe 'Pagy#info_tag' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
attr_accessor :count, :page, :last, :in, :from, :to
def initialize(vars = {})
@count = vars... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/bulma/series_nav_js_test.rb | Ruby | mit | 4,963 | master | 2,125 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/bulma/series_nav_js'
describe 'Pagy#bulma_series_nav_js' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
attr_reader :wrap_args
# Mock dependencies
def a_lambda(**)
->(... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/bulma/previous_next_html_test.rb | Ruby | mit | 4,963 | master | 1,894 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/bulma/previous_next_html'
describe 'Pagy#bulma_html_for' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
attr_accessor :previous, :next
def initialize(previous: nil, next_page: nil)
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/bulma/series_nav_test.rb | Ruby | mit | 4,963 | master | 2,157 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/bulma/series_nav'
describe 'Pagy#bulma_series_nav' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
# Mock dependencies
def series(**)
[1, '2', :gap]
end
def a_lam... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/bulma/input_nav_js_test.rb | Ruby | mit | 4,963 | master | 1,915 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/bulma/input_nav_js'
describe 'Pagy#bulma_input_nav_js' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
attr_accessor :page, :last
def initialize(page: 1, last: 10)
@page = pa... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/support/wrap_series_nav_test.rb | Ruby | mit | 4,963 | master | 1,380 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/support/wrap_series_nav'
describe 'Pagy#wrap_series_nav' do
let(:pagy_class) do
Class.new(Pagy) do
attr_accessor :update
def initialize(keynav: false)
@keynav = keynav
@update = ['update_info']
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/support/wrap_input_nav_js_test.rb | Ruby | mit | 4,963 | master | 1,539 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/support/wrap_input_nav_js'
describe 'Pagy#wrap_input_nav_js' do
let(:pagy_class) do
Class.new(Pagy) do
attr_accessor :update
def initialize(keynav: false)
@keynav = keynav
@update = ['update_info'... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/support/wrap_series_nav_is_test.rb | Ruby | mit | 4,963 | master | 3,112 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/support/wrap_series_nav_js'
describe 'Pagy#wrap_series_nav_js' do
let(:pagy_class) do
Class.new(Pagy) do
attr_accessor :options, :update
def initialize(options = {})
@options = options
@update = [... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/support/series_test.rb | Ruby | mit | 4,963 | master | 2,628 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/support/series'
describe 'Pagy#series' do
# Mock class to expose series logic
let(:pagy_class) do
Class.new(Pagy) do
attr_accessor :page, :last
def initialize(page: 1, last: 1, **options)
@page = page
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/support/data_pagy_attributes_test.rb | Ruby | mit | 4,963 | master | 1,638 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/support/data_pagy_attribute'
require 'json'
# Try to load Oj for the test if available
begin
require 'oj'
rescue LoadError
# Proceed without Oj
end
describe 'Pagy#data_pagy_attribute' do
let(:pagy_class) do
Class.new(Pag... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/support/nav_aria_label_attribute_test.rb | Ruby | mit | 4,963 | master | 992 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/support/nav_aria_label_attribute'
describe 'Pagy#nav_aria_label_attribute' do
let(:pagy_class) do
Class.new(Pagy) do
attr_accessor :last
def initialize(last: 10)
@last = last
end
public :nav_... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/support/a_lambda_test.rb | Ruby | mit | 4,963 | master | 4,284 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/support/a_lambda'
describe 'Pagy#a_lambda' do
let(:pagy_class) do
Class.new(Pagy) do
attr_accessor :previous, :next
def initialize(options = {})
@options = options
@previous = nil
@next ... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/bootstrap/previous_next_html_test.rb | Ruby | mit | 4,963 | master | 2,071 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/bootstrap/previous_next_html'
describe 'Pagy#bootstrap_html_for' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
attr_accessor :previous, :next
def initialize(previous: nil, next_pag... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/bootstrap/input_nav_js_test.rb | Ruby | mit | 4,963 | master | 2,068 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/bootstrap/input_nav_js'
describe 'Pagy#bootstrap_input_nav_js' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
attr_accessor :page, :last
def initialize(page: 1, last: 10)
@p... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/bootstrap/series_nav_js_test.rb | Ruby | mit | 4,963 | master | 2,392 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/bootstrap/series_nav_js'
describe 'Pagy#bootstrap_series_nav_js' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
attr_reader :wrap_args
# Mock dependencies
def a_lambda(**)
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/toolbox/helpers/bootstrap/series_nav_test.rb | Ruby | mit | 4,963 | master | 2,439 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/toolbox/helpers/bootstrap/series_nav'
describe 'Pagy#bootstrap_series_nav' do
let(:pagy_class) do
Class.new(Pagy) do
include Pagy::NumericHelpers
# Mock dependencies
def series(**)
[1, '2', :gap]
end
d... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/tasks/sync_test.rb | Ruby | mit | 4,963 | master | 862 | # frozen_string_literal: true
require 'unit/test_helper'
require 'rake'
require 'fileutils'
describe 'SyncTaskTest Specs' do
let(:destination) { Dir.mktmpdir }
after do
FileUtils.rm_rf(destination)
Rake::Task.clear
end
it 'defines the sync task' do
Pagy::SyncTask.new(:locales, destination)
a... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/exceptions_test.rb | Ruby | mit | 4,963 | master | 1,177 | # frozen_string_literal: true
require 'unit/test_helper'
describe 'Pagy::OptionError Specs' do
it 'inherits from ArgumentError' do
_(Pagy::OptionError.superclass).must_equal ArgumentError
end
it 'initializes with pagy, option, description, and value' do
pagy_mock = Object.new
error = Pagy::OptionEr... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/request_test.rb | Ruby | mit | 4,963 | master | 4,960 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/classes/request'
describe 'Pagy::Request Specs' do
let(:default_options) { { page_key: 'page', limit_key: 'limit' } }
describe 'initialization' do
it 'handles Hash request' do
req_hash = { base_url: 'http://example.com', path: '/foo... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/calendar/month_test.rb | Ruby | mit | 4,963 | master | 1,556 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/classes/calendar/calendar'
describe 'Pagy::Calendar::Month Specs' do
let(:period) { [Time.zone.local(2021, 10, 21, 13, 18, 23, 0), Time.zone.local(2023, 11, 13, 15, 43, 40, 0)] }
let(:default_opts) { { period: period } }
before do
Time.... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/calendar/calendar_test.rb | Ruby | mit | 4,963 | master | 3,652 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/classes/calendar/calendar'
require 'mocks/app'
describe 'Pagy::Calendar Specs' do
let(:period) { [Time.zone.local(2021, 10, 21), Time.zone.local(2023, 11, 13)] }
# Configuration mimicking what CalendarPaginator passes
let(:conf) do
# Ens... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/calendar/year_test.rb | Ruby | mit | 4,963 | master | 1,955 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/classes/calendar/calendar'
describe 'Pagy::Calendar::Year Specs' do
let(:period) { [Time.zone.local(2021, 10, 21, 13, 18, 23, 0), Time.zone.local(2023, 11, 13, 15, 43, 40, 0)] }
let(:default_opts) { { period: period } }
before do
Time.z... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/calendar/quarter_test.rb | Ruby | mit | 4,963 | master | 1,842 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/classes/calendar/calendar'
describe 'Pagy::Calendar::Quarter Specs' do
let(:period) { [Time.zone.local(2021, 10, 21, 13, 18, 23, 0), Time.zone.local(2023, 11, 13, 15, 43, 40, 0)] }
let(:default_opts) { { period: period } }
before do
Tim... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/calendar/week_test.rb | Ruby | mit | 4,963 | master | 1,713 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/classes/calendar/calendar'
describe 'Pagy::Calendar::Week Specs' do
let(:period) { [Time.zone.local(2021, 10, 21, 13, 18, 23, 0), Time.zone.local(2023, 11, 13, 15, 43, 40, 0)] }
let(:default_opts) { { period: period } }
before do
Time.z... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/calendar/unit_test.rb | Ruby | mit | 4,963 | master | 4,179 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/classes/calendar/calendar'
describe 'Pagy::Calendar::Unit Specs' do
# Use a concrete subclass (Year) to test inherited behavior
let(:unit_class) { Pagy::Calendar::Year }
let(:period) { [Time.zone.local(2021, 10, 21), Time.zone.local(2023, 11... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/calendar/day_test.rb | Ruby | mit | 4,963 | master | 1,564 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/classes/calendar/calendar'
describe 'Pagy::Calendar::Day Specs' do
let(:period) { [Time.zone.local(2021, 10, 21, 13, 18, 23, 0), Time.zone.local(2023, 11, 13, 15, 43, 40, 0)] }
let(:default_opts) { { period: period } }
before do
Time.zo... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/keyset/keynav_test.rb | Ruby | mit | 4,963 | master | 6,740 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/modules/b64'
describe "Pagy::Keyset::Keynav" do
[Pet, PetSequel].each do |model|
describe "with #{model}" do
let(:ordered_set) { model.order(:id) }
describe 'initialization' do
it 'handles empty collection' do
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/keyset/keyset_test.rb | Ruby | mit | 4,963 | master | 8,538 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/modules/b64'
describe "Pagy Keyset" do
[Pet, PetSequel].each do |model|
describe "Pagy Keyset with #{model}" do
describe 'initialize' do
it 'raises TypeError on wrong set type' do
_ { Pagy::Keyset.new(10) }.must_raise... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/keyset/adapters/active_record_test.rb | Ruby | mit | 4,963 | master | 3,244 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/classes/keyset/adapters/active_record'
describe 'Pagy::Keyset::Adapters::ActiveRecord Specs' do
# Host class to mix in the adapter
let(:adapter_host) do
Class.new do
include Pagy::Keyset::Adapters::ActiveRecord
attr_accessor :... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/keyset/adapters/sequel_test.rb | Ruby | mit | 4,963 | master | 3,801 | # frozen_string_literal: true
require 'unit/test_helper'
require 'pagy/classes/keyset/adapters/sequel'
describe 'Pagy::Keyset::Adapters::Sequel Specs' do
# Host class to mix in the adapter
let(:adapter_host) do
Class.new do
include Pagy::Keyset::Adapters::Sequel
attr_accessor :set, :keyset
... |
github | ddnexus/pagy | https://github.com/ddnexus/pagy | test/unit/pagy/classes/offset/search_test.rb | Ruby | mit | 4,963 | master | 2,316 | # frozen_string_literal: true
require 'unit/test_helper'
describe 'Pagy::Search Specs' do
describe 'Arguments' do
it 'collects method calls via method_missing' do
args = Pagy::Search::Arguments.new
args.foo
args.bar(1, 2)
# Array#push appends arguments
# .foo -> method_missing(:fo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.