Sha256: ce42bd74b2e4096d2caa3c9be179e4945d9bfe11aa49fa08dcd355b36f97460c

Contents?: true

Size: 496 Bytes

Versions: 36

Compression:

Stored size: 496 Bytes

Contents

require "rspec/expectations"
require "spec/support/platform_helpers"

RSpec::Matchers.define :match_environment_variable do |varname|
  match do |actual|
    expected = if windows? && ENV[varname].nil?
                 # On Windows, if an environment variable is not set, the command
                 # `echo %VARNAME%` outputs %VARNAME%
                 "%#{varname}%"
               else
                 ENV[varname].to_s
               end

    actual == expected
  end
end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
chef-13.10.4-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb
chef-14.3.37-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb
chef-13.10.0-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb
chef-13.9.4-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb
chef-14.2.0-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb
chef-14.1.12-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb
chef-14.1.1-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb
chef-13.9.1-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb
chef-14.0.190-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb
chef-13.8.5-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb
chef-13.8.3-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb
chef-12.22.1 spec/support/shared/matchers/match_environment_variable.rb
chef-12.22.1-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb
chef-13.8.0-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb
chef-12.8.1 spec/support/shared/matchers/match_environment_variable.rb
chef-12.8.1-universal-mingw32 spec/support/shared/matchers/match_environment_variable.rb