jsonapi-resources 0.7.1.beta1 → 0.7.1.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +248 -74
- data/lib/jsonapi-resources.rb +5 -3
- data/lib/jsonapi/acts_as_resource_controller.rb +77 -14
- data/lib/jsonapi/configuration.rb +77 -16
- data/lib/jsonapi/error.rb +12 -0
- data/lib/jsonapi/error_codes.rb +2 -0
- data/lib/jsonapi/exceptions.rb +29 -9
- data/lib/jsonapi/formatter.rb +29 -4
- data/lib/jsonapi/link_builder.rb +18 -18
- data/lib/jsonapi/mime_types.rb +25 -6
- data/lib/jsonapi/naive_cache.rb +30 -0
- data/lib/jsonapi/operation.rb +10 -342
- data/lib/jsonapi/operation_dispatcher.rb +87 -0
- data/lib/jsonapi/operation_result.rb +2 -1
- data/lib/jsonapi/paginator.rb +6 -2
- data/lib/jsonapi/processor.rb +283 -0
- data/lib/jsonapi/relationship.rb +6 -4
- data/lib/jsonapi/{request.rb → request_parser.rb} +46 -35
- data/lib/jsonapi/resource.rb +88 -13
- data/lib/jsonapi/resource_controller.rb +2 -14
- data/lib/jsonapi/resource_controller_metal.rb +17 -0
- data/lib/jsonapi/resource_serializer.rb +62 -47
- data/lib/jsonapi/resources/version.rb +1 -1
- data/lib/jsonapi/response_document.rb +13 -2
- data/lib/jsonapi/routing_ext.rb +49 -11
- metadata +37 -129
- data/.gitignore +0 -22
- data/.travis.yml +0 -9
- data/Gemfile +0 -23
- data/Rakefile +0 -20
- data/jsonapi-resources.gemspec +0 -29
- data/lib/jsonapi/active_record_operations_processor.rb +0 -35
- data/lib/jsonapi/operations_processor.rb +0 -120
- data/locales/en.yml +0 -80
- data/test/config/database.yml +0 -5
- data/test/controllers/controller_test.rb +0 -3312
- data/test/fixtures/active_record.rb +0 -1486
- data/test/fixtures/author_details.yml +0 -9
- data/test/fixtures/book_authors.yml +0 -3
- data/test/fixtures/book_comments.yml +0 -12
- data/test/fixtures/books.yml +0 -7
- data/test/fixtures/categories.yml +0 -35
- data/test/fixtures/comments.yml +0 -21
- data/test/fixtures/comments_tags.yml +0 -20
- data/test/fixtures/companies.yml +0 -4
- data/test/fixtures/craters.yml +0 -9
- data/test/fixtures/customers.yml +0 -11
- data/test/fixtures/documents.yml +0 -3
- data/test/fixtures/expense_entries.yml +0 -13
- data/test/fixtures/facts.yml +0 -11
- data/test/fixtures/hair_cuts.yml +0 -3
- data/test/fixtures/iso_currencies.yml +0 -17
- data/test/fixtures/line_items.yml +0 -37
- data/test/fixtures/makes.yml +0 -2
- data/test/fixtures/moons.yml +0 -6
- data/test/fixtures/numeros_telefone.yml +0 -3
- data/test/fixtures/order_flags.yml +0 -7
- data/test/fixtures/people.yml +0 -31
- data/test/fixtures/pictures.yml +0 -15
- data/test/fixtures/planet_types.yml +0 -19
- data/test/fixtures/planets.yml +0 -47
- data/test/fixtures/posts.yml +0 -102
- data/test/fixtures/posts_tags.yml +0 -59
- data/test/fixtures/preferences.yml +0 -14
- data/test/fixtures/products.yml +0 -3
- data/test/fixtures/purchase_orders.yml +0 -23
- data/test/fixtures/sections.yml +0 -8
- data/test/fixtures/tags.yml +0 -39
- data/test/fixtures/vehicles.yml +0 -17
- data/test/fixtures/web_pages.yml +0 -3
- data/test/helpers/assertions.rb +0 -13
- data/test/helpers/functional_helpers.rb +0 -59
- data/test/helpers/value_matchers.rb +0 -60
- data/test/helpers/value_matchers_test.rb +0 -40
- data/test/integration/requests/namespaced_model_test.rb +0 -13
- data/test/integration/requests/request_test.rb +0 -932
- data/test/integration/routes/routes_test.rb +0 -218
- data/test/integration/sti_fields_test.rb +0 -18
- data/test/lib/generators/jsonapi/controller_generator_test.rb +0 -25
- data/test/lib/generators/jsonapi/resource_generator_test.rb +0 -30
- data/test/test_helper.rb +0 -342
- data/test/unit/formatters/dasherized_key_formatter_test.rb +0 -8
- data/test/unit/jsonapi_request/jsonapi_request_test.rb +0 -199
- data/test/unit/operation/operations_processor_test.rb +0 -528
- data/test/unit/pagination/offset_paginator_test.rb +0 -245
- data/test/unit/pagination/paged_paginator_test.rb +0 -242
- data/test/unit/resource/resource_test.rb +0 -560
- data/test/unit/serializer/include_directives_test.rb +0 -113
- data/test/unit/serializer/link_builder_test.rb +0 -244
- data/test/unit/serializer/polymorphic_serializer_test.rb +0 -383
- data/test/unit/serializer/response_document_test.rb +0 -61
- data/test/unit/serializer/serializer_test.rb +0 -1939
@@ -1,245 +0,0 @@
|
|
1
|
-
require File.expand_path('../../../test_helper', __FILE__)
|
2
|
-
require 'jsonapi-resources'
|
3
|
-
|
4
|
-
class OffsetPaginatorTest < ActiveSupport::TestCase
|
5
|
-
|
6
|
-
def test_offset_default_page_params
|
7
|
-
params = ActionController::Parameters.new(
|
8
|
-
{
|
9
|
-
}
|
10
|
-
)
|
11
|
-
|
12
|
-
paginator = OffsetPaginator.new(params)
|
13
|
-
|
14
|
-
assert_equal JSONAPI.configuration.default_page_size, paginator.limit
|
15
|
-
assert_equal 0, paginator.offset
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_offset_parse_page_params_default_offset
|
19
|
-
params = ActionController::Parameters.new(
|
20
|
-
{
|
21
|
-
limit: 20
|
22
|
-
}
|
23
|
-
)
|
24
|
-
|
25
|
-
paginator = OffsetPaginator.new(params)
|
26
|
-
|
27
|
-
assert_equal 20, paginator.limit
|
28
|
-
assert_equal 0, paginator.offset
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_offset_parse_page_params
|
32
|
-
params = ActionController::Parameters.new(
|
33
|
-
{
|
34
|
-
limit: 5,
|
35
|
-
offset: 7
|
36
|
-
}
|
37
|
-
)
|
38
|
-
|
39
|
-
paginator = OffsetPaginator.new(params)
|
40
|
-
|
41
|
-
assert_equal 5, paginator.limit
|
42
|
-
assert_equal 7, paginator.offset
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_offset_parse_page_params_limit_too_large
|
46
|
-
params = ActionController::Parameters.new(
|
47
|
-
{
|
48
|
-
limit: 50,
|
49
|
-
offset: 0
|
50
|
-
}
|
51
|
-
)
|
52
|
-
|
53
|
-
assert_raises JSONAPI::Exceptions::InvalidPageValue do
|
54
|
-
OffsetPaginator.new(params)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_offset_parse_page_params_not_allowed
|
59
|
-
params = ActionController::Parameters.new(
|
60
|
-
{
|
61
|
-
limit: 50,
|
62
|
-
start: 0
|
63
|
-
}
|
64
|
-
)
|
65
|
-
|
66
|
-
assert_raises JSONAPI::Exceptions::PageParametersNotAllowed do
|
67
|
-
OffsetPaginator.new(params)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_offset_parse_page_params_start
|
72
|
-
params = ActionController::Parameters.new(
|
73
|
-
{
|
74
|
-
limit: 5,
|
75
|
-
offset: 0
|
76
|
-
}
|
77
|
-
)
|
78
|
-
|
79
|
-
paginator = OffsetPaginator.new(params)
|
80
|
-
|
81
|
-
assert_equal 5, paginator.limit
|
82
|
-
assert_equal 0, paginator.offset
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_offset_links_page_params_empty_results
|
86
|
-
params = ActionController::Parameters.new(
|
87
|
-
{
|
88
|
-
limit: 5,
|
89
|
-
offset: 0
|
90
|
-
}
|
91
|
-
)
|
92
|
-
|
93
|
-
paginator = OffsetPaginator.new(params)
|
94
|
-
links_params = paginator.links_page_params(record_count: 0)
|
95
|
-
|
96
|
-
assert_equal 2, links_params.size
|
97
|
-
|
98
|
-
assert_equal 5, links_params['first']['limit']
|
99
|
-
assert_equal 0, links_params['first']['offset']
|
100
|
-
|
101
|
-
assert_equal 5, links_params['last']['limit']
|
102
|
-
assert_equal 0, links_params['last']['offset']
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_offset_links_page_params_small_resultsets
|
106
|
-
params = ActionController::Parameters.new(
|
107
|
-
{
|
108
|
-
limit: 5,
|
109
|
-
offset: 0
|
110
|
-
}
|
111
|
-
)
|
112
|
-
|
113
|
-
paginator = OffsetPaginator.new(params)
|
114
|
-
links_params = paginator.links_page_params(record_count: 3)
|
115
|
-
|
116
|
-
assert_equal 2, links_params.size
|
117
|
-
|
118
|
-
assert_equal 5, links_params['first']['limit']
|
119
|
-
assert_equal 0, links_params['first']['offset']
|
120
|
-
|
121
|
-
assert_equal 5, links_params['last']['limit']
|
122
|
-
assert_equal 0, links_params['last']['offset']
|
123
|
-
end
|
124
|
-
|
125
|
-
def test_offset_links_page_params_large_data_set_start
|
126
|
-
params = ActionController::Parameters.new(
|
127
|
-
{
|
128
|
-
limit: 5,
|
129
|
-
offset: 0
|
130
|
-
}
|
131
|
-
)
|
132
|
-
|
133
|
-
paginator = OffsetPaginator.new(params)
|
134
|
-
links_params = paginator.links_page_params(record_count: 50)
|
135
|
-
|
136
|
-
assert_equal 3, links_params.size
|
137
|
-
|
138
|
-
assert_equal 5, links_params['first']['limit']
|
139
|
-
assert_equal 0, links_params['first']['offset']
|
140
|
-
|
141
|
-
assert_equal 5, links_params['next']['limit']
|
142
|
-
assert_equal 5, links_params['next']['offset']
|
143
|
-
|
144
|
-
assert_equal 5, links_params['last']['limit']
|
145
|
-
assert_equal 45, links_params['last']['offset']
|
146
|
-
end
|
147
|
-
|
148
|
-
def test_offset_links_page_params_large_data_set_before_start
|
149
|
-
params = ActionController::Parameters.new(
|
150
|
-
{
|
151
|
-
limit: 5,
|
152
|
-
offset: 2
|
153
|
-
}
|
154
|
-
)
|
155
|
-
|
156
|
-
paginator = OffsetPaginator.new(params)
|
157
|
-
links_params = paginator.links_page_params(record_count: 50)
|
158
|
-
|
159
|
-
assert_equal 4, links_params.size
|
160
|
-
|
161
|
-
assert_equal 5, links_params['first']['limit']
|
162
|
-
assert_equal 0, links_params['first']['offset']
|
163
|
-
|
164
|
-
assert_equal 5, links_params['previous']['limit']
|
165
|
-
assert_equal 0, links_params['previous']['offset']
|
166
|
-
|
167
|
-
assert_equal 5, links_params['next']['limit']
|
168
|
-
assert_equal 7, links_params['next']['offset']
|
169
|
-
|
170
|
-
assert_equal 5, links_params['last']['limit']
|
171
|
-
assert_equal 45, links_params['last']['offset']
|
172
|
-
end
|
173
|
-
|
174
|
-
def test_offset_links_page_params_large_data_set_middle
|
175
|
-
params = ActionController::Parameters.new(
|
176
|
-
{
|
177
|
-
limit: 5,
|
178
|
-
offset: 27
|
179
|
-
}
|
180
|
-
)
|
181
|
-
|
182
|
-
paginator = OffsetPaginator.new(params)
|
183
|
-
links_params = paginator.links_page_params(record_count: 50)
|
184
|
-
|
185
|
-
assert_equal 4, links_params.size
|
186
|
-
|
187
|
-
assert_equal 5, links_params['first']['limit']
|
188
|
-
assert_equal 0, links_params['first']['offset']
|
189
|
-
|
190
|
-
assert_equal 5, links_params['previous']['limit']
|
191
|
-
assert_equal 22, links_params['previous']['offset']
|
192
|
-
|
193
|
-
assert_equal 5, links_params['next']['limit']
|
194
|
-
assert_equal 32, links_params['next']['offset']
|
195
|
-
|
196
|
-
assert_equal 5, links_params['last']['limit']
|
197
|
-
assert_equal 45, links_params['last']['offset']
|
198
|
-
end
|
199
|
-
|
200
|
-
def test_offset_links_page_params_large_data_set_end
|
201
|
-
params = ActionController::Parameters.new(
|
202
|
-
{
|
203
|
-
limit: 5,
|
204
|
-
offset: 45
|
205
|
-
}
|
206
|
-
)
|
207
|
-
|
208
|
-
paginator = OffsetPaginator.new(params)
|
209
|
-
links_params = paginator.links_page_params(record_count: 50)
|
210
|
-
|
211
|
-
assert_equal 3, links_params.size
|
212
|
-
|
213
|
-
assert_equal 5, links_params['first']['limit']
|
214
|
-
assert_equal 0, links_params['first']['offset']
|
215
|
-
|
216
|
-
assert_equal 5, links_params['previous']['limit']
|
217
|
-
assert_equal 40, links_params['previous']['offset']
|
218
|
-
|
219
|
-
assert_equal 5, links_params['last']['limit']
|
220
|
-
assert_equal 45, links_params['last']['offset']
|
221
|
-
end
|
222
|
-
|
223
|
-
def test_offset_links_page_params_large_data_set_past_end
|
224
|
-
params = ActionController::Parameters.new(
|
225
|
-
{
|
226
|
-
limit: 5,
|
227
|
-
offset: 48
|
228
|
-
}
|
229
|
-
)
|
230
|
-
|
231
|
-
paginator = OffsetPaginator.new(params)
|
232
|
-
links_params = paginator.links_page_params(record_count: 50)
|
233
|
-
|
234
|
-
assert_equal 3, links_params.size
|
235
|
-
|
236
|
-
assert_equal 5, links_params['first']['limit']
|
237
|
-
assert_equal 0, links_params['first']['offset']
|
238
|
-
|
239
|
-
assert_equal 5, links_params['previous']['limit']
|
240
|
-
assert_equal 43, links_params['previous']['offset']
|
241
|
-
|
242
|
-
assert_equal 5, links_params['last']['limit']
|
243
|
-
assert_equal 45, links_params['last']['offset']
|
244
|
-
end
|
245
|
-
end
|
@@ -1,242 +0,0 @@
|
|
1
|
-
require File.expand_path('../../../test_helper', __FILE__)
|
2
|
-
require 'jsonapi-resources'
|
3
|
-
|
4
|
-
class PagedPaginatorTest < ActiveSupport::TestCase
|
5
|
-
|
6
|
-
def test_paged_default_page_params
|
7
|
-
params = ActionController::Parameters.new(
|
8
|
-
{
|
9
|
-
}
|
10
|
-
)
|
11
|
-
|
12
|
-
paginator = PagedPaginator.new(params)
|
13
|
-
|
14
|
-
assert_equal JSONAPI.configuration.default_page_size, paginator.size
|
15
|
-
assert_equal 1, paginator.number
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_paged_parse_page_params_default_page
|
19
|
-
params = ActionController::Parameters.new(
|
20
|
-
{
|
21
|
-
size: 20
|
22
|
-
}
|
23
|
-
)
|
24
|
-
|
25
|
-
paginator = PagedPaginator.new(params)
|
26
|
-
|
27
|
-
assert_equal 20, paginator.size
|
28
|
-
assert_equal 1, paginator.number
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_paged_parse_page_params
|
32
|
-
params = ActionController::Parameters.new(
|
33
|
-
{
|
34
|
-
size: 5,
|
35
|
-
number: 7
|
36
|
-
}
|
37
|
-
)
|
38
|
-
|
39
|
-
paginator = PagedPaginator.new(params)
|
40
|
-
|
41
|
-
assert_equal 5, paginator.size
|
42
|
-
assert_equal 7, paginator.number
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_paged_parse_page_params_size_too_large
|
46
|
-
params = ActionController::Parameters.new(
|
47
|
-
{
|
48
|
-
size: 50,
|
49
|
-
number: 1
|
50
|
-
}
|
51
|
-
)
|
52
|
-
|
53
|
-
assert_raises JSONAPI::Exceptions::InvalidPageValue do
|
54
|
-
PagedPaginator.new(params)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_paged_parse_page_params_not_allowed
|
59
|
-
params = ActionController::Parameters.new(
|
60
|
-
{
|
61
|
-
size: 50,
|
62
|
-
start: 1
|
63
|
-
}
|
64
|
-
)
|
65
|
-
|
66
|
-
assert_raises JSONAPI::Exceptions::PageParametersNotAllowed do
|
67
|
-
PagedPaginator.new(params)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_paged_parse_page_params_start
|
72
|
-
params = ActionController::Parameters.new(
|
73
|
-
{
|
74
|
-
size: 5,
|
75
|
-
number: 1
|
76
|
-
}
|
77
|
-
)
|
78
|
-
|
79
|
-
paginator = PagedPaginator.new(params)
|
80
|
-
|
81
|
-
assert_equal 5, paginator.size
|
82
|
-
assert_equal 1, paginator.number
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_paged_links_page_params_empty_results
|
86
|
-
params = ActionController::Parameters.new(
|
87
|
-
{
|
88
|
-
size: 5,
|
89
|
-
number: 1
|
90
|
-
}
|
91
|
-
)
|
92
|
-
|
93
|
-
paginator = PagedPaginator.new(params)
|
94
|
-
links_params = paginator.links_page_params(record_count: 0)
|
95
|
-
|
96
|
-
assert_equal 2, links_params.size
|
97
|
-
|
98
|
-
assert_equal 5, links_params['first']['size']
|
99
|
-
assert_equal 1, links_params['first']['number']
|
100
|
-
|
101
|
-
assert_equal 5, links_params['last']['size']
|
102
|
-
assert_equal 1, links_params['last']['number']
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_paged_links_page_params_small_resultsets
|
106
|
-
params = ActionController::Parameters.new(
|
107
|
-
{
|
108
|
-
size: 5,
|
109
|
-
number: 1
|
110
|
-
}
|
111
|
-
)
|
112
|
-
|
113
|
-
paginator = PagedPaginator.new(params)
|
114
|
-
links_params = paginator.links_page_params(record_count: 3)
|
115
|
-
|
116
|
-
assert_equal 2, links_params.size
|
117
|
-
|
118
|
-
assert_equal 5, links_params['first']['size']
|
119
|
-
assert_equal 1, links_params['first']['number']
|
120
|
-
|
121
|
-
assert_equal 5, links_params['last']['size']
|
122
|
-
assert_equal 1, links_params['last']['number']
|
123
|
-
end
|
124
|
-
|
125
|
-
def test_paged_links_page_params_large_data_set_start_full_pages
|
126
|
-
params = ActionController::Parameters.new(
|
127
|
-
{
|
128
|
-
size: 5,
|
129
|
-
number: 1
|
130
|
-
}
|
131
|
-
)
|
132
|
-
|
133
|
-
paginator = PagedPaginator.new(params)
|
134
|
-
links_params = paginator.links_page_params(record_count: 50)
|
135
|
-
|
136
|
-
assert_equal 3, links_params.size
|
137
|
-
|
138
|
-
assert_equal 5, links_params['first']['size']
|
139
|
-
assert_equal 1, links_params['first']['number']
|
140
|
-
|
141
|
-
assert_equal 5, links_params['next']['size']
|
142
|
-
assert_equal 2, links_params['next']['number']
|
143
|
-
|
144
|
-
assert_equal 5, links_params['last']['size']
|
145
|
-
assert_equal 10, links_params['last']['number']
|
146
|
-
end
|
147
|
-
|
148
|
-
def test_paged_links_page_params_large_data_set_start_partial_last
|
149
|
-
params = ActionController::Parameters.new(
|
150
|
-
{
|
151
|
-
size: 5,
|
152
|
-
number: 1
|
153
|
-
}
|
154
|
-
)
|
155
|
-
|
156
|
-
paginator = PagedPaginator.new(params)
|
157
|
-
links_params = paginator.links_page_params(record_count: 51)
|
158
|
-
|
159
|
-
assert_equal 3, links_params.size
|
160
|
-
|
161
|
-
assert_equal 5, links_params['first']['size']
|
162
|
-
assert_equal 1, links_params['first']['number']
|
163
|
-
|
164
|
-
assert_equal 5, links_params['next']['size']
|
165
|
-
assert_equal 2, links_params['next']['number']
|
166
|
-
|
167
|
-
assert_equal 5, links_params['last']['size']
|
168
|
-
assert_equal 11, links_params['last']['number']
|
169
|
-
end
|
170
|
-
|
171
|
-
def test_paged_links_page_params_large_data_set_middle
|
172
|
-
params = ActionController::Parameters.new(
|
173
|
-
{
|
174
|
-
size: 5,
|
175
|
-
number: 4
|
176
|
-
}
|
177
|
-
)
|
178
|
-
|
179
|
-
paginator = PagedPaginator.new(params)
|
180
|
-
links_params = paginator.links_page_params(record_count: 50)
|
181
|
-
|
182
|
-
assert_equal 4, links_params.size
|
183
|
-
|
184
|
-
assert_equal 5, links_params['first']['size']
|
185
|
-
assert_equal 1, links_params['first']['number']
|
186
|
-
|
187
|
-
assert_equal 5, links_params['prev']['size']
|
188
|
-
assert_equal 3, links_params['prev']['number']
|
189
|
-
|
190
|
-
assert_equal 5, links_params['next']['size']
|
191
|
-
assert_equal 5, links_params['next']['number']
|
192
|
-
|
193
|
-
assert_equal 5, links_params['last']['size']
|
194
|
-
assert_equal 10, links_params['last']['number']
|
195
|
-
end
|
196
|
-
|
197
|
-
def test_paged_links_page_params_large_data_set_end
|
198
|
-
params = ActionController::Parameters.new(
|
199
|
-
{
|
200
|
-
size: 5,
|
201
|
-
number: 10
|
202
|
-
}
|
203
|
-
)
|
204
|
-
|
205
|
-
paginator = PagedPaginator.new(params)
|
206
|
-
links_params = paginator.links_page_params(record_count: 50)
|
207
|
-
|
208
|
-
assert_equal 3, links_params.size
|
209
|
-
|
210
|
-
assert_equal 5, links_params['first']['size']
|
211
|
-
assert_equal 1, links_params['first']['number']
|
212
|
-
|
213
|
-
assert_equal 5, links_params['prev']['size']
|
214
|
-
assert_equal 9, links_params['prev']['number']
|
215
|
-
|
216
|
-
assert_equal 5, links_params['last']['size']
|
217
|
-
assert_equal 10, links_params['last']['number']
|
218
|
-
end
|
219
|
-
|
220
|
-
def test_paged_links_page_params_large_data_set_past_end
|
221
|
-
params = ActionController::Parameters.new(
|
222
|
-
{
|
223
|
-
size: 5,
|
224
|
-
number: 11
|
225
|
-
}
|
226
|
-
)
|
227
|
-
|
228
|
-
paginator = PagedPaginator.new(params)
|
229
|
-
links_params = paginator.links_page_params(record_count: 50)
|
230
|
-
|
231
|
-
assert_equal 3, links_params.size
|
232
|
-
|
233
|
-
assert_equal 5, links_params['first']['size']
|
234
|
-
assert_equal 1, links_params['first']['number']
|
235
|
-
|
236
|
-
assert_equal 5, links_params['prev']['size']
|
237
|
-
assert_equal 10, links_params['prev']['number']
|
238
|
-
|
239
|
-
assert_equal 5, links_params['last']['size']
|
240
|
-
assert_equal 10, links_params['last']['number']
|
241
|
-
end
|
242
|
-
end
|