spec/aitch/request_spec.rb in aitch-0.1.3 vs spec/aitch/request_spec.rb in aitch-0.1.4
- old
+ new
@@ -90,9 +90,14 @@
it "sets custom headers" do
request = build_request(headers: {"HEADER" => "VALUE"}).request
expect(request["HEADER"]).to eql("VALUE")
end
+ it "executes headers with callable protocol" do
+ request = build_request(headers: {"HEADER" => -> { "VALUE" }}).request
+ expect(request["HEADER"]).to eql("VALUE")
+ end
+
it "sets basic auth credentials" do
request = build_request(options: {user: "USER", password: "PASS"}).request
credentials = Base64.decode64(request["Authorization"].gsub(/Basic /, ""))
expect(credentials).to eql("USER:PASS")