module Rutema::Elements::Minimal
Minimal
offers a minimal(chic) set of elements for use in specifications
These are:
echo command prompt
Public Instance Methods
element_command(step)
click to toggle source
command executes a shell command
<command cmd="useful_command.exe with parameters", working_directory="some/directory"/>
# File lib/rutema/elements/minimal.rb, line 39 def element_command step raise ParserError,"missing required attribute cmd in #{step}" unless step.has_cmd? wd=Dir.pwd wd=step.working_directory if step.has_working_directory? step.cmd=Patir::ShellCommand.new(:cmd=>step.cmd,:working_directory=>File.expand_path(wd)) return step end
element_echo(step)
click to toggle source
echo prints a message on the screen:
<echo text="A meaningful message"/> <echo>A meaningful message</echo>
# File lib/rutema/elements/minimal.rb, line 16 def element_echo step step.cmd=Patir::RubyCommand.new("echo"){|cmd| cmd.error="";cmd.output="#{step.text}";$stdout.puts(cmd.output) ;:success} return step end
element_prompt(step)
click to toggle source
prompt asks the user a yes/no question. Answering yes means the step is succesful.
<prompt text="Do you want fries with that?"/>
A prompt element automatically makes a specification “attended”
# File lib/rutema/elements/minimal.rb, line 24 def element_prompt step step.attended=true step.cmd=Patir::RubyCommand.new("prompt") do |cmd| cmd.output="" cmd.error="" if HighLine.new.agree("#{step.text}") step.output="y" else raise "n" end#if end#do rubycommand return step end