Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc committed Jul 26, 2024
1 parent aee73ed commit 8caeadc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/datadog/tracing/contrib/propagation/sql_comment/mode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ def enabled?
end

def service?
@mode == Ext::SERVICE
mode == Ext::SERVICE
end

def full?
@mode == Ext::FULL
mode == Ext::FULL
end

def prepend?
!@append
!append
end

def append?
@append
append
end
end
end
Expand Down
32 changes: 29 additions & 3 deletions spec/datadog/tracing/contrib/propagation/sql_comment/mode_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require 'datadog/tracing/contrib/propagation/sql_comment/mode'

RSpec.describe Datadog::Tracing::Contrib::Propagation::SqlComment::Mode do
let(:append) { false }

describe '#enabled?' do
[
['disabled', false],
Expand All @@ -9,7 +11,7 @@
['undefined', false]
].each do |string, result|
context "when given `#{string}`" do
subject { described_class.new(string).enabled? }
subject { described_class.new(string, append).enabled? }
it { is_expected.to be result }
end
end
Expand All @@ -23,7 +25,7 @@
['undefined', false]
].each do |string, result|
context "when given `#{string}`" do
subject { described_class.new(string).service? }
subject { described_class.new(string, append).service? }
it { is_expected.to be result }
end
end
Expand All @@ -37,7 +39,31 @@
['undefined', false]
].each do |string, result|
context "when given `#{string}`" do
subject { described_class.new(string).full? }
subject { described_class.new(string, append).full? }
it { is_expected.to be result }
end
end
end

describe '#prepend?' do
[
[false, true],
[true, false]
].each do |value, result|
context "when given `#{value}`" do
subject { described_class.new('full', value).prepend? }
it { is_expected.to be result }
end
end
end

describe '#append?' do
[
[false, false],
[true, true]
].each do |value, result|
context "when given `#{value}`" do
subject { described_class.new('full', value).append? }
it { is_expected.to be result }
end
end
Expand Down

0 comments on commit 8caeadc

Please sign in to comment.