test/system/rack_tests.rb in dassets-0.15.0 vs test/system/rack_tests.rb in dassets-0.15.1
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require "assert"
require "dassets"
require "assert-rack-test"
require "fileutils"
@@ -37,11 +39,12 @@
assert_that(resp.headers["Content-Length"])
.equals(Dassets["file2.txt"].size.to_s)
assert_that(resp.body).is_empty
end
- should "return a partial content response on valid partial content requests" do
+ should "return a partial content response on valid partial content "\
+ "requests" do
content = Dassets["file1.txt"].content
size = Factory.integer(content.length)
# see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
env = { "HTTP_RANGE" => "bytes=0-#{size}" }
resp = get "/file1-daa05c683a4913b268653f7a7e36a5b4.txt", {}, env
@@ -57,11 +60,12 @@
assert_that(resp.status).equals(200)
assert_that(resp.body).equals(Dassets["file1.txt"].content)
end
- should "return a full response on multiple-range partial content requests" do
+ should "return a full response on multiple-range partial content "\
+ "requests" do
# see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
env = { "HTTP_RANGE" => "bytes=0-1,2-3" }
resp = get "/file1-daa05c683a4913b268653f7a7e36a5b4.txt", {}, env
assert_that(resp.status).equals(200)
@@ -104,12 +108,16 @@
class NotModifiedTests < RackTests
desc "requesting an existing asset file that has not been modified"
should "return a successful response" do
resp =
- get("/file1-daa05c683a4913b268653f7a7e36a5b4.txt", {}, {
- "HTTP_IF_MODIFIED_SINCE" => Dassets["file1.txt"].mtime.to_s
- })
+ get(
+ "/file1-daa05c683a4913b268653f7a7e36a5b4.txt",
+ {},
+ {
+ "HTTP_IF_MODIFIED_SINCE" => Dassets["file1.txt"].mtime.to_s,
+ },
+ )
assert_that(resp.status).equals(304)
assert_that(resp.body).is_empty
end
end