[rspec-users] RSpec newbie ran rspec 2.4 on WinXP, got HOME undefined

Luis Lavena luislavena at gmail.com
Tue Jan 11 06:39:54 EST 2011


On Mon, Jan 10, 2011 at 6:37 PM, RichardOnRails
<RichardDummyMailbox58407 at uscomputergurus.com> wrote:
> Hi,
>
> I'm running WinXP-Pro/SP3 & Ruby 1.8.6
>
> I just got the RSpec Book and successfully ran
> gem install rspec --version 2.0.0
> per the book's suggestion.
>
> In a Command window, I ran
> K:\>rspec -v
> and got:
> K:/_Utilities/ruby186-26_rc2/ruby/lib/ruby/gems/1.8/gems/rspec-
> core-2.4.0/lib/rspec/core/configuration_options.rb:9:couldn't find
> HOME environment -- expanding `~' (ArgumentError)
>
> I ran "gem install rspec -v 2.4.0" successfully and got the same
> symptom,
> except this time the intermediate portions of the error message
> referred to
> gems/1.8/gems/rspec-core-2.4.0
>
> I checked my environment variables for HOME; it is undefined.
>
> Could it be that RSpec relies on some Ruby 1.9 functionality?

File.expand_path("~")

That could trigger the issue. expand_path on 1.8.x depends on HOME
been defined. Ruby 1.9 already workaround that properly checking for
HOMEDRIVE+HOMEPATH, USERPROFILE and HOME

You can avoid that setting HOME to HOMEDRIVE+HOMEPATH:

SET HOME=%HOMEDRIVE%%HOMEPATH%

And put that in your user environment variables.

No other workaround for tilde expansion for 1.8.x

-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry


More information about the rspec-users mailing list