Class: FaaStRuby::Command::Function::Test

Inherits:
FunctionBaseCommand show all
Defined in:
lib/faastruby/cli/commands/function/test.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FunctionBaseCommand

#load_yaml

Methods inherited from BaseCommand

#has_user_logged_in?, #help, #load_credentials, #load_yaml, #say, spin, #spin, #write_file

Constructor Details

#initialize(args) ⇒ Test

Returns a new instance of Test.



7
8
9
10
11
12
# File 'lib/faastruby/cli/commands/function/test.rb', line 7

def initialize(args)
  @args = args
  load_yaml
  @function_name = @yaml_config['name']
  @test_command = @yaml_config['test_command']
end

Class Method Details

.helpObject



23
24
25
# File 'lib/faastruby/cli/commands/function/test.rb', line 23

def self.help
  'test'
end

Instance Method Details

#run(do_not_exit: false) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/faastruby/cli/commands/function/test.rb', line 14

def run(do_not_exit: false)
  unless @test_command
    # puts "[skipped tests] You have no 'test_command' key/value in 'faastruby.yml'. Please consider using rspec!".yellow
    return true
  end
  # puts "[test] Running tests"
  system(@test_command)
end

#usageObject



27
28
29
# File 'lib/faastruby/cli/commands/function/test.rb', line 27

def usage
  "\nUsage: faastruby #{self.class.help}"
end