Sha256: 47a3e3a6281b11e5e68862c2d935a418bbec94f9ab7c10dd318cd857b75704ea

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

# Test some RSpec behavior
# NOTE: This file is expected to always produce some test errors!
#       So that we can 
RSpec.describe 'RSpec behavior' do
  shared_examples_for 'correct behavior' do
    it 'passes' do
      expect(1).to be < 2
    end
  end
  
  shared_examples_for 'incorrect behavior' do
    it 'fails' do
      expect(2).to be < 1
    end
  end

  it 'passes correct assertions' do
    expect(1).to be < 2
  end

  it 'fails incorrect assertions' do
    expect(2).to be < 1
  end

  it_behaves_like 'correct behavior'
  it_behaves_like 'incorrect behavior'

  context 'context' do
    it_behaves_like 'correct behavior'
    it_behaves_like 'incorrect behavior'
  end

  context 'in a' do
    context 'deeply' do
      context 'nested' do
        context 'context' do
          it 'passes correct assertions' do
            expect(1).to be < 2
          end

          it 'fails incorrect assertions' do
            expect(2).to be < 1
          end
        end
      end
    end
  end

  context 'when calling traced code' do
    it 'wraps the RSpec instrumentation around the traced code' do
      Datadog.tracer.trace('code_under_test') do |span|
        time_to_run = rand
        sleep(rand)
        span.set_tag('run_time', time_to_run)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ddtrace-0.51.1 integration/apps/rspec/spec/rspec_spec.rb
ddtrace-0.51.0 integration/apps/rspec/spec/rspec_spec.rb
ddtrace-0.50.0 integration/apps/rspec/spec/rspec_spec.rb