diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/dsl_spec.rb | 13 | ||||
-rw-r--r-- | spec/install/gemfile/path_spec.rb | 23 | ||||
-rw-r--r-- | spec/support/builders.rb | 8 |
3 files changed, 28 insertions, 16 deletions
diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb index ca97d0c6..bb6388eb 100644 --- a/spec/bundler/dsl_spec.rb +++ b/spec/bundler/dsl_spec.rb @@ -188,17 +188,4 @@ describe Bundler::Dsl do end end - describe "#gemspec" do - it "errors on invalid specs" do - File.open(bundled_app("foo.gemspec"), "w") do |f| - f.write <<-G - Gem::Specification.new do |s| - s.name = "foo" - end - G - end - expect(Bundler).to receive(:default_gemfile).and_return(bundled_app("Gemfile")) - expect { subject.gemspec }.to raise_error(Bundler::InvalidOption).with_message(/missing value for attribute version/) - end - end end diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb index 6ba40964..d754674e 100644 --- a/spec/install/gemfile/path_spec.rb +++ b/spec/install/gemfile/path_spec.rb @@ -126,6 +126,8 @@ describe "bundle install with explicit source paths" do Gem::Specification.new do |s| s.name = 'premailer' s.version = '1.0.0' + s.summary = 'Hi' + s.authors = 'Me' end G end @@ -139,6 +141,26 @@ describe "bundle install with explicit source paths" do should_be_installed "premailer 1.0.0" end + it "errors on invalid specs" do + build_lib "foo" + + gemspec = lib_path("foo-1.0").join("foo.gemspec").to_s + File.open(gemspec, "w") do |f| + f.write <<-G + Gem::Specification.new do |s| + s.name = "foo" + end + G + end + + install_gemfile <<-G, :expect_err => true + gem "foo", :path => "#{lib_path("foo-1.0")}" + G + + expect(out).to match(/missing value for attribute version/) + should_not_be_installed("foo 1.0") + end + it "supports gemspec syntax" do build_lib "foo", "1.0", :path => lib_path("foo") do |s| s.add_dependency "rack", "1.0" @@ -249,6 +271,7 @@ describe "bundle install with explicit source paths" do path "#{lib_path('foo-1.0')}" gem 'foo' G + should_be_installed "foo 1.0" bundle "exec foobar" expect(out).to eq("1.0") diff --git a/spec/support/builders.rb b/spec/support/builders.rb index 1a1c9167..4dbcb298 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -456,10 +456,12 @@ module Spec end def executables=(val) - Array(val).each do |file| - write "#{@spec.bindir}/#{file}", "require '#{@name}' ; puts #{@name.upcase}" - end @spec.executables = Array(val) + @spec.executables.each do |file| + executable = "#{@spec.bindir}/#{file}" + @spec.files << executable + write executable, "require '#{@name}' ; puts #{@name.upcase}" + end end def add_c_extension |