features/step_definitions/steps.rb in hoc-0.6 vs features/step_definitions/steps.rb in hoc-0.7

- old
+ new

@@ -36,24 +36,34 @@ After do Dir.chdir(@cwd) FileUtils.rm_rf(@dir) if File.exist?(@dir) end -Given(/^I run bash:$/) do |bash| +Given(/^It is Unix$/) do + pending if Gem.win_platform? +end + +Given(/^It is Windows$/) do + pending unless Gem.win_platform? +end + +Given(/^I run bash:$/) do |script| FileUtils.copy_entry(@cwd, File.join(@dir, 'hoc')) - @stdout = `#{bash}` + cmd = script.split("\n").join(' && ') + @stdout = `#{cmd}` @exitstatus = $CHILD_STATUS.exitstatus + fail 'non-zero exit code' unless @exitstatus == 0 end When(/^I run bin\/hoc with "([^"]*)"$/) do |arg| home = File.join(File.dirname(__FILE__), '../..') @stdout = `ruby -I#{home}/lib #{home}/bin/hoc #{arg}` @exitstatus = $CHILD_STATUS.exitstatus end Then(/^Stdout contains "([^"]*)"$/) do |txt| unless @stdout.include?(txt) - fail "STDOUT doesn't contain '#{txt}':\n#{@stdout}" + fail "STDOUT doesn't contain '#{txt}':\n\n--------\n#{@stdout}\n--------\n" end end Then(/^Exit code is zero$/) do fail "Non-zero exit code #{@exitstatus}" unless @exitstatus == 0