Class: Dtf::Command::CreateVs
- Inherits:
-
Object
- Object
- Dtf::Command::CreateVs
- Defined in:
- lib/dtf.rb
Overview
This sub-command generates, adds, and associates a Verification Suite in the Testing Framework system.
Required Parameters are:
--user-name [String], --name [String]
‘–user-name’ is the user_name of the User that should own this Verification Suite. ‘–name’ is the descriptive name of the Verification Suite.
Options are:
--description [String]
This optional parameter is for providing a description of the Verification Suite’s use. e.g. –description “RSpec Verification”
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(cmd_name, options) ⇒ CreateVs
constructor
A new instance of CreateVs.
Constructor Details
#initialize(cmd_name, options) ⇒ CreateVs
Returns a new instance of CreateVs.
92 93 94 95 |
# File 'lib/dtf.rb', line 92 def initialize(cmd_name, ) @cmd_name = cmd_name @cmd_opts = end |
Instance Method Details
#execute ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/dtf.rb', line 97 def execute if [:user_name_given, :name_given].all? { |sym| @cmd_opts.key?(sym) } then user = User.find_by_user_name(@cmd_opts[:user_name]) vs = user.verification_suites.create(name: @cmd_opts[:name], description: @cmd_opts[:description]) if vs.persisted? then puts "VS named \'#{@cmd_opts[:name]}\' allocated to user \'#{@cmd_opts[:user_name]}\'" else $stderr.puts "ERROR: Failed to save Verification Suite. Check DB logfile for errors" abort() end else Dtf::ErrorSystem.raise_error(@cmd_name) end end |