forked from piotrmurach/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpagination.feature
More file actions
167 lines (145 loc) · 6.58 KB
/
pagination.feature
File metadata and controls
167 lines (145 loc) · 6.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
Feature: Github API pagination
The gem permits to paginate resources.
Scenario: Passing per_page param
Given I have "Github::Repos" instance
When I want to list resources
And I pass the following request options:
| user | per_page |
| wycats | 45 |
And I make request within a cassette named "pagination/repos/list"
Then the response status should be 200
And the response type should be JSON
And the response should have 45 items
When I request next page within a cassette named "pagination/repos/list/next"
Then the response status should be 200
And the response should have 45 items
Scenario: Returned paginated resources are different
Given I have "Github::Repos" instance
When I want to list resources
And I pass the following request options:
| user |
| wycats |
And I make request within a cassette named "pagination/repos/diff"
Then the response status should be 200
And the response type should be JSON
And the response should have 30 items
When I request next page within a cassette named "pagination/repos/diff/next"
Then the response status should be 200
And the response should have 30 items
And the response collection of resources is different for "name" attribute
Scenario: Calling 'commits' for Github::Repos with per_page param
Given I have "Github::Repos::Commits" instance
When I am looking for "list" with the following params:
| user | repo |
| peter-murach | github |
And I pass the following request options:
| per_page |
| 45 |
And I make request within a cassette named "pagination/repos/commits/list"
Then the response status should be 200
And the response type should be JSON
And the response should have 45 items
When I request next page within a cassette named "pagination/repos/commits/next"
Then the response status should be 200
And the response should have 45 items
Scenario: Calling 'list' for Github::Repos::Commits returns different collections
Given I have "Github::Repos::Commits" instance
When I am looking for "list" with the following params:
| user | repo |
| peter-murach | github |
And I make request within a cassette named "pagination/repos/commits/sha"
Then the response status should be 200
And the response should have 30 items
When I request next page within a cassette named "pagination/repos/commits/sha/next"
Then the response status should be 200
And the response should have 30 items
And the response collection of resources is different for "sha" attribute
Scenario: Requesting resources with per_page helper
Given I have "Github::Repos" instance
And I want to list resources
And I pass the following request options:
| user |
| wycats |
When I make request within a cassette named "pagination/repos/per_page/first"
Then the response status should be 200
When I iterate through collection pages within a cassette named "pagination/repos/per_page/each_page"
Then this collection should include first page
Scenario: Navigating resource links with query parameters
Given I have "Github::Issues" instance
And I want to list_repo resources with the following params:
| user | repo |
| wycats | thor |
And I pass the following request options:
| state | per_page |
| closed | 50 |
When I make request within a cassette named "pagination/issues/list/first"
Then the response status should be 200
And the response next link should contain:
| page | per_page | state |
| 2 | 50 | closed |
And the response last link should contain:
| page | per_page | state |
| 4 | 50 | closed |
Scenario: Navigate to Next page
Given I have "Github::Issues" instance
And I want to list_repo resources with the following params:
| user | repo |
| wycats | thor |
And I pass the following request options:
| state | per_page |
| closed | 50 |
When I make request within a cassette named "pagination/issues/list/first"
And I request next page within a cassette named "pagination/issues/list/next"
Then the response status should be 200
And the response first link should contain:
| page | per_page | state |
| 1 | 50 | closed |
And the response next link should contain:
| page | per_page | state |
| 3 | 50 | closed |
And the response prev link should contain:
| page | per_page | state |
| 1 | 50 | closed |
And the response last link should contain:
| page | per_page | state |
| 4 | 50 | closed |
Scenario: Navigate to Last page
Given I have "Github::Issues" instance
And I want to list_repo resources with the following params:
| user | repo |
| wycats | thor |
And I pass the following request options:
| state | per_page |
| closed | 50 |
When I make request within a cassette named "pagination/issues/list/first"
And I request last page within a cassette named "pagination/issues/list/last"
Then the response status should be 200
And the response prev link should contain:
| page | per_page | state |
| 3 | 50 | closed |
And the response first link should contain:
| page | per_page | state |
| 1 | 50 | closed |
Scenario: Navigate to Previous page
Given I have "Github::Issues" instance
And I want to list_repo resources with the following params:
| user | repo |
| wycats | thor |
And I pass the following request options:
| state | per_page | page |
| closed | 50 | 4 |
When I make request within a cassette named "pagination/issues/list/last"
And I request prev page within a cassette named "pagination/issues/list/prev"
Then the response status should be 200
And the response prev link should contain:
| page | per_page | state |
| 2 | 50 | closed |
And the response next link should contain:
| page | per_page | state |
| 4 | 50 | closed |
And the response first link should contain:
| page | per_page | state |
| 1 | 50 | closed |
And the response last link should contain:
| page | per_page | state |
| 4 | 50 | closed |