module TestConstruct::RSpecIntegration

Public Instance Methods

test_construct_default_options() click to toggle source
# File lib/test_construct/rspec_integration.rb, line 25
def test_construct_default_options
  {
    base_dir:       TestConstruct.tmpdir,
    chdir:          true,
    keep_on_error:  true,
  }
end
test_construct_enabled?(example) click to toggle source
# File lib/test_construct/rspec_integration.rb, line 21
def test_construct_enabled?(example)
  !!example.metadata[:test_construct]
end
test_construct_options(example) click to toggle source

the :test_construct metadata key can be either:

  • true (for all defaults)

  • a Hash of options

  • false/missing (disable the construct for this test)

# File lib/test_construct/rspec_integration.rb, line 11
def test_construct_options(example)
  options = test_construct_default_options
  options[:name] = example.full_description
  metadata_options = example.metadata[:test_construct]
  if metadata_options.is_a?(Hash)
    options.merge!(metadata_options)
  end
  options
end