Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 4bcd490

Browse files
committed
Update rake with_clean_environment spec to verify keys ignoring order
1 parent 02233cd commit 4bcd490

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spec/rspec/core/rake_task_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,14 @@ def silence_output(&block)
163163
it "removes the environment variables", :if => RUBY_VERSION >= '1.9.0', :unless => RSpec::Support::Ruby.jruby? do
164164
with_env_vars 'MY_ENV' => 'ABC' do
165165
if RSpec::Support::OS.windows?
166-
essential_shell_variables = /\["ANSICON", "ANSICON_DEF", "HOME", "TMPDIR", "USER"\]/
166+
essential_shell_variables = "[\"ANSICON\", \"ANSICON_DEF\", \"HOME\", \"TMPDIR\", \"USER\"]"
167167
else
168-
essential_shell_variables = /\["PWD"(?:, "SHLVL")?(?:, "_")?(?:, "__CF_USER_TEXT_ENCODING")?\]/
168+
essential_shell_variables = "[\"PWD\", \"SHLVL\", \"_\", \"__CF_USER_TEXT_ENCODING\"]"
169169
end
170170

171171
expect {
172172
task.with_clean_environment = true
173-
task.ruby_opts = '-e "puts \"Environment: #{ENV.keys}\""'
173+
task.ruby_opts = '-e "print ENV.keys.sort.inspect"'
174174
task.run_task false
175175
}.to avoid_outputting.to_stderr.and output(essential_shell_variables).to_stdout_from_any_process
176176
end

0 commit comments

Comments
 (0)