• Bob Van Landuyt's avatar
    Don't pass undefined context-values to Labkit · d121e73b
    Bob Van Landuyt authored
    Don't pass values on to labkit that weren't explicityly
    defined. Otherwise, labkit will unintentionally overwrite any existing
    values with nil.
    
    Consider the following example:
    
      ApplicationContext.with_context(user: <User "jane-doe">) do
        ApplicationContext.with_context(
          project: <Project "gitlab-org/gitlab">
        ) do
          # The inner context lives here
        end
      end
    
    We want the inner context for Labkit to contain this hash:
    
      {
        user: "jane-doe",
        project: "gitlab-org/gitlab",
        root_namespace: "gitlab-org"
      }
    
    But before this change, we'd overwrite the `user` value when creating
    the inner context, even though the inner context did not contain any
    information that should override the user info.
    d121e73b
application_context.rb 1.92 KB