Use be_nil in specs instead of eq nil

This commit is contained in:
Serdar Dogruyol 2018-01-26 18:35:34 +03:00
parent 159e963404
commit 50f82f5187
2 changed files with 5 additions and 5 deletions

View File

@ -100,8 +100,8 @@ describe "Context" do
Kemal::FilterHandler::INSTANCE.call(context) Kemal::FilterHandler::INSTANCE.call(context)
Kemal::RouteHandler::INSTANCE.call(context) Kemal::RouteHandler::INSTANCE.call(context)
context.get?("non_existent_key").should eq nil context.get?("non_existent_key").should be_nil
context.get?("another_non_existent_key").should eq nil context.get?("another_non_existent_key").should be_nil
end end
end end
end end

View File

@ -61,7 +61,7 @@ describe Kemal::StaticFileHandler do
headers = HTTP::Headers{"Accept-Encoding" => "gzip, deflate, sdch, br"} headers = HTTP::Headers{"Accept-Encoding" => "gzip, deflate, sdch, br"}
response = handle HTTP::Request.new("GET", "/dir/test.txt", headers) response = handle HTTP::Request.new("GET", "/dir/test.txt", headers)
response.status_code.should eq(200) response.status_code.should eq(200)
response.headers["Content-Encoding"]?.should eq nil response.headers["Content-Encoding"]?.should be_nil
end end
it "should not gzip a file if config is false, headers accept gzip and file is > 880 bytes" do it "should not gzip a file if config is false, headers accept gzip and file is > 880 bytes" do
@ -69,7 +69,7 @@ describe Kemal::StaticFileHandler do
headers = HTTP::Headers{"Accept-Encoding" => "gzip, deflate, sdch, br"} headers = HTTP::Headers{"Accept-Encoding" => "gzip, deflate, sdch, br"}
response = handle HTTP::Request.new("GET", "/dir/bigger.txt", headers) response = handle HTTP::Request.new("GET", "/dir/bigger.txt", headers)
response.status_code.should eq(200) response.status_code.should eq(200)
response.headers["Content-Encoding"]?.should eq nil response.headers["Content-Encoding"]?.should be_nil
end end
it "should not serve a not found file" do it "should not serve a not found file" do
@ -117,7 +117,7 @@ describe Kemal::StaticFileHandler do
if response.status_code == 206 if response.status_code == 206
response.headers.has_key?("Content-Range").should eq true response.headers.has_key?("Content-Range").should eq true
match = response.headers["Content-Range"].match(/bytes (\d+)-(\d+)\/(\d+)/) match = response.headers["Content-Range"].match(/bytes (\d+)-(\d+)\/(\d+)/)
match.should_not eq nil match.should_not be_nil
if match if match
start_range = match[1].to_i { 0 } start_range = match[1].to_i { 0 }
end_range = match[2].to_i { 0 } end_range = match[2].to_i { 0 }