spec/plugin/default_headers_spec.rb in roda-1.0.0 vs spec/plugin/default_headers_spec.rb in roda-1.1.0
- old
+ new
@@ -5,10 +5,11 @@
h = {'Content-Type'=>'text/json', 'Foo'=>'bar'}
app(:bare) do
plugin :default_headers, h
route do |r|
+ r.halt response.finish_with_body([])
end
end
req[1].should == h
req[1].should_not equal(h)
@@ -20,29 +21,29 @@
app(:bare) do
plugin :default_headers, h
plugin :default_headers
route do |r|
+ r.halt response.finish_with_body([])
end
end
req[1].should == h
end
it "should allow modifying the default headers at a later point" do
- h = {'Content-Type'=>'text/json', 'Foo'=>'bar'}
-
app(:bare) do
plugin :default_headers
default_headers['Content-Type'] = 'text/json'
- default_headers['Foo'] = 'bar'
+ default_headers['Foo'] = 'baz'
route do |r|
+ r.halt response.finish_with_body([])
end
end
- req[1].should == h
+ req[1].should == {'Content-Type'=>'text/json', 'Foo'=>'baz'}
end
it "should work correctly in subclasses" do
h = {'Content-Type'=>'text/json', 'Foo'=>'bar'}
@@ -50,14 +51,14 @@
plugin :default_headers
default_headers['Content-Type'] = 'text/json'
default_headers['Foo'] = 'bar'
route do |r|
+ r.halt response.finish_with_body([])
end
end
@app = Class.new(@app)
- @app.route{}
req[1].should == h
end
end