spec/plugin/not_found_spec.rb in roda-1.2.0 vs spec/plugin/not_found_spec.rb in roda-1.3.0
- old
+ new
@@ -36,9 +36,38 @@
end
status.should == 403
end
+ it "calculates correct Content-Length" do
+ app(:bare) do
+ plugin :not_found do
+ "a"
+ end
+
+ route{}
+ end
+
+ header('Content-Length').should == "1"
+ end
+
+ it "clears existing headers" do
+ app(:bare) do
+ plugin :not_found do ||
+ "a"
+ end
+
+ route do |r|
+ response['Content-Type'] = 'text/pdf'
+ response['Foo'] = 'bar'
+ nil
+ end
+ end
+
+ header('Content-Type').should == 'text/html'
+ header('Foo').should == nil
+ end
+
it "does not modify behavior if not_found is not called" do
app(:not_found) do |r|
r.on "a" do
"found"
end