Module: Cyperful

Defined in:
lib/cyperful.rb

Defined Under Namespace

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

Constant Summary collapse

ROOT_DIR =
File.expand_path("..", __dir__)

Class Method Summary collapse

Class Method Details

.add_step_at_methods(*mods_or_methods) ⇒ Object



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

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



9
10
11
# File 'lib/cyperful.rb', line 9

def self.current
  @current
end

.setup(test_class, test_name) ⇒ Object



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

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::Driver.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



34
35
36
# File 'lib/cyperful.rb', line 34

def self.step_at_methods
  @step_at_methods
end

.teardown(error = nil) ⇒ Object



28
29
30
# File 'lib/cyperful.rb', line 28

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