Sha256: e0915ceebcbd9f068445d3875fbb321dfa6e9d3c5011e3a673c6755d53d42716

Contents?: true

Size: 657 Bytes

Versions: 13

Compression:

Stored size: 657 Bytes

Contents

# Common helper methods, for lots of tests
# Included into the RSpec config, so accessible inside test blocks.
module Helpers
  def examples_exist(regexp, regexp_examples)
    expect(regexp_examples)
      .not_to be_empty, "No examples were generated for regexp: /#{regexp.source}/"
  end

  def examples_match(regexp, regexp_examples)
    # Note: /\A...\z/ is used to prevent misleading examples from passing the test.
    # For example, we don't want things like:
    # /a*/.examples to include "xyz"
    # /a|b/.examples to include "bad"
    regexp_examples.each do |example|
      expect(example).to match(/\A(?:#{regexp.source})\z/)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
regexp-examples-1.5.1 spec/helpers.rb
regexp-examples-1.5.0 spec/helpers.rb
regexp-examples-1.4.4 spec/helpers.rb
regexp-examples-1.4.3 spec/helpers.rb
regexp-examples-1.4.2 spec/helpers.rb
regexp-examples-1.4.1 spec/helpers.rb
regexp-examples-1.4.0 spec/helpers.rb
regexp-examples-1.3.2 spec/helpers.rb
regexp-examples-1.3.1 spec/helpers.rb
regexp-examples-1.3.0 spec/helpers.rb
regexp-examples-1.2.1 spec/helpers.rb
regexp-examples-1.2.0 spec/helpers.rb
regexp-examples-1.1.4 spec/helpers.rb