Top Level Namespace
Defined Under Namespace
Modules: Bigcommerce
Instance Method Summary collapse
-
#create_a_lightstep_span ⇒ Object
Usage: expect { my_code_here }.to create_a_lightstep_span(name: ‘my-span-name’, tags: { tag_one: ‘value-here’ }).
Instance Method Details
#create_a_lightstep_span ⇒ Object
Usage:
expect { my_code_here }.to create_a_lightstep_span(name: 'my-span-name', tags: { tag_one: 'value-here' })
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/bigcommerce/lightstep/rspec.rb', line 31 BC_LIGHTSTEP_RSPEC_NAMESPACE::Matchers.define :create_a_lightstep_span do |opts| match(notify_expectation_failures: true) do |proc| span_name = opts.fetch(:name) lightstep_span = ::LightStep::Span.new( tracer: ::Bigcommerce::Lightstep::Tracer.instance, operation_name: span_name, max_log_records: 0, start_micros: 0 ) expect(::Bigcommerce::Lightstep::Tracer.instance).to receive(:start_span).with(span_name).and_yield(lightstep_span).ordered opts.fetch(:tags, {}).each do |key, value| expect(lightstep_span).to receive(:set_tag).with(key.to_s, value) end proc.call end supports_block_expectations end |