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

Commit

Permalink
Added test coverage for the dependency type bug
Browse files Browse the repository at this point in the history
  • Loading branch information
raggi committed Jan 20, 2012
1 parent c2719ab commit 29d62ea
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/bundler/definition.rb
Expand Up @@ -81,6 +81,7 @@ def fixup_dependency_types!
# add_development_dependency in a gemspec that's loaded with the gemspec
# directive, the lockfile dependencies and resolved dependencies end up
# with a mismatch on #type.
# Test coverage to catch a regression on this is in gemspec_spec.rb
@dependencies.each do |d|
if ld = @locked_deps.find { |l| l.name == d.name }
ld.instance_variable_set(:@type, d.type)
Expand Down
21 changes: 21 additions & 0 deletions spec/install/gemspec_spec.rb
Expand Up @@ -110,6 +110,27 @@
should_be_installed "bar-dev 1.0.0", :groups => :dev
end

it "should match a lockfile even if the gemspec defines development dependencies" do
build_lib("foo", :path => tmp.join("foo")) do |s|
s.write("Gemfile", "source 'file://#{gem_repo1}'\ngemspec")
s.add_dependency "actionpack", "=2.3.2"
s.add_development_dependency "rake", '=0.8.7'
end

Dir.chdir(tmp.join("foo")) do
bundle "install"
# This should really be able to rely on $stderr, but, it's not written
# right, so we can't. In fact, this is a bug negation test, and so it'll
# ghost pass in future, and will only catch a regression if the message
# doesn't change. Exit codes should be used correctly (they can be more
# than just 0 and 1).
output = bundle("install --deployment")
output.should_not match(/You have added to the Gemfile/)
output.should_not match(/You have deleted from the Gemfile/)
output.should_not match(/install in deployment mode after changing/)
end
end

it "should evaluate the gemspec in its directory" do
build_lib("foo", :path => tmp.join("foo"))
File.open(tmp.join("foo/foo.gemspec"), "w") do |s|
Expand Down

0 comments on commit 29d62ea

Please sign in to comment.