mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-26 05:37:11 -07:00
Test for autoenv
setting
This commit is contained in:
parent
7b17fcc4b7
commit
61f1cf8efc
7 changed files with 154 additions and 12 deletions
29
test/features/step_definitions/general.rb
Normal file
29
test/features/step_definitions/general.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'fileutils'
|
||||
require 'tempfile'
|
||||
|
||||
module GeneralHelper
|
||||
end
|
||||
World GeneralHelper
|
||||
|
||||
When('we run fish script') do |script_content|
|
||||
script_file = Tempfile.new('fish_script')
|
||||
File.write(script_file, script_content)
|
||||
|
||||
out, status = Open3.capture2e("fish #{script_file.path}")
|
||||
unless status.success?
|
||||
warn(out)
|
||||
raise "Fish command failed: #{out}"
|
||||
end
|
||||
|
||||
@response_fish_script = out.strip
|
||||
end
|
||||
|
||||
Then(/^the output is$/) do |text|
|
||||
expect(@response_fish_script).to eq(text.strip)
|
||||
end
|
||||
|
||||
Then(/^file ([a-zA-Z0-9-_.\/]+) contains$/) do |file,content|
|
||||
expect(File.readlines(file).join("").strip).to eq(content.strip)
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue