Forum: RSpec Re: config.gem/rspec-rails/rspec bug (#577)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
David C. (Guest)
on 2008-10-21 23:13
(Received via mailing list)
Hey all,

Just a heads up about a bug related to configuring the rspec gems in
your rails 2.1.1 projects:

  http://rspec.lighthouseapp.com/projects/5645-rspec...

Apparently, if you config.gem both rspec and rspec-rails 1.1.9 w/
rspec first, you'll get an error:

# DON'T DO THIS:
config.gem 'rspec', :lib => 'spec', :version => '1.1.9'
config.gem 'rspec-rails', :lib => 'spec/rails', :version => '1.1.9'

The workaround is to either reverse these lines:

# OK
config.gem 'rspec-rails', :lib => 'spec/rails', :version => '1.1.9'
config.gem 'rspec', :lib => 'spec', :version => '1.1.9'

or just require rspec-rails if you're using rubygems >= 1.2 (since
installing rspec-rails will, by default, install rspec)

# OK
config.gem 'rspec-rails', :lib => 'spec/rails', :version => '1.1.9'

Keep your eye on the ticket
(http://rspec.lighthouseapp.com/projects/5645-rspec...) to
see when this is resolved.

Cheers,
David
Matt W. (Guest)
on 2008-10-22 11:52
(Received via mailing list)
On 21 Oct 2008, at 19:51, David C. wrote:

> Hey all,
>
> Just a heads up about a bug related to configuring the rspec gems in
> your rails 2.1.1 projects:

I had a little crack at this, but I got scared off as there seems to
be some chicken-and-egg stuff going on. My rake tasks require rspec,
but if rspec gem isn't installed yet, the rake environment won't load
and I can't run rake gems:install.

Am I doing something dumb?
Luis L. (Guest)
on 2008-10-22 14:00
(Received via mailing list)
On Wed, Oct 22, 2008 at 4:48 AM, Matt W. <removed_email_address@domain.invalid> 
wrote:
> rake gems:install.
>
> Am I doing something dumb?

Did you updated the generate rake tasks?

Since you're using the gem based one, require 'rubygems' before
require 'spec' should work.

I was bitten several time by RubyGems dependencies that I just try to
avoid them, the more explicit you are, the better :-D

--
Luis L.
AREA 17
-
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams
Matt W. (Guest)
on 2008-10-22 14:27
(Received via mailing list)
On 22 Oct 2008, at 10:58, Luis L. wrote:
>> to be some
>> chicken-and-egg stuff going on. My rake tasks require rspec, but if
>> rspec
>> gem isn't installed yet, the rake environment won't load and I
>> can't run
>> rake gems:install.
>>
>> Am I doing something dumb?
>
> Did you updated the generate rake tasks?

As in script/generate rspec? I think so. Is there some update to the
file dropped into lib/tasks/rspec.rake that fixes this?

> Since you're using the gem based one, require 'rubygems' before
> require 'spec' should work.

But if I'm on a machine that doesn't have the gems installed (e.g. the
production server)...? What then? We have the gem frozen into vendor
gems, but that doesn't seem to be enough...
This topic is locked and can not be replied to.