File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
lib/rspec_api_documentation/dsl Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,11 @@ def params
59
59
parameters
60
60
end
61
61
62
+ def header ( name , value )
63
+ example . metadata [ :headers ] ||= { }
64
+ example . metadata [ :headers ] [ name ] = value
65
+ end
66
+
62
67
def headers
63
68
return unless example . metadata [ :headers ]
64
69
example . metadata [ :headers ] . inject ( { } ) do |hash , ( header , value ) |
Original file line number Diff line number Diff line change 400
400
end
401
401
end
402
402
403
+ put "/orders" do
404
+ context "setting header in example level" do
405
+ before do
406
+ header "Accept" , "application/json"
407
+ header "Content-Type" , "application/json"
408
+ end
409
+
410
+ it "adds to headers" do
411
+ headers . should == { "Accept" => "application/json" , "Content-Type" => "application/json" }
412
+ end
413
+ end
414
+ end
415
+
403
416
put "/orders" do
404
417
header "Accept" , :accept
405
418
You can’t perform that action at this time.
0 commit comments