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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -7
  3. data/features/clean_build.feature +18 -0
  4. data/features/cli/preview_server-hook.feature +17 -0
  5. data/features/cli/preview_server.feature +20 -20
  6. data/features/data.feature +28 -0
  7. data/features/step_definitions/queryable_steps.rb +122 -45
  8. data/features/stylus.feature +1 -1
  9. data/fixtures/asciidoc-app/source/hello-with-title.adoc +1 -0
  10. data/fixtures/clean-app/config-hidden-dir-after.rb +5 -0
  11. data/fixtures/clean-app/config-hidden-dir-before.rb +1 -0
  12. data/fixtures/preview-server-hook-app/config.rb +19 -0
  13. data/fixtures/preview-server-hook-app/source/index.html.erb +9 -0
  14. data/lib/middleman-core.rb +0 -4
  15. data/lib/middleman-core/application.rb +3 -0
  16. data/lib/middleman-core/cli.rb +1 -1
  17. data/lib/middleman-core/cli/build.rb +1 -1
  18. data/lib/middleman-core/cli/server.rb +1 -1
  19. data/lib/middleman-core/configuration.rb +1 -1
  20. data/lib/middleman-core/core_extensions/data.rb +4 -8
  21. data/lib/middleman-core/core_extensions/data/file_loader.rb +71 -0
  22. data/lib/middleman-core/core_extensions/rendering.rb +8 -8
  23. data/lib/middleman-core/core_extensions/show_exceptions.rb +1 -1
  24. data/lib/middleman-core/dns_resolver/basic_network_resolver.rb +2 -2
  25. data/lib/middleman-core/extensions.rb +0 -2
  26. data/lib/middleman-core/meta_pages/sitemap_resource.rb +2 -0
  27. data/lib/middleman-core/meta_pages/sitemap_tree.rb +1 -1
  28. data/lib/middleman-core/preview_server.rb +9 -10
  29. data/lib/middleman-core/preview_server/server_information.rb +12 -3
  30. data/lib/middleman-core/preview_server/server_information_callback_proxy.rb +35 -0
  31. data/lib/middleman-core/preview_server/server_url.rb +17 -4
  32. data/lib/middleman-core/renderers/asciidoc.rb +1 -1
  33. data/lib/middleman-core/renderers/liquid.rb +1 -1
  34. data/lib/middleman-core/sitemap/extensions/content_type.rb +1 -1
  35. data/lib/middleman-core/sitemap/store.rb +9 -8
  36. data/lib/middleman-core/step_definitions.rb +1 -1
  37. data/lib/middleman-core/step_definitions/builder_steps.rb +10 -12
  38. data/lib/middleman-core/step_definitions/commandline_steps.rb +9 -9
  39. data/lib/middleman-core/step_definitions/middleman_steps.rb +10 -2
  40. data/lib/middleman-core/step_definitions/server_steps.rb +50 -30
  41. data/lib/middleman-core/templates/shared/Gemfile.tt +2 -2
  42. data/lib/middleman-core/templates/shared/config.ru +0 -1
  43. data/lib/middleman-core/templates/shared/gitignore +3 -0
  44. data/lib/middleman-core/util.rb +1 -1
  45. data/lib/middleman-core/version.rb +1 -1
  46. data/lib/middleman-more/core_extensions/default_helpers.rb +13 -2
  47. data/lib/middleman-more/extensions/cache_buster.rb +1 -1
  48. data/middleman-core.gemspec +4 -2
  49. metadata +15 -5
  50. data/.gemtest +0 -0
  51. data/.rspec +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e3c2639ce04b7a22efad4cf9307e3c157fa3214
4
- data.tar.gz: 9359a06926df1e0c3d8e9115c77898001ec1126a
3
+ metadata.gz: 33038072c8408f70a3c27303e4a97b4bafd70bf9
4
+ data.tar.gz: b19a56c81c79763fb1521360c02f4f674a2bc16e
5
5
  SHA512:
