Module: Cyperful

Defined in:
lib/cyperful.rb

Defined Under Namespace

Modules: SystemTestHelper Classes: AbstractCommand, ExitCommand, ResetCommand, SystemSteps, TestParser, UiServer

Class Method Summary collapse

Class Method Details

.add_step_at_methods(*mods_or_methods) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/cyperful.rb', line 35

def self.add_step_at_methods(*mods_or_methods)
  mods_or_methods.each do |mod_or_method|
    case mod_or_method
    when Module
      @step_at_methods +=
        mod_or_method.methods(false) + mod_or_method.instance_methods(false)
    when String, Symbol
      @step_at_methods << mod_or_method.to_sym
    else
      raise "Expected Module or Array of strings/symbols, got #{mod_or_method.class}"
    end
  end
end

.currentObject



7
8
9
# File 'lib/cyperful.rb', line 7

def self.current
  @current
end

.setup(test_class, test_name) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cyperful.rb', line 10

def self.setup(test_class, test_name)
  puts "Setting up Cyperful for: #{test_class}##{test_name}"

  # must set `Cyperful.current` before calling `async_setup`
  @current ||= Cyperful::SystemSteps.new
  @current.set_current_test(test_class, test_name)

  nil
rescue => err
  unless err.is_a?(Cyperful::AbstractCommand)
    warn "Error setting up Cyperful:\n\n#{err.message}\n#{err.backtrace.slice(0, 4).join("\n")}\n"
  end

  raise err
end

.step_at_methodsObject



32
33
34
# File 'lib/cyperful.rb', line 32

def self.step_at_methods
  @step_at_methods
end

.teardown(error = nil) ⇒ Object



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

def self.teardown(error = nil)
  @current&.teardown(error)
end