lib/pdk/cli/new/test.rb in pdk-1.15.0 vs lib/pdk/cli/new/test.rb in pdk-1.16.0

- old
+ new

@@ -16,11 +16,10 @@ message: _('Tests can only be created from inside a valid module directory.'), log_level: :info, ) object_name = args[0] - module_dir = Dir.pwd if object_name.nil? || object_name.empty? puts command.help exit 1 end @@ -39,10 +38,10 @@ begin generator, obj = PDK::Util::PuppetStrings.find_object(object_name) PDK::CLI::Util.analytics_screen_view('new_test', opts) - generator.new(module_dir, obj['name'], opts.merge(spec_only: true)).run + generator.new(PDK::Util.module_root, obj['name'], opts.merge(spec_only: true)).run rescue PDK::Util::PuppetStrings::NoObjectError raise PDK::CLI::ExitWithError, _('Unable to find anything called "%{object}" to generate unit tests for.') % { object: object_name } rescue PDK::Util::PuppetStrings::NoGeneratorError => e raise PDK::CLI::ExitWithError, _('PDK does not support generating unit tests for "%{object_type}" objects.') % { object_type: e.message } end