Module: WTT

Defined in:
lib/wtt.rb,
lib/wtt/core.rb,
lib/wtt/core/paths.rb,
lib/wtt/core/mapper.rb,
lib/wtt/core/tracer.rb,
lib/wtt/core/storage.rb,
lib/wtt/core/version.rb,
lib/wtt/core/selector.rb,
lib/wtt/core/meta_data.rb,
lib/wtt/core/anchor_task.rb,
lib/wtt/core/trace_service.rb,
lib/wtt/core/matchers/exact_matcher.rb,
lib/wtt/core/matchers/fuzzy_matcher.rb,
lib/wtt/core/matchers/touch_matcher.rb

Overview

Top level namespace for What to Test

Defined Under Namespace

Modules: Core Classes: Configuration

Constant Summary collapse

ENV_ACTIVE_FLAG =
'WTT_ACTIVE'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



8
9
10
# File 'lib/wtt.rb', line 8

def config
  @config
end

.trace_serviceObject

Returns the value of attribute trace_service.



8
9
10
# File 'lib/wtt.rb', line 8

def trace_service
  @trace_service
end

Class Method Details

.active=(val) ⇒ Object



17
18
19
20
# File 'lib/wtt.rb', line 17

def self.active=(val)
  ENV[ENV_ACTIVE_FLAG] = '1' if val
  ENV.delete ENV_ACTIVE_FLAG unless val
end

.active?Boolean

Returns:

  • (Boolean)


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

def self.active?
  ENV[ENV_ACTIVE_FLAG] != nil
end

.configurationObject



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

def self.configuration
  self.config ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



30
31
32
33
34
# File 'lib/wtt.rb', line 30

def self.configure
  yield(configuration) if block_given?
  configuration.matcher ||= touch_matcher
  configuration.default_reject_filters if configuration.use_default_filters
end

.exact_matcherObject



53
54
55
# File 'lib/wtt.rb', line 53

def self.exact_matcher
  Core::Matchers::Exact.new
end

.fuzzy_matcher(spread = 11) ⇒ Object



61
62
63
# File 'lib/wtt.rb', line 61

def self.fuzzy_matcher(spread = 11)
  Core::Matchers::Fuzzy.new(spread)
end

.start_serviceObject



36
37
38
39
40
41
42
43
# File 'lib/wtt.rb', line 36

def self.start_service
  port = configuration.traced_port
  if port > 0 && trace_service.nil?
    uri = "druby://localhost:#{port}"
    self.trace_service = DRb.start_service(uri, Core::TraceService.new)
  end
  trace_service
end

.stop_serviceObject



45
46
47
48
49
50
51
# File 'lib/wtt.rb', line 45

def self.stop_service
  unless trace_service.nil?
    DRb.remove_server(trace_service)
    DRb.stop_service
    self.trace_service = nil
  end
end

.touch_matcherObject



57
58
59
# File 'lib/wtt.rb', line 57

def self.touch_matcher
  Core::Matchers::Touch.new
end

.with_active_envObject



11
12
13
14
15
# File 'lib/wtt.rb', line 11

def self.with_active_env
  self.active = true
  yield
  self.active = false
end