features/step_definitions/steps.rb in hoc-0.8.1 vs features/step_definitions/steps.rb in hoc-0.9.0

- old
+ new

@@ -1,10 +1,7 @@ -# encoding: utf-8 +# Copyright (c) 2014-2019 Yegor Bugayenko # -# Copyright (c) 2014-2018 Teamed.io -# Copyright (c) 2014-2018 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 # copies of the Software, and to permit persons to whom the Software is @@ -49,11 +46,11 @@ 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 - raise 'non-zero exit code' unless @exitstatus == 0 + raise 'non-zero exit code' unless @exitstatus.zero? end When(%r{^I run bin/hoc with "([^"]*)"$}) do |arg| home = File.join(File.dirname(__FILE__), '../..') @stdout = `ruby -I#{home}/lib #{home}/bin/hoc #{arg}` @@ -65,10 +62,10 @@ raise "STDOUT doesn't contain '#{txt}':\n\n--------\n#{@stdout}\n--------\n" end end Then(/^Exit code is zero$/) do - raise "Non-zero exit code #{@exitstatus}" unless @exitstatus == 0 + raise "Non-zero exit code #{@exitstatus}" unless @exitstatus.zero? 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|