From 3b66f5888f18cc9f30536708de990f9293ccd81c Mon Sep 17 00:00:00 2001 From: Will Hopper Date: Fri, 30 Sep 2016 16:32:43 -0700 Subject: [PATCH] (maint) Refactor `generate` test to use acceptance helper method --- spec/acceptance/running_strings_generate.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/spec/acceptance/running_strings_generate.rb b/spec/acceptance/running_strings_generate.rb index a8c382e..b02256e 100644 --- a/spec/acceptance/running_strings_generate.rb +++ b/spec/acceptance/running_strings_generate.rb @@ -1,16 +1,12 @@ require 'spec_helper_acceptance' +require 'util' require 'json' +include PuppetStrings::Acceptance::Util + describe 'Generating module documentation using generate action' do - def read_file_on(host, filename) - on(host, "cat #{filename}").stdout - end - before :all do - modules = JSON.parse(on(master, puppet('module', 'list', '--render-as', 'json')).stdout) - test_module_info = modules['modules_by_path'].values.flatten.find { |mod_info| mod_info =~ /Module test/ } - test_module_path = test_module_info.match(/\(([^)]*)\)/)[1] - + test_module_path = get_test_module_path(master, /Module test/) on master, puppet('strings', 'generate', "#{test_module_path}/**/*.{rb,pp}") end