mislav-will_paginate 2.3.7 → 2.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -13
- data/lib/will_paginate/version.rb +1 -1
- data/lib/will_paginate/view_helpers.rb +15 -2
- data/test/helper.rb +4 -1
- data/test/lib/activerecord_test_case.rb +7 -0
- data/test/lib/view_test_process.rb +7 -0
- metadata +2 -10
data/Rakefile
CHANGED
@@ -32,18 +32,9 @@ desc %{Update ".manifest" with the latest list of project filenames. Respect\
|
|
32
32
|
.gitignore by excluding everything that git ignores. Update `files` and\
|
33
33
|
`test_files` arrays in "*.gemspec" file if it's present.}
|
34
34
|
task :manifest do
|
35
|
-
list =
|
36
|
-
spec_file = Dir['*.gemspec'].first
|
37
|
-
list -= [spec_file] if spec_file
|
35
|
+
list = `git ls-files --full-name --exclude=*.gemspec --exclude=.*`.chomp.split("\n")
|
38
36
|
|
39
|
-
|
40
|
-
glob = glob.chomp.sub(/^\//, '')
|
41
|
-
list -= Dir[glob]
|
42
|
-
list -= Dir["#{glob}/**/*"] if File.directory?(glob) and !File.symlink?(glob)
|
43
|
-
puts "excluding #{glob}"
|
44
|
-
end
|
45
|
-
|
46
|
-
if spec_file
|
37
|
+
if spec_file = Dir['*.gemspec'].first
|
47
38
|
spec = File.read spec_file
|
48
39
|
spec.gsub! /^(\s* s.(test_)?files \s* = \s* )( \[ [^\]]* \] | %w\( [^)]* \) )/mx do
|
49
40
|
assignment = $1
|
@@ -51,9 +42,9 @@ task :manifest do
|
|
51
42
|
'%s%%w(%s)' % [assignment, bunch.join(' ')]
|
52
43
|
end
|
53
44
|
|
54
|
-
File.open(spec_file,
|
45
|
+
File.open(spec_file, 'w') { |f| f << spec }
|
55
46
|
end
|
56
|
-
File.open('.manifest', 'w') {|f| f << list.join("\n") }
|
47
|
+
File.open('.manifest', 'w') { |f| f << list.join("\n") }
|
57
48
|
end
|
58
49
|
|
59
50
|
task :examples do
|
@@ -321,8 +321,7 @@ module WillPaginate
|
|
321
321
|
stringified_merge @url_params, @options[:params] if @options[:params]
|
322
322
|
|
323
323
|
if complex = param_name.index(/[^\w-]/)
|
324
|
-
page_param = (
|
325
|
-
parse_query_parameters("#{param_name}=#{page}")
|
324
|
+
page_param = parse_query_parameters("#{param_name}=#{page}")
|
326
325
|
|
327
326
|
stringified_merge @url_params, page_param
|
328
327
|
else
|
@@ -385,5 +384,19 @@ module WillPaginate
|
|
385
384
|
end
|
386
385
|
end
|
387
386
|
end
|
387
|
+
|
388
|
+
def parse_query_parameters(params)
|
389
|
+
if defined?(CGIMethods)
|
390
|
+
CGIMethods.parse_query_parameters(params)
|
391
|
+
elsif defined?(ActionController::AbstractRequest)
|
392
|
+
ActionController::AbstractRequest.parse_query_parameters(params)
|
393
|
+
elsif defined?(ActionController::UrlEncodedPairParser)
|
394
|
+
# For Rails > 2.2
|
395
|
+
ActionController::UrlEncodedPairParser.parse_query_parameters(params)
|
396
|
+
else
|
397
|
+
# For Rails > 2.3
|
398
|
+
Rack::Utils.parse_nested_query(params)
|
399
|
+
end
|
400
|
+
end
|
388
401
|
end
|
389
402
|
end
|
data/test/helper.rb
CHANGED
@@ -29,7 +29,10 @@ end
|
|
29
29
|
|
30
30
|
# Wrap tests that use Mocha and skip if unavailable.
|
31
31
|
def uses_mocha(test_name)
|
32
|
-
|
32
|
+
unless Object.const_defined?(:Mocha)
|
33
|
+
gem 'mocha', '>= 0.9.5'
|
34
|
+
require 'mocha'
|
35
|
+
end
|
33
36
|
rescue LoadError => load_error
|
34
37
|
$stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again."
|
35
38
|
else
|
@@ -1,6 +1,13 @@
|
|
1
1
|
require 'lib/activerecord_test_connector'
|
2
2
|
|
3
3
|
class ActiveRecordTestCase < Test::Unit::TestCase
|
4
|
+
if defined?(ActiveSupport::Testing::SetupAndTeardown)
|
5
|
+
include ActiveSupport::Testing::SetupAndTeardown
|
6
|
+
end
|
7
|
+
|
8
|
+
if defined?(ActiveRecord::TestFixtures)
|
9
|
+
include ActiveRecord::TestFixtures
|
10
|
+
end
|
4
11
|
# Set our fixture path
|
5
12
|
if ActiveRecordTestConnector.able_to_connect
|
6
13
|
self.fixture_path = File.join(File.dirname(__FILE__), '..', 'fixtures')
|
@@ -17,6 +17,13 @@ end
|
|
17
17
|
ActionController::Base.perform_caching = false
|
18
18
|
|
19
19
|
class WillPaginate::ViewTestCase < Test::Unit::TestCase
|
20
|
+
if defined?(ActionController::TestCase::Assertions)
|
21
|
+
include ActionController::TestCase::Assertions
|
22
|
+
end
|
23
|
+
if defined?(ActiveSupport::Testing::Deprecation)
|
24
|
+
include ActiveSupport::Testing::Deprecation
|
25
|
+
end
|
26
|
+
|
20
27
|
def setup
|
21
28
|
super
|
22
29
|
@controller = DummyController.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mislav-will_paginate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Mislav Marohni\xC4\x87"
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-03-09 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -29,15 +29,12 @@ files:
|
|
29
29
|
- LICENSE
|
30
30
|
- README.rdoc
|
31
31
|
- Rakefile
|
32
|
-
- examples
|
33
32
|
- examples/apple-circle.gif
|
34
33
|
- examples/index.haml
|
35
34
|
- examples/index.html
|
36
35
|
- examples/pagination.css
|
37
36
|
- examples/pagination.sass
|
38
37
|
- init.rb
|
39
|
-
- lib
|
40
|
-
- lib/will_paginate
|
41
38
|
- lib/will_paginate.rb
|
42
39
|
- lib/will_paginate/array.rb
|
43
40
|
- lib/will_paginate/collection.rb
|
@@ -47,13 +44,11 @@ files:
|
|
47
44
|
- lib/will_paginate/named_scope_patch.rb
|
48
45
|
- lib/will_paginate/version.rb
|
49
46
|
- lib/will_paginate/view_helpers.rb
|
50
|
-
- test
|
51
47
|
- test/boot.rb
|
52
48
|
- test/collection_test.rb
|
53
49
|
- test/console
|
54
50
|
- test/database.yml
|
55
51
|
- test/finder_test.rb
|
56
|
-
- test/fixtures
|
57
52
|
- test/fixtures/admin.rb
|
58
53
|
- test/fixtures/developer.rb
|
59
54
|
- test/fixtures/developers_projects.yml
|
@@ -67,7 +62,6 @@ files:
|
|
67
62
|
- test/fixtures/user.rb
|
68
63
|
- test/fixtures/users.yml
|
69
64
|
- test/helper.rb
|
70
|
-
- test/lib
|
71
65
|
- test/lib/activerecord_test_case.rb
|
72
66
|
- test/lib/activerecord_test_connector.rb
|
73
67
|
- test/lib/load_fixtures.rb
|
@@ -109,7 +103,6 @@ test_files:
|
|
109
103
|
- test/console
|
110
104
|
- test/database.yml
|
111
105
|
- test/finder_test.rb
|
112
|
-
- test/fixtures
|
113
106
|
- test/fixtures/admin.rb
|
114
107
|
- test/fixtures/developer.rb
|
115
108
|
- test/fixtures/developers_projects.yml
|
@@ -123,7 +116,6 @@ test_files:
|
|
123
116
|
- test/fixtures/user.rb
|
124
117
|
- test/fixtures/users.yml
|
125
118
|
- test/helper.rb
|
126
|
-
- test/lib
|
127
119
|
- test/lib/activerecord_test_case.rb
|
128
120
|
- test/lib/activerecord_test_connector.rb
|
129
121
|
- test/lib/load_fixtures.rb
|