Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ def example_started(notification)

def example_finished(notification)
pop_and_finalize_span do |span|
result = notification.example.execution_result
example = notification.example
result = example.execution_result

# Update name and full_description for one-liner examples where description is generated after execution
span.name = example.description
span.set_attribute('rspec.example.full_description', example.full_description.to_s)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💁🏼 Use add_attributes as opposed to setting each attribute separately because each call requires a lock when changing a span

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch. I agree. @americodls, can you update the method call to combine the attributes on line 76 and 77 into one add_attributes call?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback. I just fixed that.

span.set_attribute('rspec.example.result', result.status.to_s)

add_exception_and_failures(span, result.exception)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,26 @@ def run_example(...)
_(subject.events[1].attributes['exception.message']).must_equal 'another-error'
end
end

describe 'one-liner syntax' do
subject do
run_example do
it { is_expected.not_to be_nil }
end
end

it 'has a name that matches the auto-generated description' do
_(subject.name).must_equal 'is expected not to be nil'
end

it 'has a full_description attribute that includes the group description' do
_(subject.attributes['rspec.example.full_description']).must_equal 'group one is expected not to be nil'
end

it 'records when the example passes' do
_(subject.attributes['rspec.example.result']).must_equal 'passed'
end
end
end

describe 'using a custom tracer provider' do
Expand Down