features/steps/cli.rb in newgem-1.0.6 vs features/steps/cli.rb in newgem-1.0.7

- old
+ new

@@ -30,30 +30,43 @@ config_path = File.join('config', 'website.yml') File.open(config_path, "w") { |io| io << config_yml } end end +def newgem_cmd + File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem") +end + When %r{^newgem is executed for project '(.*)' with no options$} do |project_name| - newgem = File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem") + @newgem_cmd = newgem_cmd setup_active_project_folder project_name FileUtils.chdir @tmp_root do @stdout = "newgem.out" - system "ruby #{newgem} #{project_name} > #{@stdout}" + system "ruby #{@newgem_cmd} #{project_name} > #{@stdout}" force_local_lib_override end end When %r{^newgem is executed for project '(.*)' with options '(.*)'$} do |project_name, arguments| - newgem = File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem") + @newgem_cmd = newgem_cmd setup_active_project_folder project_name FileUtils.chdir @tmp_root do @stdout = "newgem.out" - system "ruby #{newgem} #{arguments} #{project_name} > #{@stdout}" + system "ruby #{@newgem_cmd} #{arguments} #{project_name} > #{@stdout}" force_local_lib_override end end +When /^newgem is executed only with options '(.*)'$/ do |arguments| + @newgem_cmd = newgem_cmd + FileUtils.chdir @tmp_root do + @stdout = "newgem.out" + system "ruby #{@newgem_cmd} #{arguments} > #{@stdout}" + end +end + + When /^run unit tests for test file '(.*)'$/ do |test_file| @stdout = File.expand_path(File.join(@tmp_root, "tests.out")) FileUtils.chdir(@active_project_folder) do system "ruby #{test_file} > #{@stdout}" end @@ -67,6 +80,11 @@ Then %r{^remote file '(.*)' (is|is not) created} do |file, is| FileUtils.chdir @remote_folder do File.exists?(file).should(is == 'is' ? be_true : be_false) end +end + +Then /^shows version number$/ do + stdout = File.read(File.join(@tmp_root, @stdout)) + stdout.should =~ /#{Newgem::VERSION}/ end