9e909d5be3
Update Bundler to 1.0.15. Update Rails to 2.3.12. Update rails_xss plugin. The latter two were the source of a considerable amount of grief, as rails_xss is now MUCH stricter about what string methods can be used. Also made it possible to use rake 0.9.x with Instiki. But you probably REALLY want to use ruby bundle exec rake ... instead of just saying rake ....
109 lines
3.3 KiB
Ruby
109 lines
3.3 KiB
Ruby
require "spec_helper"
|
|
|
|
describe "bundle install from an existing gemspec" do
|
|
|
|
before(:each) do
|
|
build_gem "bar", :to_system => true
|
|
build_gem "bar-dev", :to_system => true
|
|
end
|
|
|
|
it "should install runtime and development dependencies" do
|
|
build_lib("foo", :path => tmp.join("foo")) do |s|
|
|
s.write("Gemfile", "source :rubygems\ngemspec")
|
|
s.add_dependency "bar", "=1.0.0"
|
|
s.add_development_dependency "bar-dev", '=1.0.0'
|
|
end
|
|
install_gemfile <<-G
|
|
source "file://#{gem_repo2}"
|
|
gemspec :path => '#{tmp.join("foo")}'
|
|
G
|
|
|
|
should_be_installed "bar 1.0.0"
|
|
should_be_installed "bar-dev 1.0.0", :groups => :development
|
|
end
|
|
|
|
it "should handle a list of requirements" do
|
|
build_gem "baz", "1.0", :to_system => true
|
|
build_gem "baz", "1.1", :to_system => true
|
|
|
|
build_lib("foo", :path => tmp.join("foo")) do |s|
|
|
s.write("Gemfile", "source :rubygems\ngemspec")
|
|
s.add_dependency "baz", ">= 1.0", "< 1.1"
|
|
end
|
|
install_gemfile <<-G
|
|
source "file://#{gem_repo2}"
|
|
gemspec :path => '#{tmp.join("foo")}'
|
|
G
|
|
|
|
should_be_installed "baz 1.0"
|
|
end
|
|
|
|
it "should raise if there are no gemspecs available" do
|
|
build_lib("foo", :path => tmp.join("foo"), :gemspec => false)
|
|
|
|
error = install_gemfile(<<-G, :expect_err => true)
|
|
source "file://#{gem_repo2}"
|
|
gemspec :path => '#{tmp.join("foo")}'
|
|
G
|
|
error.should match(/There are no gemspecs at #{tmp.join('foo')}/)
|
|
end
|
|
|
|
it "should raise if there are too many gemspecs available" do
|
|
build_lib("foo", :path => tmp.join("foo")) do |s|
|
|
s.write("foo2.gemspec", "")
|
|
end
|
|
|
|
error = install_gemfile(<<-G, :expect_err => true)
|
|
source "file://#{gem_repo2}"
|
|
gemspec :path => '#{tmp.join("foo")}'
|
|
G
|
|
error.should match(/There are multiple gemspecs at #{tmp.join('foo')}/)
|
|
end
|
|
|
|
it "should pick a specific gemspec" do
|
|
build_lib("foo", :path => tmp.join("foo")) do |s|
|
|
s.write("foo2.gemspec", "")
|
|
s.add_dependency "bar", "=1.0.0"
|
|
s.add_development_dependency "bar-dev", '=1.0.0'
|
|
end
|
|
|
|
install_gemfile(<<-G, :expect_err => true)
|
|
source "file://#{gem_repo2}"
|
|
gemspec :path => '#{tmp.join("foo")}', :name => 'foo'
|
|
G
|
|
|
|
should_be_installed "bar 1.0.0"
|
|
should_be_installed "bar-dev 1.0.0", :groups => :development
|
|
end
|
|
|
|
it "should use a specific group for development dependencies" do
|
|
build_lib("foo", :path => tmp.join("foo")) do |s|
|
|
s.write("foo2.gemspec", "")
|
|
s.add_dependency "bar", "=1.0.0"
|
|
s.add_development_dependency "bar-dev", '=1.0.0'
|
|
end
|
|
|
|
install_gemfile(<<-G, :expect_err => true)
|
|
source "file://#{gem_repo2}"
|
|
gemspec :path => '#{tmp.join("foo")}', :name => 'foo', :development_group => :dev
|
|
G
|
|
|
|
should_be_installed "bar 1.0.0"
|
|
should_not_be_installed "bar-dev 1.0.0", :groups => :development
|
|
should_be_installed "bar-dev 1.0.0", :groups => :dev
|
|
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|
|
|
s.write "raise 'ahh' unless Dir.pwd == '#{tmp.join("foo")}'"
|
|
end
|
|
|
|
install_gemfile <<-G, :expect_err => true
|
|
gemspec :path => '#{tmp.join("foo")}'
|
|
G
|
|
@err.should_not match(/ahh/)
|
|
end
|
|
|
|
end
|