geb 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +3 -0
  3. data/CHANGELOG.md +37 -0
  4. data/CODE_OF_CONDUCT.md +84 -0
  5. data/LICENSE +21 -0
  6. data/README.md +384 -0
  7. data/Rakefile +21 -0
  8. data/bin/geb +21 -0
  9. data/lib/geb/cli.rb +40 -0
  10. data/lib/geb/commands/build.rb +59 -0
  11. data/lib/geb/commands/init.rb +70 -0
  12. data/lib/geb/commands/release.rb +54 -0
  13. data/lib/geb/commands/remote.rb +48 -0
  14. data/lib/geb/commands/server.rb +77 -0
  15. data/lib/geb/commands/upload.rb +48 -0
  16. data/lib/geb/commands/version.rb +36 -0
  17. data/lib/geb/config.rb +103 -0
  18. data/lib/geb/defaults.rb +44 -0
  19. data/lib/geb/git.rb +112 -0
  20. data/lib/geb/page.rb +217 -0
  21. data/lib/geb/partial.rb +150 -0
  22. data/lib/geb/samples/basic/assets/css/site.css +7 -0
  23. data/lib/geb/samples/basic/assets/images/android-chrome-192x192.png +0 -0
  24. data/lib/geb/samples/basic/assets/images/android-chrome-512x512.png +0 -0
  25. data/lib/geb/samples/basic/assets/images/apple-touch-icon.png +0 -0
  26. data/lib/geb/samples/basic/assets/images/favicon-16x16.png +0 -0
  27. data/lib/geb/samples/basic/assets/images/favicon-32x32.png +0 -0
  28. data/lib/geb/samples/basic/assets/images/favicon.ico +0 -0
  29. data/lib/geb/samples/basic/assets/images/hero.png +0 -0
  30. data/lib/geb/samples/basic/assets/images/og-thumb.png +0 -0
  31. data/lib/geb/samples/basic/assets/images/twitter-thumb.png +0 -0
  32. data/lib/geb/samples/basic/assets/js/site.js +5 -0
  33. data/lib/geb/samples/basic/geb.config.yml +70 -0
  34. data/lib/geb/samples/basic/index.html +11 -0
  35. data/lib/geb/samples/basic/page.html +11 -0
  36. data/lib/geb/samples/basic/shared/partials/_analytics.html +9 -0
  37. data/lib/geb/samples/basic/shared/partials/_footer.html +3 -0
  38. data/lib/geb/samples/basic/shared/partials/_global_assets.html +19 -0
  39. data/lib/geb/samples/basic/shared/partials/_header.html +0 -0
  40. data/lib/geb/samples/basic/shared/partials/_meta_tags.html +34 -0
  41. data/lib/geb/samples/basic/shared/templates/_blog_post.html +0 -0
  42. data/lib/geb/samples/basic/shared/templates/_site.html +19 -0
  43. data/lib/geb/samples/basic/site.webmanifest +1 -0
  44. data/lib/geb/samples/bootstrap_jquery/assets/css/site.css +7 -0
  45. data/lib/geb/samples/bootstrap_jquery/assets/images/android-chrome-192x192.png +0 -0
  46. data/lib/geb/samples/bootstrap_jquery/assets/images/android-chrome-512x512.png +0 -0
  47. data/lib/geb/samples/bootstrap_jquery/assets/images/apple-touch-icon.png +0 -0
  48. data/lib/geb/samples/bootstrap_jquery/assets/images/favicon-16x16.png +0 -0
  49. data/lib/geb/samples/bootstrap_jquery/assets/images/favicon-32x32.png +0 -0
  50. data/lib/geb/samples/bootstrap_jquery/assets/images/favicon.ico +0 -0
  51. data/lib/geb/samples/bootstrap_jquery/assets/images/hero.png +0 -0
  52. data/lib/geb/samples/bootstrap_jquery/assets/images/og-thumb.png +0 -0
  53. data/lib/geb/samples/bootstrap_jquery/assets/images/twitter-thumb.png +0 -0
  54. data/lib/geb/samples/bootstrap_jquery/assets/js/site.js +5 -0
  55. data/lib/geb/samples/bootstrap_jquery/blog/blog_post_1.html +35 -0
  56. data/lib/geb/samples/bootstrap_jquery/blog/blog_post_2.html +35 -0
  57. data/lib/geb/samples/bootstrap_jquery/blog/blog_post_3.html +35 -0
  58. data/lib/geb/samples/bootstrap_jquery/blog/index.html +17 -0
  59. data/lib/geb/samples/bootstrap_jquery/geb.config.yml +69 -0
  60. data/lib/geb/samples/bootstrap_jquery/index.html +11 -0
  61. data/lib/geb/samples/bootstrap_jquery/page.html +11 -0
  62. data/lib/geb/samples/bootstrap_jquery/shared/partials/_analytics.html +9 -0
  63. data/lib/geb/samples/bootstrap_jquery/shared/partials/_footer.html +3 -0
  64. data/lib/geb/samples/bootstrap_jquery/shared/partials/_global_assets.html +19 -0
  65. data/lib/geb/samples/bootstrap_jquery/shared/partials/_header.html +0 -0
  66. data/lib/geb/samples/bootstrap_jquery/shared/partials/_meta_tags.html +34 -0
  67. data/lib/geb/samples/bootstrap_jquery/shared/templates/_blog_post.html +0 -0
  68. data/lib/geb/samples/bootstrap_jquery/shared/templates/_site.html +19 -0
  69. data/lib/geb/samples/bootstrap_jquery/site.webmanifest +1 -0
  70. data/lib/geb/samples/geb.config.yml +70 -0
  71. data/lib/geb/server.rb +138 -0
  72. data/lib/geb/site/build.rb +189 -0
  73. data/lib/geb/site/core.rb +229 -0
  74. data/lib/geb/site/release.rb +70 -0
  75. data/lib/geb/site/remote.rb +142 -0
  76. data/lib/geb/site/template.rb +208 -0
  77. data/lib/geb/site.rb +83 -0
  78. data/lib/geb/template.rb +166 -0
  79. data/lib/geb/utilities.rb +110 -0
  80. data/lib/geb.rb +36 -0
  81. data/lib/seth.rb +50 -0
  82. data/sig/geb.rbs +4 -0
  83. data/test/api tests/test_cli.rb +200 -0
  84. data/test/api tests/test_config.rb +330 -0
  85. data/test/api tests/test_defaults.rb +62 -0
  86. data/test/api tests/test_git.rb +105 -0
  87. data/test/api tests/test_page.rb +320 -0
  88. data/test/api tests/test_partial.rb +152 -0
  89. data/test/api tests/test_server.rb +416 -0
  90. data/test/api tests/test_site.rb +1315 -0
  91. data/test/api tests/test_template.rb +249 -0
  92. data/test/api tests/test_utilities.rb +162 -0
  93. data/test/command tests/test_geb_build.rb +199 -0
  94. data/test/command tests/test_geb_init.rb +312 -0
  95. data/test/command tests/test_geb_release.rb +166 -0
  96. data/test/command tests/test_geb_remote.rb +66 -0
  97. data/test/command tests/test_geb_server.rb +122 -0
  98. data/test/command tests/test_geb_upload.rb +96 -0
  99. data/test/command tests/test_geb_version.rb +58 -0
  100. data/test/support/geb_api_test.rb +37 -0
  101. data/test/support/geb_cli_test.rb +275 -0
  102. data/test/support/geb_minitest_ext.rb +35 -0
  103. data/test/support/geb_test_helpers.rb +84 -0
  104. data/test/support/geb_web_server_proxy.rb +128 -0
  105. data/test/test_helper.rb +61 -0
  106. metadata +301 -0
