Sha256: b3920bd2dcb26748ae4ccc5545c1273fae5f10a0eb8d13f97ecde9285230f4d5

Contents?: true

Size: 883 Bytes

Versions: 1

Compression:

Stored size: 883 Bytes

Contents

module ExampleHelper
  def passed_example
    base_example { expect(true).to be true }
  end

  def failed_example
    example = base_example { expect(true).to be false }
    example.exception.backtrace.push ':in step:0 `'
    example
  end

  def pending_example
    example = base_example { pending('Pending') }
    example.execution_result[:pending_message] = 'No such step(0): '
    example
  end

  private

    def base_example(&assertion)
      group = ::RSpec::Core::ExampleGroup.describe('Feature').describe('Scenario')
      example = group.example('example', example_metadata, &assertion)
      group.run(NoopObject.new)
      example
    end

    def example_metadata
      {
        turnip_formatter: {
          steps: [ { name: 'Step 1', extra_args: [], keyword: 'When' } ],
          tags: []
        },
        file_path: '/path/to/hoge.feature'
      }
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
turnip_formatter-0.3.0 spec/support/example_helper.rb