test/extra/test_auto_compiler.rb in nanoc3-3.2.3 vs test/extra/test_auto_compiler.rb in nanoc3-3.2.4
- old
+ new
@@ -30,11 +30,11 @@
autocompiler = Nanoc3::Extra::AutoCompiler.new('.')
autocompiler.stubs(:build_site)
autocompiler.stubs(:site).returns(site)
# Serve
- status, headers, body = autocompiler.instance_eval { call('PATH_INFO' => '/foo/index.html') }
+ status, headers, body = autocompiler.instance_eval { call('REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/foo/index.html') }
# Check response
assert_equal(200, status)
assert_equal('text/html', headers['Content-Type'])
body.each do |b|
@@ -57,11 +57,11 @@
autocompiler = Nanoc3::Extra::AutoCompiler.new('.')
autocompiler.stubs(:build_site)
autocompiler.stubs(:site).returns(site)
# Serve
- status, headers, body = autocompiler.instance_eval { call('PATH_INFO' => '/afjwiagoawf.html') }
+ status, headers, body = autocompiler.instance_eval { call('REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/afjwiagoawf.html') }
# Check response
assert_equal(404, status)
end
end
@@ -92,11 +92,11 @@
autocompiler.stubs(:build_site)
autocompiler.stubs(:site).returns(site)
autocompiler.expects(:file_server).returns(file_server)
# Run
- autocompiler.instance_eval { call('PATH_INFO' => 'somefile.txt') }
+ autocompiler.instance_eval { call('REQUEST_METHOD' => 'GET', 'PATH_INFO' => 'somefile.txt') }
# Check
assert_equal(file_server.expected_path_info, file_server.actual_path_info)
end
end
@@ -126,11 +126,11 @@
autocompiler.stubs(:build_site)
autocompiler.stubs(:site).returns(site)
autocompiler.expects(:file_server).returns(file_server)
# Run
- autocompiler.instance_eval { call('PATH_INFO' => '/foo/bar/') }
+ autocompiler.instance_eval { call('REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/foo/bar/') }
# Check
assert_equal(file_server.expected_path_info, file_server.actual_path_info)
end
end
@@ -160,11 +160,11 @@
autocompiler.stubs(:build_site)
autocompiler.stubs(:site).returns(site)
autocompiler.expects(:file_server).returns(file_server)
# Run
- autocompiler.instance_eval { call('PATH_INFO' => 'foo/bar/') }
+ autocompiler.instance_eval { call('REQUEST_METHOD' => 'GET', 'PATH_INFO' => 'foo/bar/') }
# Check
assert_equal(file_server.expected_path_info, file_server.actual_path_info)
end
end
@@ -194,11 +194,11 @@
autocompiler.stubs(:build_site)
autocompiler.stubs(:site).returns(site)
autocompiler.expects(:file_server).returns(file_server)
# Run
- autocompiler.instance_eval { call('PATH_INFO' => 'foo/bar') }
+ autocompiler.instance_eval { call('REQUEST_METHOD' => 'GET', 'PATH_INFO' => 'foo/bar') }
# Check
assert_equal(file_server.expected_path_info, file_server.actual_path_info)
end
end
@@ -228,11 +228,11 @@
autocompiler.stubs(:build_site)
autocompiler.stubs(:site).returns(site)
autocompiler.expects(:file_server).returns(file_server)
# Run
- autocompiler.instance_eval { call('PATH_INFO' => 'foo/bar') }
+ autocompiler.instance_eval { call('REQUEST_METHOD' => 'GET', 'PATH_INFO' => 'foo/bar') }
# Check
assert_equal(file_server.expected_path_info, file_server.actual_path_info)
end
end
@@ -258,11 +258,11 @@
autocompiler.stubs(:build_site)
autocompiler.stubs(:site).returns(site)
autocompiler.expects(:file_server).returns(file_server)
# Run
- autocompiler.instance_eval { call('PATH_INFO' => 'four-oh-four.txt') }
+ autocompiler.instance_eval { call('REQUEST_METHOD' => 'GET', 'PATH_INFO' => 'four-oh-four.txt') }
# Check
assert_equal(file_server.expected_path_info, file_server.actual_path_info)
end
end
@@ -312,11 +312,11 @@
autocompiler = Nanoc3::Extra::AutoCompiler.new('.')
autocompiler.stubs(:build_site)
autocompiler.stubs(:site).returns(site)
# Serve
- status, headers, body = autocompiler.instance_eval { call('PATH_INFO' => '/') }
+ status, headers, body = autocompiler.instance_eval { call('REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/') }
# Check response
assert_equal(200, status)
assert_equal('text/html', headers['Content-Type'])
body.each do |b|
@@ -346,11 +346,11 @@
autocompiler.stubs(:build_site)
autocompiler.stubs(:site).returns(site)
# Serve
assert_raises(RuntimeError) do
- autocompiler.instance_eval { call('PATH_INFO' => '/whatever/') }
+ autocompiler.instance_eval { call('REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/whatever/') }
end
end
end
end
@@ -373,11 +373,11 @@
io.write "value: Foo"
end
File.utime(Time.now+5, Time.now+5, 'config.yaml')
# Check
- status, headers, body = autocompiler.call('PATH_INFO' => '/')
+ status, headers, body = autocompiler.call('REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/')
body.each do |b|
assert_match /The Grand Value of Configuration is Foo!/, b
end
# Set config to 2nd value
@@ -385,11 +385,11 @@
io.write "value: Bar"
end
File.utime(Time.now+5, Time.now+5, 'config.yaml')
# Check
- status, headers, body = autocompiler.call('PATH_INFO' => '/')
+ status, headers, body = autocompiler.call('REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/')
body.each do |b|
assert_match /The Grand Value of Configuration is Bar!/, b
end
end
end
@@ -406,10 +406,10 @@
site.stubs(:items).returns([])
autocompiler.stubs(:build_site)
autocompiler.stubs(:site).returns(site)
# Test
- result = autocompiler.call('PATH_INFO' => '/%73oftware')
+ result = autocompiler.call('REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/%73oftware')
assert_equal 404, result[0]
assert_match "File not found: /software\n", result[2][0]
end
end