features/step_definitions/steps.rb in jekyll-chatgpt-translate-0.0.17 vs features/step_definitions/steps.rb in jekyll-chatgpt-translate-0.0.18
- old
+ new
@@ -38,11 +38,11 @@
Given(/^I have a "([^"]*)" file with content:$/) do |file, text|
FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(file)
File.write(file, text.gsub('\\xFF', 0xFF.chr))
end
-When(/^I build Jekyll site$/) do
+When('I build Jekyll site') do
@stdout = `jekyll build`
@exitstatus = $CHILD_STATUS.exitstatus
end
Then('Stdout contains {string}') do |string|
@@ -57,32 +57,28 @@
raise "The file \"#{string}\" is absent" unless File.exist?(string)
content = File.read(string)
raise "The file \"#{string}\" doesn't contain \"#{string2}\":\n#{content}" unless content.include?(string2)
end
-Then(/^Stdout is empty$/) do
- raise "STDOUT is not empty:\n#{@stdout}" unless @stdout == ''
-end
-
-Then(/^Exit code is zero$/) do
+Then('Exit code is zero') do
raise "Non-zero exit #{@exitstatus}:\n#{@stdout}" unless @exitstatus.zero?
end
-Then(/^Exit code is not zero$/) do
+Then('Exit code is not zero') do
raise 'Zero exit code' if @exitstatus.zero?
end
-When(/^I run bash with "([^"]*)"$/) do |text|
- @stdout = `#{text}`
+When('I run bash with {string}') do |string|
+ @stdout = `#{string}`
@exitstatus = $CHILD_STATUS.exitstatus
end
When(/^I run bash with:$/) do |text|
@stdout = `#{text}`
@exitstatus = $CHILD_STATUS.exitstatus
end
-When(/^I copy this gem into temp dir$/) do
+When('I copy this gem into temp dir') do
FileUtils.copy_entry(@cwd, File.join(@dir, 'jekyll-chatgpt-translate'))
end
Given('It is Unix') do
pending if Gem.win_platform?