hybag 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDQ3ZTEwNGM0ODhmZGUzN2NjZDYxNzlmZWY1NjhmNDBhZTkzZmVmMw==
4
+ NzZkYTExZGU2NGI5YjA3MzFkNWE5YjA5ZTVkOTA4ZTgxM2U4MDY4Zg==
5
5
  data.tar.gz: !binary |-
6
- MWRiY2RlYmNlMGRiMzIxNjA0NjczMzAyMzYzMGZkMWE1NDZhYjAzNQ==
6
+ ZjM0NjU0NTc0ZGQzNWViNjc5OTQ2MjhhZGVkNjIzYmVkNDJjY2I1OQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NDZlYzMzY2YxNDlmOTUyMzg2ZDEzZTc3MmJmMzgxZmVkOTJkMTZlZDNiY2Nj
10
- ZTY4ZTIyOWY4MmI4ZjA2MDJjZTI4NjA3NDEwMTFiZTkwMjhmNzFjYjJiYjYy
11
- MzlkYmQxOWY3ZWVmYTgyZTEzNzBhMmM0ZTJiNzBlYWEyYzBlZTg=
9
+ MDgwZDYwZjEyMjY4ZTQ0ZmFjZWYyYWRlNjNiZGQwYTI1NDI5NzVjMWUxY2Nk
10
+ MDgyMmY2YWFiNDkyMzMwZDdiMmRiNzU2YjYxYTM1M2VjYzk4ZDY1NGYzNzI5
11
+ Y2MwYjM2ZTI0NTgzYTM4YTMyNDQ4NjYyOWJmZWU2NjY0NzIwMmM=
12
12
  data.tar.gz: !binary |-
13
- OGIwNDg2ZjFkY2Y3YjQ0NzY4ZDU4OWJmNTZlYTUzYzU2MjczODk1MTllZWUz
14
- ZTU0ZTlhYTI4ZWE2NTQ0NWY3NzFhMDkxNzU3YmFhNTQwNWM2OTAwZjI1NTEz
15
- NDBkNzQ1YjU5NmQ0NjgxY2Y5ZDUyMDVhNDNkMTk0YjdhZDU4M2Q=
13
+ ZDFkOWUxNTY0NzI3NjJlZjVjYjlmOGI0ZTUwYTdkMzdhN2ZkYzQzNjZlNTFj
14
+ MWFiYTY5NGRkMzNlNzIwMDE0MzEwYjdiNDFjMGM1OWZmMDhhNGU0MDQ3ZmJl
15
+ ZDdiNTMzOGQ5NWI3ZTI3MTZjYTliMWE2M2EzMjVhM2U1MmM2YmE=
@@ -12,4 +12,16 @@ module Hybag
12
12
  def self.ingest(bag)
13
13
  Hybag::Ingester.new(bag).ingest
14
14
  end
15
+
16
+ # Error Classes
17
+ class UndiscoverableModelName < StandardError
18
+ def initialize(bag)
19
+ super("Unable to determine model from bag at #{bag.bag_dir}")
20
+ end
21
+ end
22
+ class InvalidBaggable < StandardError
23
+ def initialize(object)
24
+ super("#{object} requested to be bagged, but it is invalid")
25
+ end
26
+ end
15
27
  end
@@ -8,7 +8,7 @@ module Hybag
8
8
  end
9
9
 
10
10
  def ingest
11
- raise "Unable to determine model from bag" if model_name.blank?
11
+ raise Hybag::UndiscoverableModelName.new(bag) if model_name.blank?
12
12
  new_object = model_name.constantize.new
13
13
  # Assign a pid
14
14
  new_object.inner_object.pid = new_object.inner_object.assign_pid
@@ -11,7 +11,7 @@ module Hybag
11
11
 
12
12
  def validate!
13
13
  unless self.valid?
14
- raise "Invalid Object for bagging"
14
+ raise Hybag::InvalidBaggable.new(bag)
15
15
  end
16
16
  end
17
17
 
@@ -1,3 +1,3 @@
1
1
  module Hybag
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -79,7 +79,7 @@ describe Hybag::Ingester do
79
79
  subject.stub(:model_name).and_return(nil)
80
80
  end
81
81
  it "should raise an error" do
82
- expect{subject.ingest}.to raise_error("Unable to determine model from bag")
82
+ expect{subject.ingest}.to raise_error(Hybag::UndiscoverableModelName)
83
83
  end
84
84
  end
85
85
  context "when there is a model" do
@@ -94,7 +94,7 @@ describe Hybag::Ingester do
94
94
  subject.stub(:model_name).and_return("Blabla")
95
95
  end
96
96
  it "should raise an error" do
97
- expect{subject.ingest}.to raise_error
97
+ expect{subject.ingest}.to raise_error(NameError)
98
98
  end
99
99
  end
100
100
  end
@@ -43,7 +43,7 @@ describe Hybag::Validator do
43
43
  dummy.stub(:baggable?).and_return(false)
44
44
  end
45
45
  it "should raise an error" do
46
- expect{subject.validate!}.to raise_error
46
+ expect{subject.validate!}.to raise_error(Hybag::InvalidBaggable)
47
47
  end
48
48
  end
49
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hybag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trey Terrell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-18 00:00:00.000000000 Z
11
+ date: 2013-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler