Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

DslError should inherit from Bundler::Error so its exceptions are cau…

…ght by the top-level CLI
  • Loading branch information...
commit 0ae574c8dbdfb73c3e02f9d4e1c6d98e491e97df 1 parent 4030ac4
Carlhuda authored
Showing with 7 additions and 13 deletions.
  1. +3 −7 lib/bundler.rb
  2. +0 −2  lib/bundler/dsl.rb
  3. +4 −4 spec/lock/flex_spec.rb
View
10 lib/bundler.rb
@@ -28,12 +28,7 @@ module Bundler
class BundlerError < StandardError
def self.status_code(code = nil)
- return @code unless code
- @code = code
- end
-
- def status_code
- self.class.status_code
+ define_method(:status_code) { code }
end
end
@@ -45,7 +40,8 @@ class GitError < BundlerError; status_code(11) ; end
class GemspecError < BundlerError; status_code(14) ; end
class DeprecatedError < BundlerError; status_code(12) ; end
class GemspecError < BundlerError; status_code(14) ; end
- class InvalidOption < BundlerError; status_code(15) ; end
+ class DslError < BundlerError; status_code(15) ; end
+ class InvalidOption < DslError ; end
class VersionConflict < BundlerError
attr_reader :conflicts
View
2  lib/bundler/dsl.rb
@@ -1,6 +1,4 @@
module Bundler
- class DslError < StandardError; end
-
class Dsl
def self.evaluate(gemfile)
builder = new
View
8 spec/lock/flex_spec.rb
@@ -563,26 +563,26 @@ def lockfile_should_be(expected)
end
it "raises if two different versions are used" do
- install_gemfile <<-G, :expect_err => true
+ install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", "1.0"
gem "rack", "1.1"
G
bundled_app("Gemfile.lock").should_not exist
- err.should include "rack (= 1.0) and rack (= 1.1)"
+ out.should include "rack (= 1.0) and rack (= 1.1)"
end
it "raises if two different versions are used" do
- install_gemfile <<-G, :expect_err => true
+ install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
gem "rack", :git => "git://hubz.com"
G
bundled_app("Gemfile.lock").should_not exist
- err.should include "rack (>= 0) should come from an unspecfied source and git://hubz.com (at master)"
+ out.should include "rack (>= 0) should come from an unspecfied source and git://hubz.com (at master)"
end
it "works correctly with multiple version dependencies" do
Please sign in to comment.
Something went wrong with that request. Please try again.