kaminari 0.17.0 → 1.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of kaminari might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +20 -39
- data/CHANGELOG.md +560 -0
- data/CONTRIBUTING.md +16 -0
- data/Gemfile +1 -0
- data/README.md +545 -0
- data/Rakefile +21 -24
- data/gemfiles/active_record_41.gemfile +2 -4
- data/gemfiles/active_record_42.gemfile +2 -4
- data/gemfiles/active_record_50.gemfile +20 -0
- data/gemfiles/active_record_edge.gemfile +5 -6
- data/kaminari.gemspec +11 -17
- data/lib/kaminari.rb +4 -39
- data/lib/kaminari/version.rb +2 -1
- metadata +44 -186
- data/.gemtest +0 -0
- data/.rspec +0 -2
- data/CHANGELOG.rdoc +0 -480
- data/README.rdoc +0 -336
- data/app/views/kaminari/_first_page.html.erb +0 -11
- data/app/views/kaminari/_first_page.html.haml +0 -9
- data/app/views/kaminari/_first_page.html.slim +0 -10
- data/app/views/kaminari/_gap.html.erb +0 -8
- data/app/views/kaminari/_gap.html.haml +0 -8
- data/app/views/kaminari/_gap.html.slim +0 -9
- data/app/views/kaminari/_last_page.html.erb +0 -11
- data/app/views/kaminari/_last_page.html.haml +0 -9
- data/app/views/kaminari/_last_page.html.slim +0 -10
- data/app/views/kaminari/_next_page.html.erb +0 -11
- data/app/views/kaminari/_next_page.html.haml +0 -9
- data/app/views/kaminari/_next_page.html.slim +0 -10
- data/app/views/kaminari/_page.html.erb +0 -12
- data/app/views/kaminari/_page.html.haml +0 -10
- data/app/views/kaminari/_page.html.slim +0 -11
- data/app/views/kaminari/_paginator.html.erb +0 -23
- data/app/views/kaminari/_paginator.html.haml +0 -18
- data/app/views/kaminari/_paginator.html.slim +0 -19
- data/app/views/kaminari/_prev_page.html.erb +0 -11
- data/app/views/kaminari/_prev_page.html.haml +0 -9
- data/app/views/kaminari/_prev_page.html.slim +0 -10
- data/config/locales/kaminari.yml +0 -19
- data/gemfiles/active_record_30.gemfile +0 -28
- data/gemfiles/active_record_31.gemfile +0 -26
- data/gemfiles/active_record_32.gemfile +0 -25
- data/gemfiles/active_record_40.gemfile +0 -26
- data/gemfiles/data_mapper_12.gemfile +0 -32
- data/gemfiles/mongo_mapper.gemfile +0 -25
- data/gemfiles/mongoid_30.gemfile +0 -22
- data/gemfiles/mongoid_31.gemfile +0 -21
- data/gemfiles/mongoid_40.gemfile +0 -19
- data/gemfiles/mongoid_50.gemfile +0 -23
- data/gemfiles/sinatra_13.gemfile +0 -36
- data/gemfiles/sinatra_14.gemfile +0 -33
- data/lib/generators/kaminari/config_generator.rb +0 -16
- data/lib/generators/kaminari/templates/kaminari_config.rb +0 -10
- data/lib/generators/kaminari/views_generator.rb +0 -119
- data/lib/kaminari/config.rb +0 -51
- data/lib/kaminari/engine.rb +0 -4
- data/lib/kaminari/grape.rb +0 -4
- data/lib/kaminari/helpers/action_view_extension.rb +0 -132
- data/lib/kaminari/helpers/paginator.rb +0 -195
- data/lib/kaminari/helpers/sinatra_helpers.rb +0 -176
- data/lib/kaminari/helpers/tags.rb +0 -108
- data/lib/kaminari/hooks.rb +0 -53
- data/lib/kaminari/models/active_record_extension.rb +0 -22
- data/lib/kaminari/models/active_record_model_extension.rb +0 -22
- data/lib/kaminari/models/active_record_relation_methods.rb +0 -42
- data/lib/kaminari/models/array_extension.rb +0 -66
- data/lib/kaminari/models/configuration_methods.rb +0 -48
- data/lib/kaminari/models/data_mapper_collection_methods.rb +0 -19
- data/lib/kaminari/models/data_mapper_extension.rb +0 -51
- data/lib/kaminari/models/mongo_mapper_extension.rb +0 -18
- data/lib/kaminari/models/mongoid_criteria_methods.rb +0 -40
- data/lib/kaminari/models/mongoid_extension.rb +0 -26
- data/lib/kaminari/models/page_scope_methods.rb +0 -73
- data/lib/kaminari/models/plucky_criteria_methods.rb +0 -23
- data/lib/kaminari/railtie.rb +0 -7
- data/lib/kaminari/sinatra.rb +0 -7
- data/spec/config/config_spec.rb +0 -91
- data/spec/fake_app/active_record/config.rb +0 -3
- data/spec/fake_app/active_record/models.rb +0 -65
- data/spec/fake_app/data_mapper/config.rb +0 -1
- data/spec/fake_app/data_mapper/models.rb +0 -27
- data/spec/fake_app/mongo_mapper/config.rb +0 -2
- data/spec/fake_app/mongo_mapper/models.rb +0 -9
- data/spec/fake_app/mongoid/config.rb +0 -20
- data/spec/fake_app/mongoid/models.rb +0 -38
- data/spec/fake_app/rails_app.rb +0 -56
- data/spec/fake_app/sinatra_app.rb +0 -22
- data/spec/fake_app/views/alternative/kaminari/_first_page.html.erb +0 -1
- data/spec/fake_app/views/alternative/kaminari/_paginator.html.erb +0 -3
- data/spec/fake_app/views/kaminari/bootstrap/_page.html.erb +0 -1
- data/spec/fake_app/views/kaminari/bootstrap/_paginator.html.erb +0 -7
- data/spec/fake_gem.rb +0 -20
- data/spec/generators/views_generator_spec.rb +0 -18
- data/spec/helpers/action_view_extension_spec.rb +0 -318
- data/spec/helpers/helpers_spec.rb +0 -144
- data/spec/helpers/sinatra_helpers_spec.rb +0 -223
- data/spec/helpers/tags_spec.rb +0 -140
- data/spec/models/active_record/active_record_relation_methods_spec.rb +0 -77
- data/spec/models/active_record/inherited_spec.rb +0 -9
- data/spec/models/active_record/scopes_spec.rb +0 -265
- data/spec/models/array_spec.rb +0 -172
- data/spec/models/configuration_methods_spec.rb +0 -125
- data/spec/models/data_mapper/data_mapper_spec.rb +0 -205
- data/spec/models/mongo_mapper/mongo_mapper_spec.rb +0 -84
- data/spec/models/mongoid/mongoid_spec.rb +0 -228
- data/spec/requests/users_spec.rb +0 -53
- data/spec/spec_helper.rb +0 -34
- data/spec/spec_helper_for_sinatra.rb +0 -34
- data/spec/support/database_cleaner.rb +0 -19
- data/spec/support/matchers.rb +0 -52
data/spec/requests/users_spec.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
feature 'Users' do
|
5
|
-
background do
|
6
|
-
1.upto(100) {|i| User.create! :name => "user#{'%03d' % i}" }
|
7
|
-
end
|
8
|
-
scenario 'navigating by pagination links' do
|
9
|
-
visit '/users'
|
10
|
-
|
11
|
-
within 'nav.pagination' do
|
12
|
-
within 'span.page.current' do
|
13
|
-
page.should have_content '1'
|
14
|
-
end
|
15
|
-
within 'span.next' do
|
16
|
-
click_link 'Next ›'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
within 'nav.pagination' do
|
21
|
-
within 'span.page.current' do
|
22
|
-
page.should have_content '2'
|
23
|
-
end
|
24
|
-
within 'span.last' do
|
25
|
-
click_link 'Last »'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
within 'nav.pagination' do
|
30
|
-
within 'span.page.current' do
|
31
|
-
page.should have_content '4'
|
32
|
-
end
|
33
|
-
within 'span.prev' do
|
34
|
-
click_link '‹ Prev'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
within 'nav.pagination' do
|
39
|
-
within 'span.page.current' do
|
40
|
-
page.should have_content '3'
|
41
|
-
end
|
42
|
-
within 'span.first' do
|
43
|
-
click_link '« First'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
within 'nav.pagination' do
|
48
|
-
within 'span.page.current' do
|
49
|
-
page.should have_content '1'
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rails'
|
6
|
-
rescue LoadError
|
7
|
-
end
|
8
|
-
|
9
|
-
require 'bundler/setup'
|
10
|
-
Bundler.require
|
11
|
-
|
12
|
-
require 'capybara/rspec'
|
13
|
-
require 'database_cleaner'
|
14
|
-
|
15
|
-
# Simulate a gem providing a subclass of ActiveRecord::Base before the Railtie is loaded.
|
16
|
-
require 'fake_gem' if defined? ActiveRecord
|
17
|
-
|
18
|
-
if defined? Rails
|
19
|
-
require 'fake_app/rails_app'
|
20
|
-
|
21
|
-
require 'rspec/rails'
|
22
|
-
end
|
23
|
-
if defined? Sinatra
|
24
|
-
require 'spec_helper_for_sinatra'
|
25
|
-
end
|
26
|
-
|
27
|
-
# Requires supporting files with custom matchers and macros, etc,
|
28
|
-
# in ./support/ and its subdirectories.
|
29
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
30
|
-
|
31
|
-
RSpec.configure do |config|
|
32
|
-
config.mock_with :rr
|
33
|
-
config.filter_run_excluding :generator_spec => true if !ENV['GENERATOR_SPEC']
|
34
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'kaminari/sinatra'
|
2
|
-
require 'kaminari/helpers/action_view_extension'
|
3
|
-
require 'rack/test'
|
4
|
-
require 'sinatra/test_helpers'
|
5
|
-
require 'capybara/rspec'
|
6
|
-
|
7
|
-
require 'fake_app/sinatra_app'
|
8
|
-
|
9
|
-
Capybara.app = SinatraApp
|
10
|
-
|
11
|
-
module HelperMethodForHelperSpec
|
12
|
-
module FakeEnv
|
13
|
-
def env
|
14
|
-
{'PATH_INFO' => '/'}
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def helper
|
19
|
-
# OMG terrible object...
|
20
|
-
::Kaminari::Helpers::SinatraHelpers::ActionViewTemplateProxy.new(:current_params => {}, :current_path => '/', :param_name => Kaminari.config.param_name).extend(Padrino::Helpers, Kaminari::ActionViewExtension, Kaminari::Helpers::SinatraHelpers::HelperMethods, FakeEnv)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
RSpec.configure do |config|
|
25
|
-
config.include Rack::Test::Methods
|
26
|
-
config.include Sinatra::TestHelpers
|
27
|
-
config.include HelperMethodForHelperSpec
|
28
|
-
# config.include HelperMethodForHelperSpec, :type => :helper
|
29
|
-
end
|
30
|
-
|
31
|
-
require 'nokogiri'
|
32
|
-
def last_document
|
33
|
-
Nokogiri::HTML(last_response.body)
|
34
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
DatabaseCleaner[:active_record].strategy = :transaction if defined? ActiveRecord
|
2
|
-
DatabaseCleaner[:data_mapper].strategy = :truncation if defined? DataMapper
|
3
|
-
DatabaseCleaner[:mongoid].strategy = :truncation if defined? Mongoid
|
4
|
-
DatabaseCleaner[:mongo_mapper].strategy = :truncation if defined? MongoMapper
|
5
|
-
|
6
|
-
RSpec.configure do |config|
|
7
|
-
config.before :suite do
|
8
|
-
DatabaseCleaner.clean_with :truncation if defined? ActiveRecord
|
9
|
-
DatabaseCleaner.clean_with :truncation if defined? DataMapper
|
10
|
-
DatabaseCleaner.clean_with :truncation if defined? Mongoid
|
11
|
-
DatabaseCleaner.clean_with :truncation if defined? MongoMapper
|
12
|
-
end
|
13
|
-
config.before :each do
|
14
|
-
DatabaseCleaner.start
|
15
|
-
end
|
16
|
-
config.after :each do
|
17
|
-
DatabaseCleaner.clean
|
18
|
-
end
|
19
|
-
end
|
data/spec/support/matchers.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
RSpec::Matchers.define :contain_tag do |klass|
|
2
|
-
match do |collection|
|
3
|
-
if @num.blank?
|
4
|
-
collection.any? {|tag| tag.is_a? klass}
|
5
|
-
else
|
6
|
-
(@count = collection.count {|tag| tag.is_a? klass}) == @num
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def count(num)
|
11
|
-
@num = num
|
12
|
-
self
|
13
|
-
end
|
14
|
-
|
15
|
-
description do
|
16
|
-
"contain #{@num || 'any'} instance(s) of #{klass.name}"
|
17
|
-
end
|
18
|
-
failure_message_for_should do |collection|
|
19
|
-
"expected #{@num || 'any'} instance(s) of #{klass.name} but was #{@count}"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
RSpec::Matchers.define :contain_tag_old do |count|
|
24
|
-
match do |collection|
|
25
|
-
(@count = collection.count {|tag| tag.is_a? @klass}) == count
|
26
|
-
end
|
27
|
-
|
28
|
-
def instance_of(klass)
|
29
|
-
@klass = klass
|
30
|
-
self
|
31
|
-
end
|
32
|
-
alias :instances_of :instance_of
|
33
|
-
|
34
|
-
description do
|
35
|
-
"contain #{count || 'any'} instance(s) of #{@klass.name}"
|
36
|
-
end
|
37
|
-
failure_message_for_should do |collection|
|
38
|
-
"expected #{count || 'any'} instance(s) of #{@klass.name} but was #{@count}"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
RSpec::Matchers.define :skip do |num|
|
43
|
-
match do |criteria|
|
44
|
-
criteria.instance_variable_get('@options')[:skip] == num
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
RSpec::Matchers.define :offset do |num|
|
49
|
-
match do |collection|
|
50
|
-
collection.offset_value == num
|
51
|
-
end
|
52
|
-
end
|