Skip to content

Commit

Permalink
Add some tests to envs in binder
Browse files Browse the repository at this point in the history
  • Loading branch information
nateberkopec committed Mar 7, 2020
1 parent 2cef8dd commit 8001792
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puma/binder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def initialize(events)
@ios = []
end

attr_reader :ios, :listeners, :unix_paths
attr_reader :ios, :listeners, :unix_paths, :proto_env, :envs

def env(sock)
@envs.fetch(sock, @proto_env)
Expand Down
18 changes: 18 additions & 0 deletions test/test_binder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,24 @@ def test_binder_parses_tlsv1_1_enabled
refute ssl_context_for_binder.no_tlsv1_1
end

def test_env_contains_protoenv
@binder.parse ["ssl://localhost:0?#{ssl_query}"], @events

env_hash = @binder.envs[@binder.ios.first]

@binder.proto_env.each do |k,v|
assert_equal env_hash[k], v
end
end

def test_env_contains_stderr
@binder.parse ["ssl://localhost:0?#{ssl_query}"], @events

env_hash = @binder.envs[@binder.ios.first]

assert_equal @events.stderr, env_hash["rack.errors"]
end

private

def assert_parsing_logs_uri(order = [:unix, :tcp])
Expand Down

0 comments on commit 8001792

Please sign in to comment.