Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

calling the same gem in different groups causes the gem not to be loaded in any environment #135

Closed
skippy opened this issue Feb 24, 2010 · 8 comments

Comments

@skippy
Copy link

skippy commented Feb 24, 2010

if your gem file looks like this:
source "http://gemcutter.org"

gem "rails", "2.3.5"

group :test do
  gem "factory_girl"
  #and other gems
end

%w(development staging).each do |name|
  group name do
    gem "factory_girl"
    #and other gems
  end
end

then script/console
Factory
#NameError: uninitialized constant Factory

however, if you don't duplicate the factory_girl gem call in both groups but combine it into one, it works and is loaded properly.

@skippy
Copy link
Author

skippy commented Feb 24, 2010

ah, so if you move the factory_girl out of the :test group and into the dev/staging group (and add test to it) when running under test mode factory_girl is not found/loaded up. Why wouldn't calling group multiple times on the same environment key not just append/modify the gems in the list (rather than not add them at all)?

@indirect
Copy link
Member

Sorry, I'm still sort of unclear on what exactly triggers this bug. What is a working example, and what is a not working example?

@skippy
Copy link
Author

skippy commented Feb 25, 2010

huh; I can't recreate. I'll open this up again if I can. Sorry about that Indirect

@skippy
Copy link
Author

skippy commented Feb 27, 2010

ah! I can sort of recreate it....

It has to do with the lock file. If I lock it, it sometimes creates an invalid lock file. Sometimes it creates the right one sometimes not, which makes me wonder if their is a hash being used in a place where order (say, of the keys) is expected. It feels like that sort of error.

So far, when I unlock it is fine.

Here is a gist of the Gemfile and Gemfile.lock. Notice how Gemfile.lock doesn't have factory_girl in the right buckets (it only has it in staging, not dev or test)
http://gist.github.com/317054

@skippy
Copy link
Author

skippy commented Feb 27, 2010

huh, how can I reopen this? Would suck to create a dup....

@indirect
Copy link
Member

Here is a minimal test case that reproduces reliably for me:
http://gist.github.com/317751

@midwire
Copy link

midwire commented Mar 4, 2010

FYI: I also see this problem if I simply include factory_girl in ANY group, and then rake tests. http://gist.github.com/322193

@indirect
Copy link
Member

indirect commented Mar 9, 2010

Fixed in 3685d0b.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants