Skip to content

Commit

Permalink
component test
Browse files Browse the repository at this point in the history
  • Loading branch information
p committed May 10, 2024
1 parent f57c016 commit 5a38dac
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/datadog/debugger/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module Debugger
class Component
class << self
def build(settings)
return unless settings.respond_to?(:debugger) && settings.debugger.enabled

new
end
end
Expand Down
29 changes: 29 additions & 0 deletions spec/datadog/debugger/component_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require 'datadog/debugger/component'

RSpec.describe Datadog::Debugger::Component do
describe '.build' do
let(:settings) do
settings = Datadog::Core::Configuration::Settings.new
settings.debugger.enabled = debugger_enabled
settings
end

context 'when debugger is enabled' do
let(:debugger_enabled) { true }

it 'returns a Datadog::Debugger::Component instance' do
component = described_class.build(settings)
expect(component).to be_a(described_class)
end
end

context 'when debugger is disabled' do
let(:debugger_enabled) { false }

it 'returns nil' do
component = described_class.build(settings)
expect(component).to be nil
end
end
end
end

0 comments on commit 5a38dac

Please sign in to comment.