Module: ReportFactory::Rspec::Configuration

Included in:
ReportFactory::Rspec
Defined in:
lib/report_factory/rspec/configuration.rb

Overview

Defines all configurable attributes of ReportFactory::RSpec

Constant Summary collapse

VALID_CONFIG_KEYS =
%i[url project_name tags auth_token].freeze
DEFAULT_URL =
'http://0.0.0.0:3000'
DEFAULT_PROJECT_NAME =
nil
DEFAULT_AUTH_TOKEN =
nil
DEFAULT_TAGS =
[].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object

Make sure the default values are set when the module is ‘extended’



20
21
22
# File 'lib/report_factory/rspec/configuration.rb', line 20

def self.extended(base)
  base.reset
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



24
25
26
# File 'lib/report_factory/rspec/configuration.rb', line 24

def configure
  yield self
end

#resetObject



28
29
30
31
32
33
# File 'lib/report_factory/rspec/configuration.rb', line 28

def reset
  VALID_CONFIG_KEYS.each do |key|
    constant_name = "DEFAULT_#{key}".upcase
    send("#{key}=", self::Configuration.const_get(constant_name))
  end
end