Class: Polytrix::Configuration

Inherits:
ManifestSection show all
Defined in:
lib/polytrix/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Dash

#initialize

Constructor Details

This class inherits a constructor from Polytrix::Dash

Instance Attribute Details

#default_validator_callbackObject

The callback used to validate code samples that don’t have a custom validator. The default checks that the sample code runs successfully.



44
45
46
47
48
# File 'lib/polytrix/configuration.rb', line 44

def default_validator_callback
  @default_validator_callback ||= proc do |challenge|
    expect(challenge[:result].execution_result.exitstatus).to eq(0)
  end
end

Instance Method Details

#default_loggerObject



22
23
24
# File 'lib/polytrix/configuration.rb', line 22

def default_logger
  @default_logger ||= Logger.new(stdout: $stdout, level: env_log)
end

#default_validatorObject



50
51
52
# File 'lib/polytrix/configuration.rb', line 50

def default_validator
  @default_validator ||= Validator.new('default validator', suite: //, scenario: //, &default_validator_callback)
end

#manifestObject



26
27
28
# File 'lib/polytrix/configuration.rb', line 26

def manifest
  @manifest ||= load_manifest('polytrix.yml')
end

#manifest=(manifest_data) ⇒ Object Also known as: load_manifest



30
31
32
33
34
35
36
37
# File 'lib/polytrix/configuration.rb', line 30

def manifest=(manifest_data)
  if manifest_data.is_a? Manifest
    @manifest = manifest_data
  else
    @manifest = Manifest.from_yaml manifest_data
  end
  @manifest
end

#register_spy(spy) ⇒ Object



56
57
58
# File 'lib/polytrix/configuration.rb', line 56

def register_spy(spy)
  Polytrix::Spies.register_spy(spy)
end