@@ -0,0 +1,416 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # Tests the server class
4
+ #
5
+ # @title Geb - Test - Server
6
+ # @author Edin Mustajbegovic <edin@actiontwelve.com>
7
+ # @copyright 2024 Edin Mustajbegovic
8
+ # @license MIT
9
+ #
10
+ # @see https://github.com/mainfram-work/geb for more information
11
+
12
+ require "test_helper"
13
+
14
+ class TestServer < Geb::ApiTest
15
+
16
+ test "that server initializer handles the auto_build flag set to true" do
17
+
18
+ site_mock = mock('site')
19
+ site_mock.stubs(:site_path).returns('site_path')
20
+ site_mock.stubs(:get_site_output_directory).returns('site_path/output')
21
+ site_mock.stubs(:get_site_release_directory).returns('site_path/release')
22
+
23
+ http_server_mock = mock('webric_httpserver')
24
+ http_server_mock.stubs(:config).returns({:Port => 3456, :DocumentRoot => 'site_path/output'})
25
+
26
+ file_watcher_mock = mock('file_watcher')
27
+ file_watcher_mock.stubs(:ignore)
28
+
29
+ WEBrick::HTTPServer.expects(:new).returns(http_server_mock)
30
+ Listen.stubs(:to).returns(file_watcher_mock)
31
+
32
+ server = Geb::Server.new(site_mock, 3456, true)
33
+
34
+ assert_instance_of Geb::Server, server
35
+
36
+ refute_nil server.instance_variable_get(:@http_server)
37
+ refute_nil server.instance_variable_get(:@file_watcher)
38
+
39
+ end # test "that server initializer handles the auto_build flag set to true"
40
+
41
+ test "that server initializer handles the auto_build flag set to false" do
42
+
43
+ site_mock = mock('site')
44
+ site_mock.stubs(:site_path).returns('site_path')
45
+ site_mock.stubs(:get_site_output_directory).returns('site_path/output')
46
+ site_mock.stubs(:get_site_release_directory).returns('site_path/release')
47
+
48
+ http_server_mock = mock('webric_httpserver')
49
+ http_server_mock.stubs(:config).returns({:Port => 3456, :DocumentRoot => 'site_path/output'})
50
+
51
+ file_watcher_mock = mock('file_watcher')
52
+ file_watcher_mock.stubs(:ignore)
53
+
54
+ WEBrick::HTTPServer.expects(:new).returns(http_server_mock)
55
+ Listen.stubs(:to).returns(file_watcher_mock)
56
+
57
+ server = Geb::Server.new(site_mock, 3456, false)
58
+
59
+ assert_instance_of Geb::Server, server
60
+
61
+ refute_nil server.instance_variable_get(:@http_server)
62
+ assert_nil server.instance_variable_get(:@file_watcher)
63
+
64
+ end # test "that server initializer handles the auto_build flag set to false"
65
+
66
+ test "that server start method starts the http server and file watcher" do
67
+
68
+ site_mock = mock('site')
69
+ site_mock.stubs(:site_path).returns('site_path')
70
+ site_mock.stubs(:get_site_output_directory).returns('site_path/output')
71
+ site_mock.stubs(:get_site_release_directory).returns('site_path/release')
72
+
73
+ http_server_mock = mock('webric_httpserver')
74
+ http_server_mock.expects(:start)
75
+ http_server_mock.stubs(:config).returns({:Port => 3456, :DocumentRoot => 'site_path/output'})
76
+
77
+ file_watcher_mock = mock('file_watcher')
78
+ file_watcher_mock.stubs(:ignore)
79
+ file_watcher_mock.expects(:start)
80
+
81
+ WEBrick::HTTPServer.stubs(:new).returns(http_server_mock)
82
+ Listen.stubs(:to).returns(file_watcher_mock)
83
+
84
+ server = Geb::Server.new(site_mock, 3456, true)
85
+
86
+ server.start
87
+
88
+ sleep 0.1
89
+
90
+ http_server_thread = server.instance_variable_get(:@http_server_thread)
91
+ file_watcher_thread = server.instance_variable_get(:@file_watcher_thread)
92
+
93
+ refute_nil server.instance_variable_get(:@http_server_thread)
94
+ refute_nil server.instance_variable_get(:@file_watcher_thread)
95
+ assert_instance_of Thread, server.instance_variable_get(:@http_server_thread)
96
+ assert_instance_of Thread, server.instance_variable_get(:@file_watcher_thread)
97
+
98
+ http_server_thread.kill
99
+ file_watcher_thread.kill
100
+
101
+ end # test "that server start method starts the http server and file watcher"
102
+
103
+ test "that server start methods starts the http server and not the file watcher" do
104
+
105
+ site_mock = mock('site')
106
+ site_mock.stubs(:site_path).returns('site_path')
107
+ site_mock.stubs(:get_site_output_directory).returns('site_path/output')
108
+ site_mock.stubs(:get_site_release_directory).returns('site_path/release')
109
+
110
+ http_server_mock = mock('webric_httpserver')
111
+ http_server_mock.expects(:start)
112
+ http_server_mock.stubs(:config).returns({:Port => 3456, :DocumentRoot => 'site_path/output'})
113
+
114
+ file_watcher_mock = mock('file_watcher')
115
+ file_watcher_mock.stubs(:ignore)
116
+ file_watcher_mock.expects(:start).never
117
+
118
+ WEBrick::HTTPServer.stubs(:new).returns(http_server_mock)
119
+ Listen.stubs(:to).returns(file_watcher_mock)
120
+
121
+ server = Geb::Server.new(site_mock, 3456, false)
122
+
123
+ server.start
124
+
125
+ sleep 0.1
126
+
127
+ http_server_thread = server.instance_variable_get(:@http_server_thread)
128
+ file_watcher_thread = server.instance_variable_get(:@file_watcher_thread)
129
+
130
+ refute_nil server.instance_variable_get(:@http_server_thread)
131
+ assert_nil server.instance_variable_get(:@file_watcher_thread)
132
+ assert_instance_of Thread, server.instance_variable_get(:@http_server_thread)
133
+ assert_nil file_watcher_thread
134
+
135
+ http_server_thread.kill
136
+
137
+ end # test "that server start methods starts the http server and not the file watcher"
138
+
139
+ test "that server stop method stops the http server and file watcher" do
140
+
141
+ site_mock = mock('site')
142
+ site_mock.stubs(:site_path).returns('site_path')
143
+ site_mock.stubs(:get_site_output_directory).returns('site_path/output')
144
+ site_mock.stubs(:get_site_release_directory).returns('site_path/release')
145
+
146
+ http_server_mock = mock('webric_httpserver')
147
+ http_server_mock.stubs(:config).returns({:Port => 3456, :DocumentRoot => 'site_path/output'})
148
+ http_server_mock.expects(:start)
149
+ http_server_mock.expects(:shutdown)
150
+
151
+
152
+ file_watcher_mock = mock('file_watcher')
153
+ file_watcher_mock.stubs(:ignore)
154
+ file_watcher_mock.expects(:start)
155
+ file_watcher_mock.expects(:stop)
156
+
157
+ WEBrick::HTTPServer.stubs(:new).returns(http_server_mock)
158
+ Listen.stubs(:to).returns(file_watcher_mock)
159
+
160
+ server = Geb::Server.new(site_mock, 3456, true)
161
+
162
+ server.start
163
+
164
+ sleep 0.1
165
+
166
+ server.stop
167
+
168
+ refute server.instance_variable_get(:@http_server_thread).alive?
169
+ refute server.instance_variable_get(:@file_watcher_thread).alive?
170
+
171
+ end # test "that server stop method stops the http server and file watcher"
172
+
173
+ test "that server stop method stops the http server and not the file watcher" do
174
+
175
+ site_mock = mock('site')
176
+ site_mock.stubs(:site_path).returns('site_path')
177
+ site_mock.stubs(:get_site_output_directory).returns('site_path/output')
178
+ site_mock.stubs(:get_site_release_directory).returns('site_path/release')
179
+
180
+ http_server_mock = mock('webric_httpserver')
181
+ http_server_mock.stubs(:config).returns({:Port => 3456, :DocumentRoot => 'site_path/output'})
182
+ http_server_mock.expects(:start)
183
+ http_server_mock.expects(:shutdown)
184
+
185
+ file_watcher_mock = mock('file_watcher')
186
+ file_watcher_mock.stubs(:ignore)
187
+ file_watcher_mock.expects(:start).never
188
+
189
+ WEBrick::HTTPServer.stubs(:new).returns(http_server_mock)
190
+ Listen.stubs(:to).returns(file_watcher_mock)
191
+
192
+ server = Geb::Server.new(site_mock, 3456, false)
193
+
194
+ server.start
195
+
196
+ sleep 0.1
197
+
198
+ server.stop
199
+
200
+ refute server.instance_variable_get(:@http_server_thread).alive?
201
+ assert_nil server.instance_variable_get(:@file_watcher_thread)
202
+
203
+ end # test "that server stop method stops the http server and not the file watcher"
204
+
205
+ test "that server get_http_server method returns a webrick http server instance" do
206
+
207
+ # get the next available port
208
+ port = Geb::Test::WebServerProxy.find_available_port
209
+
210
+ # create a temporary directory
211
+ Dir.mktmpdir do |dir|
212
+
213
+ site_mock = mock('site')
214
+ site_mock.stubs(:site_path).returns(dir)
215
+ site_mock.stubs(:get_site_output_directory).returns(dir)
216
+ site_mock.stubs(:get_site_release_directory).returns(dir)
217
+ http_server_mock = mock('webric_httpserver')
218
+ http_server_mock.stubs(:config).returns({:Port => 3456, :DocumentRoot => 'site_path/output'})
219
+ file_watcher_mock = mock('file_watcher')
220
+ file_watcher_mock.stubs(:ignore)
221
+
222
+ WEBrick::HTTPServer.stubs(:new).returns(http_server_mock)
223
+ Listen.stubs(:to).returns(file_watcher_mock)
224
+
225
+ geb_server = Geb::Server.new(site_mock, port, true)
226
+
227
+ WEBrick::HTTPServer.unstub(:new)
228
+
229
+ original_stdout = $stdout
230
+ original_stderr = $stderr
231
+
232
+ $stdout = StringIO.new
233
+ $stderr = StringIO.new
234
+
235
+ http_server = geb_server.send(:get_http_server)
236
+
237
+ # restore stdout and stderr
238
+ $stdout = original_stdout
239
+ $stderr = original_stderr
240
+
241
+ assert_instance_of WEBrick::HTTPServer, http_server
242
+ assert_equal port, http_server.config[:Port]
243
+ assert_equal dir, http_server.config[:DocumentRoot]
244
+
245
+ end # Dir.mktmpdir
246
+
247
+ end # test "that server get_http_server method returns a webrick http server instance"
248
+
249
+ test "that server get_file_watcher method returns a listen instance" do
250
+
251
+ # create a temporary directory
252
+ Dir.mktmpdir do |dir|
253
+
254
+ site_mock = mock('site')
255
+ site_mock.stubs(:site_path).returns(dir)
256
+ site_mock.stubs(:get_site_output_directory).returns(dir)
257
+ site_mock.stubs(:get_site_release_directory).returns(dir)
258
+ http_server_mock = mock('webric_httpserver')
259
+ http_server_mock.stubs(:config).returns({:Port => 3456, :DocumentRoot => 'site_path/output'})
260
+ file_watcher_mock = mock('file_watcher')
261
+ file_watcher_mock.stubs(:ignore)
262
+
263
+ WEBrick::HTTPServer.stubs(:new).returns(http_server_mock)
264
+ Listen.stubs(:to).returns(file_watcher_mock)
265
+
266
+ geb_server = Geb::Server.new(site_mock, 8888, true)
267
+
268
+ Listen.unstub(:to)
269
+ file_watcher = geb_server.send(:get_file_watcher)
270
+ backend = file_watcher.instance_variable_get(:@backend)
271
+ adapter = backend.instance_variable_get(:@adapter)
272
+ config = adapter.instance_variable_get(:@config)
273
+
274
+ assert_instance_of Listen::Listener, file_watcher
275
+ assert_includes config.directories.first.to_s, dir
276
+
277
+ end # Dir.mktmpdir
278
+
279
+ end # test "that server get_file_watcher method returns a listen instance"
280
+
281
+ test "that the server detects file changes and rebuilds the site" do
282
+
283
+ # create a temporary directory
284
+ Dir.mktmpdir do |dir|
285
+
286
+ site_dir = File.join(dir, 'newsite')
287
+ site_output_directory = File.join(site_dir, 'output/local')
288
+ site_release_directory = File.join(site_dir, 'output/release')
289
+
290
+ file_path_add = File.join(site_dir, 'add.html')
291
+ file_path_modify = File.join(site_dir, 'modify.html')
292
+ file_path_delete = File.join(site_dir, 'delete.html')
293
+
294
+ FileUtils.mkdir_p(site_dir)
295
+ FileUtils.mkdir_p(site_output_directory)
296
+ FileUtils.mkdir_p(site_release_directory)
297
+
298
+ FileUtils.touch(file_path_modify)
299
+ File.write(file_path_modify, 'modify file original content')
300
+ FileUtils.touch(file_path_delete)
301
+ File.write(file_path_delete, 'delete file content')
302
+
303
+ site_mock = mock('site')
304
+ site_mock.stubs(:site_path).returns(site_dir)
305
+ site_mock.stubs(:get_site_output_directory).returns(site_output_directory)
306
+ site_mock.stubs(:get_site_release_directory).returns(site_release_directory)
307
+ site_mock.expects(:build).times(1)
308
+
309
+ http_server_mock = mock('webric_httpserver')
310
+ http_server_mock.stubs(:config).returns({:Port => 3456, :DocumentRoot => 'site_path/output'})
311
+ file_watcher_mock = mock('file_watcher')
312
+ file_watcher_mock.stubs(:ignore)
313
+
314
+ WEBrick::HTTPServer.stubs(:new).returns(http_server_mock)
315
+ Listen.stubs(:to).returns(file_watcher_mock)
316
+
317
+ geb_server = Geb::Server.new(site_mock, 8888, true)
318
+
319
+ Listen.unstub(:to)
320
+
321
+ log_output = ""
322
+ Geb.stubs(:log_start) { |*args| log_output << args.first }
323
+ Geb.stubs(:log) { |*args| log_output << args.first }
324
+
325
+ # initialize a sequence
326
+ Geb.expects(:log_start).times(1).with("Found changes, rebuilding site ... ")
327
+ Geb.expects(:log).times(4)
328
+
329
+ file_watcher = geb_server.send(:get_file_watcher)
330
+
331
+ file_watcher.start
332
+
333
+ sleep 0.5
334
+
335
+ FileUtils.touch(file_path_add)
336
+ File.write(file_path_add, 'add file content')
337
+ File.write(file_path_modify, 'modify file modified content')
338
+ FileUtils.rm(file_path_delete)
339
+
340
+ sleep 0.5
341
+
342
+ file_watcher.stop
343
+
344
+ end # Dir.mktmpdir
345
+
346
+ end # test "that the server detects file changes and rebuilds the site"
347
+
348
+
349
+ test "that the server detects file changes handles exception is build fails" do
350
+
351
+ # create a temporary directory
352
+ Dir.mktmpdir do |dir|
353
+
354
+ site_dir = File.join(dir, 'newsite')
355
+ site_output_directory = File.join(site_dir, 'output/local')
356
+ site_release_directory = File.join(site_dir, 'output/release')
357
+
358
+ file_path_add = File.join(site_dir, 'add.html')
359
+ file_path_modify = File.join(site_dir, 'modify.html')
360
+ file_path_delete = File.join(site_dir, 'delete.html')
361
+
362
+ FileUtils.mkdir_p(site_dir)
363
+ FileUtils.mkdir_p(site_output_directory)
364
+ FileUtils.mkdir_p(site_release_directory)
365
+
366
+ FileUtils.touch(file_path_modify)
367
+ File.write(file_path_modify, 'modify file original content')
368
+ FileUtils.touch(file_path_delete)
369
+ File.write(file_path_delete, 'delete file content')
370
+
371
+ site_mock = mock('site')
372
+ site_mock.stubs(:site_path).returns(site_dir)
373
+ site_mock.stubs(:get_site_output_directory).returns(site_output_directory)
374
+ site_mock.stubs(:get_site_release_directory).returns(site_release_directory)
375
+ site_mock.expects(:build).raises(Geb::Error, "Build failed")
376
+
377
+ http_server_mock = mock('webric_httpserver')
378
+ http_server_mock.stubs(:config).returns({:Port => 3456, :DocumentRoot => 'site_path/output'})
379
+ file_watcher_mock = mock('file_watcher')
380
+ file_watcher_mock.stubs(:ignore)
381
+
382
+ WEBrick::HTTPServer.stubs(:new).returns(http_server_mock)
383
+ Listen.stubs(:to).returns(file_watcher_mock)
384
+
385
+ geb_server = Geb::Server.new(site_mock, 8888, true)
386
+
387
+ Listen.unstub(:to)
388
+
389
+ log_output = ""
390
+ Geb.stubs(:log_start) { |*args| log_output << args.first }
391
+ Geb.stubs(:log) { |*args| log_output << args.first }
392
+
393
+ # initialize a sequence
394
+ Geb.expects(:log_start).times(1).with("Found changes, rebuilding site ... ")
395
+ Geb.expects(:log).times(4)
396
+
397
+ file_watcher = geb_server.send(:get_file_watcher)
398
+
399
+ file_watcher.start
400
+
401
+ sleep 0.5
402
+
403
+ FileUtils.touch(file_path_add)
404
+ File.write(file_path_add, 'add file content')
405
+ File.write(file_path_modify, 'modify file modified content')
406
+ FileUtils.rm(file_path_delete)
407
+
408
+ sleep 0.5
409
+
410
+ file_watcher.stop
411
+
412
+ end # Dir.mktmpdir
413
+
414
+ end # test "that the server detects file changes and rebuilds the site"
415
+
416
+ end # class TestServer < Geb::ApiTest