6
- metadata.gz: 4c6e0738451a9b3f720b60489d807d9ef6ffcc420fc2e3626b66ae8c616343eec91f9bdb88272bd50d224c4e4cce88a3ad1d24aaeba95deefe52fd5117bb74c6
7
- data.tar.gz: 20c3f6219b96c8cfd93f316f7f58d33a9369e3d9451bef65f3d70888e60767f145348c71508136bc365a6f747439923736bdaf1ae492ddead01ee9fed949eed3
6
+ metadata.gz: 7baf9acd082921715a38094c0ef1926348a21d69029648c7e4c96f258ddf68a43aa91f1af989df68486da16d8f9f4a262b8e9412bd809b80d9515dec74b236c0
7
+ data.tar.gz: 96d1292ce7c5eb0fabb1f53c48229b9be9dd2afaa7b871685ee6f2dd8543fcc6eba100b46632989f01ae57d9d5c980b73b05c05e0b3dd754ad4b552421cc9053
data/Rakefile CHANGED
@@ -1,7 +1 @@
1
- # coding:utf-8
2
- RAKE_ROOT = __FILE__
3
-
4
- GEM_NAME = ENV['NAME'] || 'middleman-core'
5
-
6
- require 'rubygems'
7
- require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper')
1
+ require_relative '../gem_rake_helper'
@@ -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 bind to ":::4567", "0.0.0.0:4567"
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 bind to ":::4567", "0.0.0.0:4567"
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 bind to "127.0.0.1:4567"
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 bind to "127.0.0.1:4567"
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 bind to "127.0.0.5:4567"
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 bind to "::1:4567"
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 bind to "0.0.0.0:4567"
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 bind to ":::4567"
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 bind to "127.0.0.1:4567"
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 bind to "127.0.0.1:4567"
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 bind to "127.0.0.1:4567"
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 bind to "127.0.0.1:4567"
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 bind to "::1:4567"
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 bind to ":::4567", "0.0.0.0:4567"
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 bind to ":::65432", "0.0.0.0:65432"
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 bind to ":::65432", "0.0.0.0:65432"
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 bind to "127.0.0.1:4567"
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 bind to "127.0.0.1:4567"
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 bind to "127.0.0.1:4567"
523
+ The Middleman preview server is bound to "127.0.0.1:4567"
524
524
  """
525
525
  And the output should contain:
526
526
  """
@@ -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
- selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :author, :operator => 'zomg'
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
- @server_inst.sitemap.order_by(:id).limit(2).all.map { |r| r.raw_data[:id] }.sort.should == [1,2].sort
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
- @server_inst.sitemap.order_by(:id).offset(2).all.map { |r| r.raw_data[:id] }.sort.should == [3,4,5].sort
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
- @server_inst.sitemap.order_by(:id).offset(1).limit(2).all.map { |r| r.raw_data[:id] }.sort.should == [2,3].sort
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
- @server_inst.sitemap.order_by(:id).offset(5).all.should == []
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
- documents = @server_inst.sitemap.resources.select { |r| !r.raw_data.empty? }
43
- document_1 = documents[0]
44
- document_2 = documents[1]
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
- found_document = @server_inst.sitemap.where(:title => document_1.raw_data[:title]).first
47
- document_1.should == found_document
48
-
49
- found_document = @server_inst.sitemap.where(:title => document_2.raw_data[:title]).first
50
- document_2.should == found_document
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
- documents = @server_inst.sitemap.resources.select { |r| !r.raw_data.empty? }
55
- document_1 = documents[0]
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
- document_proxy = @server_inst.sitemap.where(:title => document_1.raw_data[:title])
58
- document_proxy.where(:id => document_1.raw_data[:id])
59
- document_1.should == document_proxy.first
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
- result = @server_inst.sitemap.where(:seldom_attribute => 'is seldom').all
64
- result.map { |r| r.raw_data[:id] }.should == [4]
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
- found_documents = @server_inst.sitemap.where(selector => 2).all
70
- found_documents.map { |r| r.raw_data[:id] }.sort.should == [5,3,4].sort
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
- found_documents = @server_inst.sitemap.where(selector => 2).all
76
- found_documents.map { |r| r.raw_data[:id] }.sort.should == [2,5,3,4].sort
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
- found_documents = @server_inst.sitemap.where(selector => [2,3]).all
82
- found_documents.map { |r| r.raw_data[:id] }.sort.should == [2,3].sort
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
- found_documents = @server_inst.sitemap.where(selector => 2).all
88
- found_documents.map { |r| r.raw_data[:id] }.should == [1]
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
- found_documents = @server_inst.sitemap.where(selector => 2).all
94
- found_documents.map { |r| r.raw_data[:id] }.sort.should == [1,2].sort
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
- found_documents = @server_inst.sitemap.where(selector => 'ruby').all
100
- found_documents.map { |r| r.raw_data[:id] }.sort.should == [1,2].sort
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
- documents_proxy = @server_inst.sitemap.where(in_selector => [2,3])
107
- found_documents = documents_proxy.where(gt_selector => 2).all
108
- found_documents.map { |r| r.raw_data[:id] }.should == [3]
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
- found_documents = @server_inst.sitemap.where(selector => 2, :status => :published).all
114
- found_documents.map { |r| r.raw_data[:id] }.sort.should == [1,2].sort
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
- found_documents = @server_inst.sitemap.order_by(:title => :asc).all
119
- found_documents.map { |r| r.raw_data[:id] }.should == [2,3,1,5,4]
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
- found_documents = @server_inst.sitemap.order_by(:title => :desc).all
124
- found_documents.map { |r| r.raw_data[:id] }.should == [4,5,1,3,2]
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
- found_documents = @server_inst.sitemap.order_by(:title).all
129
- found_documents.map { |r| r.raw_data[:id] }.should == [2,3,1,5,4]
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
- found_documents = @server_inst.sitemap.order_by(:status).all
134
- found_documents.map { |r| r.raw_data[:id] }.to_set.should == [1,2].to_set
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