Class: Stringup::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/stringup/cli.rb

Instance Method Summary collapse

Instance Method Details

#execute(path, *args) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/stringup/cli.rb', line 29

def execute(path, *args)
  script = path_to_script(path)
  scenario = script[options[:scenario]]
  unless scenario
    abort "Could not find scenario: #{options[:scenario]}"
  end
  Runner.new(script, scenario, *args).run
end

#info(path) ⇒ Object



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

def info(path)
  script = path_to_script(path)
  puts "FILE\n\n  #{path}\n\n"
  puts "COMMAND\n\n  #{script.command}\n\n"
  puts "SCENARIOS\n\n"
  script.scenarios.sort_by { |k, v| k.to_s }.each do |_, scenario|
    puts "  #{scenario.name}: #{scenario.description}"
    [:before, :after].each do |event|
      puts "    #{event.to_s.upcase}"
      scenario.assertions.each do |assertion|
        puts "      should #{assertion.describe_should_at(event)}"
      end
    end
  end
end