@@ -7,7 +7,8 @@ test_name 'use the init subcommand' do
 
   step 'ensure beaker init writes YAML configuration files to disk' do
     delete_root_folder_contents
-    on(default, 'beaker init')
+    result = on(default, 'beaker init --hosts centos6-64')
+    assert_match(/Trying as beaker-hostgenerator input/, result.stdout)
     subcommand_options = on(default, "cat #{SubcommandUtil::SUBCOMMAND_OPTIONS}").stdout
     subcommand_state = on(default, "cat #{SubcommandUtil::SUBCOMMAND_STATE}").stdout
     assert(YAML.parse(subcommand_options).to_ruby.class == Hash)
test_name 'use the init subcommand' do

  SubcommandUtil = Beaker::Subcommands::SubcommandUtil
  def delete_root_folder_contents
    on default, 'rm -rf /root/* /root/.beaker'
  end

  step 'ensure beaker init writes YAML configuration files to disk' do
    delete_root_folder_contents
    on(default, 'beaker init')
    subcommand_options = on(default, "cat #{SubcommandUtil::SUBCOMMAND_OPTIONS}").stdout
    subcommand_state = on(default, "cat #{SubcommandUtil::SUBCOMMAND_STATE}").stdout
    assert(YAML.parse(subcommand_options).to_ruby.class == Hash)
    assert(YAML.parse(subcommand_state).to_ruby.class == Hash)
  end

  step 'ensure beaker init saves beaker-run arguments to the subcommand_options.yaml' do
    delete_root_folder_contents
    on(default, 'beaker init --log-level verbose')
    subcommand_options = on(default, "cat #{SubcommandUtil::SUBCOMMAND_OPTIONS}").stdout
    hash = YAML.parse(subcommand_options).to_ruby
    assert_equal('verbose', hash['log_level'])
  end
end

I'm not clear why this assert is here; it seems to be testing that beaker is trying input as a hostgenerator string, but that is not what this step is trying to test; it's ensuring that YAML files are outputted to disk on the SUT. It seems like this assert is testing the implementation not pertinent to subcommand. A better test might be to read in the subcommand_options and ensure that the HOSTS object has a single element in the array.