middleman-core 3.4.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +1 -7
- data/features/clean_build.feature +18 -0
- data/features/cli/preview_server-hook.feature +17 -0
- data/features/cli/preview_server.feature +20 -20
- data/features/data.feature +28 -0
- data/features/step_definitions/queryable_steps.rb +122 -45
- data/features/stylus.feature +1 -1
- data/fixtures/asciidoc-app/source/hello-with-title.adoc +1 -0
- data/fixtures/clean-app/config-hidden-dir-after.rb +5 -0
- data/fixtures/clean-app/config-hidden-dir-before.rb +1 -0
- data/fixtures/preview-server-hook-app/config.rb +19 -0
- data/fixtures/preview-server-hook-app/source/index.html.erb +9 -0
- data/lib/middleman-core.rb +0 -4
- data/lib/middleman-core/application.rb +3 -0
- data/lib/middleman-core/cli.rb +1 -1
- data/lib/middleman-core/cli/build.rb +1 -1
- data/lib/middleman-core/cli/server.rb +1 -1
- data/lib/middleman-core/configuration.rb +1 -1
- data/lib/middleman-core/core_extensions/data.rb +4 -8
- data/lib/middleman-core/core_extensions/data/file_loader.rb +71 -0
- data/lib/middleman-core/core_extensions/rendering.rb +8 -8
- data/lib/middleman-core/core_extensions/show_exceptions.rb +1 -1
- data/lib/middleman-core/dns_resolver/basic_network_resolver.rb +2 -2
- data/lib/middleman-core/extensions.rb +0 -2
- data/lib/middleman-core/meta_pages/sitemap_resource.rb +2 -0
- data/lib/middleman-core/meta_pages/sitemap_tree.rb +1 -1
- data/lib/middleman-core/preview_server.rb +9 -10
- data/lib/middleman-core/preview_server/server_information.rb +12 -3
- data/lib/middleman-core/preview_server/server_information_callback_proxy.rb +35 -0
- data/lib/middleman-core/preview_server/server_url.rb +17 -4
- data/lib/middleman-core/renderers/asciidoc.rb +1 -1
- data/lib/middleman-core/renderers/liquid.rb +1 -1
- data/lib/middleman-core/sitemap/extensions/content_type.rb +1 -1
- data/lib/middleman-core/sitemap/store.rb +9 -8
- data/lib/middleman-core/step_definitions.rb +1 -1
- data/lib/middleman-core/step_definitions/builder_steps.rb +10 -12
- data/lib/middleman-core/step_definitions/commandline_steps.rb +9 -9
- data/lib/middleman-core/step_definitions/middleman_steps.rb +10 -2
- data/lib/middleman-core/step_definitions/server_steps.rb +50 -30
- data/lib/middleman-core/templates/shared/Gemfile.tt +2 -2
- data/lib/middleman-core/templates/shared/config.ru +0 -1
- data/lib/middleman-core/templates/shared/gitignore +3 -0
- data/lib/middleman-core/util.rb +1 -1
- data/lib/middleman-core/version.rb +1 -1
- data/lib/middleman-more/core_extensions/default_helpers.rb +13 -2
- data/lib/middleman-more/extensions/cache_buster.rb +1 -1
- data/middleman-core.gemspec +4 -2
- metadata +15 -5
- data/.gemtest +0 -0
- data/.rspec +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33038072c8408f70a3c27303e4a97b4bafd70bf9
|
4
|
+
data.tar.gz: b19a56c81c79763fb1521360c02f4f674a2bc16e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7baf9acd082921715a38094c0ef1926348a21d69029648c7e4c96f258ddf68a43aa91f1af989df68486da16d8f9f4a262b8e9412bd809b80d9515dec74b236c0
|
7
|
+
data.tar.gz: 96d1292ce7c5eb0fabb1f53c48229b9be9dd2afaa7b871685ee6f2dd8543fcc6eba100b46632989f01ae57d9d5c980b73b05c05e0b3dd754ad4b552421cc9053
|
data/Rakefile
CHANGED
@@ -42,3 +42,21 @@ Feature: Build Clean
|
|
42
42
|
Then the following files should not exist:
|
43
43
|
| sub/dir/about.html |
|
44
44
|
| sub/dir/nested/nested.html |
|
45
|
+
|
46
|
+
Scenario: Build and clean an app under a hidden directory
|
47
|
+
Given a fixture app "clean-app"
|
48
|
+
And app "clean-app" is using config "hidden-dir-before"
|
49
|
+
And a built app at "clean-app"
|
50
|
+
Then the following files should exist:
|
51
|
+
| .build/index.html |
|
52
|
+
| .build/should_be_ignored.html |
|
53
|
+
| .build/should_be_ignored2.html |
|
54
|
+
| .build/should_be_ignored3.html |
|
55
|
+
Given app "clean-app" is using config "hidden-dir-after"
|
56
|
+
And a built app at "clean-app"
|
57
|
+
Then the following files should exist:
|
58
|
+
| .build/index.html |
|
59
|
+
And the following files should not exist:
|
60
|
+
| .build/should_be_ignored.html |
|
61
|
+
| .build/should_be_ignored2.html |
|
62
|
+
| .build/should_be_ignored3.html |
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Feature: Run preview server before hook
|
2
|
+
|
3
|
+
Scenario: When run
|
4
|
+
Given a fixture app "preview-server-hook-app"
|
5
|
+
And the default aruba timeout is 30 seconds
|
6
|
+
When I run `middleman server --server-name localhost --bind-address 127.0.0.1` interactively
|
7
|
+
And I stop middleman if the output contains:
|
8
|
+
"""
|
9
|
+
### END ###
|
10
|
+
"""
|
11
|
+
Then the output should contain:
|
12
|
+
"""
|
13
|
+
/// 127.0.0.1:4567 ///
|
14
|
+
/// 4567 ///
|
15
|
+
/// localhost ///
|
16
|
+
/// http://localhost:4567 ///
|
17
|
+
"""
|
@@ -6,7 +6,7 @@ Feature: Run the preview server
|
|
6
6
|
|
7
7
|
Background:
|
8
8
|
Given a fixture app "preview-server-app"
|
9
|
-
And the default aruba timeout is 30 seconds
|
9
|
+
And the default aruba exit timeout is 30 seconds
|
10
10
|
|
11
11
|
Scenario: Start the server with defaults
|
12
12
|
When I run `middleman server` interactively
|
@@ -31,7 +31,7 @@ Feature: Run the preview server
|
|
31
31
|
"""
|
32
32
|
Then the output should contain:
|
33
33
|
"""
|
34
|
-
The Middleman preview server is
|
34
|
+
The Middleman preview server is bound to ":::4567", "0.0.0.0:4567"
|
35
35
|
"""
|
36
36
|
And the output should contain:
|
37
37
|
"""
|
@@ -52,7 +52,7 @@ Feature: Run the preview server
|
|
52
52
|
"""
|
53
53
|
Then the output should contain:
|
54
54
|
"""
|
55
|
-
The Middleman preview server is
|
55
|
+
The Middleman preview server is bound to ":::4567", "0.0.0.0:4567"
|
56
56
|
"""
|
57
57
|
And the output should contain:
|
58
58
|
"""
|
@@ -76,7 +76,7 @@ Feature: Run the preview server
|
|
76
76
|
"""
|
77
77
|
Then the output should contain:
|
78
78
|
"""
|
79
|
-
The Middleman preview server is
|
79
|
+
The Middleman preview server is bound to "127.0.0.1:4567"
|
80
80
|
"""
|
81
81
|
And the output should contain:
|
82
82
|
"""
|
@@ -104,7 +104,7 @@ Feature: Run the preview server
|
|
104
104
|
"""
|
105
105
|
Then the output should contain:
|
106
106
|
"""
|
107
|
-
The Middleman preview server is
|
107
|
+
The Middleman preview server is bound to "127.0.0.1:4567"
|
108
108
|
"""
|
109
109
|
And the output should contain:
|
110
110
|
"""
|
@@ -127,7 +127,7 @@ Feature: Run the preview server
|
|
127
127
|
"""
|
128
128
|
Then the output should contain:
|
129
129
|
"""
|
130
|
-
The Middleman preview server is
|
130
|
+
The Middleman preview server is bound to "127.0.0.5:4567"
|
131
131
|
"""
|
132
132
|
And the output should contain:
|
133
133
|
"""
|
@@ -151,7 +151,7 @@ Feature: Run the preview server
|
|
151
151
|
"""
|
152
152
|
Then the output should contain:
|
153
153
|
"""
|
154
|
-
The Middleman preview server is
|
154
|
+
The Middleman preview server is bound to "::1:4567"
|
155
155
|
"""
|
156
156
|
And the output should contain:
|
157
157
|
"""
|
@@ -170,7 +170,7 @@ Feature: Run the preview server
|
|
170
170
|
"""
|
171
171
|
Then the output should contain:
|
172
172
|
"""
|
173
|
-
The Middleman preview server is
|
173
|
+
The Middleman preview server is bound to "0.0.0.0:4567"
|
174
174
|
"""
|
175
175
|
And the output should contain:
|
176
176
|
"""
|
@@ -189,7 +189,7 @@ Feature: Run the preview server
|
|
189
189
|
"""
|
190
190
|
Then the output should contain:
|
191
191
|
"""
|
192
|
-
The Middleman preview server is
|
192
|
+
The Middleman preview server is bound to ":::4567"
|
193
193
|
"""
|
194
194
|
And the output should contain:
|
195
195
|
"""
|
@@ -213,7 +213,7 @@ Feature: Run the preview server
|
|
213
213
|
"""
|
214
214
|
Then the output should contain:
|
215
215
|
"""
|
216
|
-
The Middleman preview server is
|
216
|
+
The Middleman preview server is bound to "127.0.0.1:4567"
|
217
217
|
"""
|
218
218
|
And the output should contain:
|
219
219
|
"""
|
@@ -241,7 +241,7 @@ Feature: Run the preview server
|
|
241
241
|
"""
|
242
242
|
Then the output should contain:
|
243
243
|
"""
|
244
|
-
The Middleman preview server is
|
244
|
+
The Middleman preview server is bound to "127.0.0.1:4567"
|
245
245
|
"""
|
246
246
|
And the output should contain:
|
247
247
|
"""
|
@@ -265,7 +265,7 @@ Feature: Run the preview server
|
|
265
265
|
"""
|
266
266
|
Then the output should contain:
|
267
267
|
"""
|
268
|
-
The Middleman preview server is
|
268
|
+
The Middleman preview server is bound to "127.0.0.1:4567"
|
269
269
|
"""
|
270
270
|
And the output should contain:
|
271
271
|
"""
|
@@ -284,7 +284,7 @@ Feature: Run the preview server
|
|
284
284
|
"""
|
285
285
|
Then the output should contain:
|
286
286
|
"""
|
287
|
-
The Middleman preview server is
|
287
|
+
The Middleman preview server is bound to "127.0.0.1:4567"
|
288
288
|
"""
|
289
289
|
And the output should contain:
|
290
290
|
"""
|
@@ -303,7 +303,7 @@ Feature: Run the preview server
|
|
303
303
|
"""
|
304
304
|
Then the output should contain:
|
305
305
|
"""
|
306
|
-
The Middleman preview server is
|
306
|
+
The Middleman preview server is bound to "::1:4567"
|
307
307
|
"""
|
308
308
|
And the output should contain:
|
309
309
|
"""
|
@@ -322,7 +322,7 @@ Feature: Run the preview server
|
|
322
322
|
"""
|
323
323
|
Then the output should contain:
|
324
324
|
"""
|
325
|
-
The Middleman preview server is
|
325
|
+
The Middleman preview server is bound to ":::4567", "0.0.0.0:4567"
|
326
326
|
"""
|
327
327
|
And the output should contain:
|
328
328
|
"""
|
@@ -341,7 +341,7 @@ Feature: Run the preview server
|
|
341
341
|
"""
|
342
342
|
Then the output should contain:
|
343
343
|
"""
|
344
|
-
The Middleman preview server is
|
344
|
+
The Middleman preview server is bound to ":::65432", "0.0.0.0:65432"
|
345
345
|
"""
|
346
346
|
|
347
347
|
Scenario: Start the server with port 65432 configured via config.rb
|
@@ -356,7 +356,7 @@ Feature: Run the preview server
|
|
356
356
|
"""
|
357
357
|
Then the output should contain:
|
358
358
|
"""
|
359
|
-
The Middleman preview server is
|
359
|
+
The Middleman preview server is bound to ":::65432", "0.0.0.0:65432"
|
360
360
|
"""
|
361
361
|
|
362
362
|
Scenario: Start the server when port is blocked by other middleman instance
|
@@ -456,7 +456,7 @@ Feature: Run the preview server
|
|
456
456
|
"""
|
457
457
|
Then the output should contain:
|
458
458
|
"""
|
459
|
-
The Middleman preview server is
|
459
|
+
The Middleman preview server is bound to "127.0.0.1:4567"
|
460
460
|
"""
|
461
461
|
And the output should contain:
|
462
462
|
"""
|
@@ -488,7 +488,7 @@ Feature: Run the preview server
|
|
488
488
|
"""
|
489
489
|
Then the output should contain:
|
490
490
|
"""
|
491
|
-
The Middleman preview server is
|
491
|
+
The Middleman preview server is bound to "127.0.0.1:4567"
|
492
492
|
"""
|
493
493
|
And the output should contain:
|
494
494
|
"""
|
@@ -520,7 +520,7 @@ Feature: Run the preview server
|
|
520
520
|
"""
|
521
521
|
Then the output should contain:
|
522
522
|
"""
|
523
|
-
The Middleman preview server is
|
523
|
+
The Middleman preview server is bound to "127.0.0.1:4567"
|
524
524
|
"""
|
525
525
|
And the output should contain:
|
526
526
|
"""
|
data/features/data.feature
CHANGED
@@ -51,3 +51,31 @@ Feature: Local Data API
|
|
51
51
|
Then I should see "title1:Hello"
|
52
52
|
Then I should see "title2:More"
|
53
53
|
Then I should see "title3:Stuff"
|
54
|
+
|
55
|
+
Scenario: Invalid YAML
|
56
|
+
Given a fixture app "basic-data-app"
|
57
|
+
And the default aruba exit timeout is 30 seconds
|
58
|
+
And a file named "data/test.yml" with:
|
59
|
+
"""
|
60
|
+
'ASDSFDa:
|
61
|
+
-asdf asdf
|
62
|
+
"""
|
63
|
+
When I run `middleman build`
|
64
|
+
Then the output should contain:
|
65
|
+
"""
|
66
|
+
failed due to an error:
|
67
|
+
"""
|
68
|
+
|
69
|
+
Scenario: Invalid JSON
|
70
|
+
Given a fixture app "basic-data-app"
|
71
|
+
And the default aruba exit timeout is 30 seconds
|
72
|
+
And a file named "data/test.json" with:
|
73
|
+
"""
|
74
|
+
'ASDSFDa:
|
75
|
+
-asdf asdf
|
76
|
+
"""
|
77
|
+
When I run `middleman build`
|
78
|
+
Then the output should contain:
|
79
|
+
"""
|
80
|
+
failed due to an error:
|
81
|
+
"""
|
@@ -18,118 +18,195 @@ end
|
|
18
18
|
|
19
19
|
Then /^should raise an exception if the operator is not supported$/ do
|
20
20
|
expect {
|
21
|
-
|
21
|
+
::Middleman::Sitemap::Queryable::Selector.new :attribute => :author, :operator => 'zomg'
|
22
22
|
}.to raise_error(::Middleman::Sitemap::Queryable::OperatorNotSupportedError)
|
23
23
|
end
|
24
24
|
|
25
25
|
Then /^should limit the documents to the number specified$/ do
|
26
|
-
|
26
|
+
cd '.' do
|
27
|
+
with_environment do
|
28
|
+
@server_inst.sitemap.order_by(:id).limit(2).all.map { |r| r.raw_data[:id] }.sort.should == [1,2].sort
|
29
|
+
end
|
30
|
+
end
|
27
31
|
end
|
28
32
|
|
29
33
|
Then /^should offset the documents by the number specified$/ do
|
30
|
-
|
34
|
+
cd '.' do
|
35
|
+
with_environment do
|
36
|
+
@server_inst.sitemap.order_by(:id).offset(2).all.map { |r| r.raw_data[:id] }.sort.should == [3,4,5].sort
|
37
|
+
end
|
38
|
+
end
|
31
39
|
end
|
32
40
|
|
33
41
|
Then /^should support offset and limit at the same time$/ do
|
34
|
-
|
42
|
+
cd '.' do
|
43
|
+
with_environment do
|
44
|
+
@server_inst.sitemap.order_by(:id).offset(1).limit(2).all.map { |r| r.raw_data[:id] }.sort.should == [2,3].sort
|
45
|
+
end
|
46
|
+
end
|
35
47
|
end
|
36
48
|
|
37
49
|
Then /^should not freak out about an offset higher than the document count$/ do
|
38
|
-
|
50
|
+
cd '.' do
|
51
|
+
with_environment do
|
52
|
+
@server_inst.sitemap.order_by(:id).offset(5).all.should == []
|
53
|
+
end
|
54
|
+
end
|
39
55
|
end
|
40
56
|
|
41
57
|
Then /^should return the right documents$/ do
|
42
|
-
|
43
|
-
|
44
|
-
|
58
|
+
cd '.' do
|
59
|
+
with_environment do
|
60
|
+
documents = @server_inst.sitemap.resources.select { |r| !r.raw_data.empty? }
|
61
|
+
document_1 = documents[0]
|
62
|
+
document_2 = documents[1]
|
45
63
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
64
|
+
found_document = @server_inst.sitemap.where(:title => document_1.raw_data[:title]).first
|
65
|
+
document_1.should == found_document
|
66
|
+
|
67
|
+
found_document = @server_inst.sitemap.where(:title => document_2.raw_data[:title]).first
|
68
|
+
document_2.should == found_document
|
69
|
+
end
|
70
|
+
end
|
51
71
|
end
|
52
72
|
|
53
73
|
Then /^should be chainable$/ do
|
54
|
-
|
55
|
-
|
74
|
+
cd '.' do
|
75
|
+
with_environment do
|
76
|
+
documents = @server_inst.sitemap.resources.select { |r| !r.raw_data.empty? }
|
77
|
+
document_1 = documents[0]
|
56
78
|
|
57
|
-
|
58
|
-
|
59
|
-
|
79
|
+
document_proxy = @server_inst.sitemap.where(:title => document_1.raw_data[:title])
|
80
|
+
document_proxy.where(:id => document_1.raw_data[:id])
|
81
|
+
document_1.should == document_proxy.first
|
82
|
+
end
|
83
|
+
end
|
60
84
|
end
|
61
85
|
|
62
86
|
Then /^should not be confused by attributes not present in all documents$/ do
|
63
|
-
|
64
|
-
|
87
|
+
cd '.' do
|
88
|
+
with_environment do
|
89
|
+
result = @server_inst.sitemap.where(:seldom_attribute => 'is seldom').all
|
90
|
+
result.map { |r| r.raw_data[:id] }.should == [4]
|
91
|
+
end
|
92
|
+
end
|
65
93
|
end
|
66
94
|
|
67
95
|
Then /^with a gt operator should return the right documents$/ do
|
68
96
|
selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'gt'
|
69
|
-
|
70
|
-
|
97
|
+
cd '.' do
|
98
|
+
with_environment do
|
99
|
+
found_documents = @server_inst.sitemap.where(selector => 2).all
|
100
|
+
found_documents.map { |r| r.raw_data[:id] }.sort.should == [5,3,4].sort
|
101
|
+
end
|
102
|
+
end
|
71
103
|
end
|
72
104
|
|
73
105
|
Then /^with a gte operator should return the right documents$/ do
|
74
106
|
selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'gte'
|
75
|
-
|
76
|
-
|
107
|
+
|
108
|
+
cd '.' do
|
109
|
+
with_environment do
|
110
|
+
found_documents = @server_inst.sitemap.where(selector => 2).all
|
111
|
+
found_documents.map { |r| r.raw_data[:id] }.sort.should == [2,5,3,4].sort
|
112
|
+
end
|
113
|
+
end
|
77
114
|
end
|
78
115
|
|
79
116
|
Then /^with an in operator should return the right documents$/ do
|
80
117
|
selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'in'
|
81
|
-
|
82
|
-
|
118
|
+
cd '.' do
|
119
|
+
with_environment do
|
120
|
+
found_documents = @server_inst.sitemap.where(selector => [2,3]).all
|
121
|
+
found_documents.map { |r| r.raw_data[:id] }.sort.should == [2,3].sort
|
122
|
+
end
|
123
|
+
end
|
83
124
|
end
|
84
125
|
|
85
126
|
Then /^with an lt operator should return the right documents$/ do
|
86
127
|
selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'lt'
|
87
|
-
|
88
|
-
|
128
|
+
cd '.' do
|
129
|
+
with_environment do
|
130
|
+
found_documents = @server_inst.sitemap.where(selector => 2).all
|
131
|
+
found_documents.map { |r| r.raw_data[:id] }.should == [1]
|
132
|
+
end
|
133
|
+
end
|
89
134
|
end
|
90
135
|
|
91
136
|
Then /^with an lte operator should return the right documents$/ do
|
92
137
|
selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'lte'
|
93
|
-
|
94
|
-
|
138
|
+
cd '.' do
|
139
|
+
with_environment do
|
140
|
+
found_documents = @server_inst.sitemap.where(selector => 2).all
|
141
|
+
found_documents.map { |r| r.raw_data[:id] }.sort.should == [1,2].sort
|
142
|
+
end
|
143
|
+
end
|
95
144
|
end
|
96
145
|
|
97
146
|
Then /^with an include operator include should return the right documents$/ do
|
98
147
|
selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :tags, :operator => 'include'
|
99
|
-
|
100
|
-
|
148
|
+
cd '.' do
|
149
|
+
with_environment do
|
150
|
+
found_documents = @server_inst.sitemap.where(selector => 'ruby').all
|
151
|
+
found_documents.map { |r| r.raw_data[:id] }.sort.should == [1,2].sort
|
152
|
+
end
|
153
|
+
end
|
101
154
|
end
|
102
155
|
|
103
156
|
Then /^with mixed operators should return the right documents$/ do
|
104
157
|
in_selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'in'
|
105
158
|
gt_selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'gt'
|
106
|
-
|
107
|
-
|
108
|
-
|
159
|
+
cd '.' do
|
160
|
+
with_environment do
|
161
|
+
documents_proxy = @server_inst.sitemap.where(in_selector => [2,3])
|
162
|
+
found_documents = documents_proxy.where(gt_selector => 2).all
|
163
|
+
found_documents.map { |r| r.raw_data[:id] }.should == [3]
|
164
|
+
end
|
165
|
+
end
|
109
166
|
end
|
110
167
|
|
111
168
|
Then /^using multiple constrains in one where should return the right documents$/ do
|
112
169
|
selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'lte'
|
113
|
-
|
114
|
-
|
170
|
+
cd '.' do
|
171
|
+
with_environment do
|
172
|
+
found_documents = @server_inst.sitemap.where(selector => 2, :status => :published).all
|
173
|
+
found_documents.map { |r| r.raw_data[:id] }.sort.should == [1,2].sort
|
174
|
+
end
|
175
|
+
end
|
115
176
|
end
|
116
177
|
|
117
178
|
Then /^should support ordering by attribute ascending$/ do
|
118
|
-
|
119
|
-
|
179
|
+
cd '.' do
|
180
|
+
with_environment do
|
181
|
+
found_documents = @server_inst.sitemap.order_by(:title => :asc).all
|
182
|
+
found_documents.map { |r| r.raw_data[:id] }.should == [2,3,1,5,4]
|
183
|
+
end
|
184
|
+
end
|
120
185
|
end
|
121
186
|
|
122
187
|
Then /^should support ordering by attribute descending$/ do
|
123
|
-
|
124
|
-
|
188
|
+
cd '.' do
|
189
|
+
with_environment do
|
190
|
+
found_documents = @server_inst.sitemap.order_by(:title => :desc).all
|
191
|
+
found_documents.map { |r| r.raw_data[:id] }.should == [4,5,1,3,2]
|
192
|
+
end
|
193
|
+
end
|
125
194
|
end
|
126
195
|
|
127
196
|
Then /^should order by attribute ascending by default$/ do
|
128
|
-
|
129
|
-
|
197
|
+
cd '.' do
|
198
|
+
with_environment do
|
199
|
+
found_documents = @server_inst.sitemap.order_by(:title).all
|
200
|
+
found_documents.map { |r| r.raw_data[:id] }.should == [2,3,1,5,4]
|
201
|
+
end
|
202
|
+
end
|
130
203
|
end
|
131
204
|
|
132
205
|
Then /^should exclude documents that do not own the attribute$/ do
|
133
|
-
|
134
|
-
|
206
|
+
cd '.' do
|
207
|
+
with_environment do
|
208
|
+
found_documents = @server_inst.sitemap.order_by(:status).all
|
209
|
+
found_documents.map { |r| r.raw_data[:id] }.to_set.should == [1,2].to_set
|
210
|
+
end
|
211
|
+
end
|
135
212
|
end
|