Sha256: 75644f5108429f3fed11af69b91eb0cf455cbceed2d6cb44f8ac02270f747923

Contents?: true

Size: 785 Bytes

Versions: 2

Compression:

Stored size: 785 Bytes

Contents

require 'omnitest'

Omnitest.validate 'Hello world validator', suite: 'Katas', scenario: 'hello world' do |scenario|
  expect(scenario.result.stdout.strip).to match 'Hello, world!'
end

Omnitest.validate 'Quine output matches source code', suite: 'Katas', scenario: 'quine' do |scenario|
  code = scenario.source
  output = scenario.result.stdout
  [code, output].each do | str |
    # Standardize newlines...
    str.gsub!(/[\r\n]+/, "\n")
  end
  expect(output).to eq(code)
end

Omnitest.validate 'default validator' do |scenario|
  expect(scenario.result.exitstatus).to eq(0)
  stderr = scenario.result.stderr
  stderr.gsub!(/DL is deprecated, please use Fiddle[\r\n]+/, '') # Known windows warning
  expect(stderr).to be_empty
  expect(scenario.result.stdout).to end_with(/$/)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omnitest-0.2.2 samples/tests/omnitest/validators.rb
omnitest-0.2.1 samples/tests/omnitest/validators.rb