Module: TestConstruct::RSpecIntegration

Defined in:
lib/test_construct/rspec_integration.rb

Class Method Summary collapse

Class Method Details

.test_construct_default_optionsObject



25
26
27
28
29
30
31
# 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) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/test_construct/rspec_integration.rb', line 21

def test_construct_enabled?(example)
  !!example.[:test_construct]
end

.test_construct_options(example) ⇒ Object

the :test_construct metadata key can be either:

  • true (for all defaults)

  • a Hash of options

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



11
12
13
14
15
16
17
18
19
# File 'lib/test_construct/rspec_integration.rb', line 11

def test_construct_options(example)
  options = test_construct_default_options
  options[:name] = example.full_description
   = example.[:test_construct]
  if .is_a?(Hash)
    options.merge!()
  end
  options
end