features/step_definitions/steps.rb in hoc-0.7.1 vs features/step_definitions/steps.rb in hoc-0.7.2

- old
+ new

@@ -1,9 +1,9 @@ # encoding: utf-8 # -# Copyright (c) 2014 Teamed.io -# Copyright (c) 2014 Yegor Bugayenko +# Copyright (c) 2014-2017 Teamed.io +# Copyright (c) 2014-2017 Yegor Bugayenko # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the 'Software'), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -49,26 +49,26 @@ Given(/^I run bash:$/) do |script| FileUtils.copy_entry(@cwd, File.join(@dir, 'hoc')) cmd = script.split("\n").join(' && ') @stdout = `#{cmd}` @exitstatus = $CHILD_STATUS.exitstatus - fail 'non-zero exit code' unless @exitstatus == 0 + raise 'non-zero exit code' unless @exitstatus == 0 end -When(/^I run bin\/hoc with "([^"]*)"$/) do |arg| +When(%r{^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\n--------\n#{@stdout}\n--------\n" + raise "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 + raise "Non-zero exit code #{@exitstatus}" unless @exitstatus == 0 end Given(/^I have a "([^"]*)" file with content:$/) do |file, text| FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(file) File.open(file, 'w') do |f|