horza 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05dd9c81a7128460e1e4e68fc2a7214e1f8b28eb
4
- data.tar.gz: 878cfc3f40041b1e01bf468665a0713d938a065c
3
+ metadata.gz: d8d3fdf41a58ccb7369f0b8e09d3acce48153a18
4
+ data.tar.gz: 9f72bd021854a66312edb840906caf879a4fc146
5
5
  SHA512:
6
- metadata.gz: daf5afc2b94e15a5942eae34bf9fb2b2eda269d72af382142d3c6b824b2f2984aa2c1f3d7bd82de616341467ead3b0224b601dec9503cff756bb96cd0ea8d291
7
- data.tar.gz: 2169c668e3d96fff261200af72127bcd9b145e6490c169bf8542a1b8a97b06a08918f1f53aae560c383380acaa69b468e8a33c7b5bbf5ee1878ee3be8987235e
6
+ metadata.gz: 67c1fadfe7ee3c049e250186f635738534b8e7390ca4729582dc08d796a1f7e615b15d2c850c1a1eaecf7bd7a17703cd22dbb82a12bf2d976bfb40efeeda6fef
7
+ data.tar.gz: abfb49f9870eb1e49b0289cc9fa66aa3fcf364ffc2c48f09dc1cfef316008eefb9856c84779ef35ce7a8bd1c084eedc82f68406f1ad826dc6a9852db452effa1
@@ -41,7 +41,7 @@ module Horza
41
41
  def run_and_convert_exceptions(&block)
42
42
  block.call
43
43
  rescue *self.class.expected_errors => e
44
- raise self.class.horza_error_from_orm_error(e.class)
44
+ raise self.class.horza_error_from_orm_error(e.class).new(e.message)
45
45
  end
46
46
 
47
47
  def entity_class(res = @context)
@@ -8,6 +8,14 @@ module Horza
8
8
  def initialize(attributes)
9
9
  update(attributes)
10
10
  end
11
+
12
+ # Some libraries (ie. ActiveModel serializer) use their own methods to access attributes
13
+ # These are aliased to the generic_getter
14
+ def generic_getter(name)
15
+ send(name)
16
+ end
17
+
18
+ alias_method :read_attribute_for_serialization, :generic_getter
11
19
  end
12
20
  end
13
21
  end
@@ -33,18 +33,37 @@ describe Horza do
33
33
  end
34
34
 
35
35
  context 'when namespaces are configured' do
36
+ module HorzaNamespace
37
+ end
38
+
36
39
  before do
37
40
  Horza.reset
38
- Horza.configure { |config| config.namespaces = [HorzaSpec] }
41
+ Horza.configure { |config| config.namespaces = [HorzaNamespace] }
39
42
  end
40
43
  after { Horza.reset }
41
44
  it 'returns configured namespaces class' do
42
- expect(Horza.configuration.namespaces).to eq [HorzaSpec]
45
+ expect(Horza.configuration.namespaces).to eq [HorzaNamespace]
43
46
  end
44
47
  end
45
48
  end
46
49
  end
47
50
 
51
+ describe Horza::Entities::Single do
52
+ subject { Horza::Entities::Single.new(first_name: 'Blake') }
53
+
54
+ describe '#generic_getter' do
55
+ it 'returns the value of the requested attributes' do
56
+ expect(subject.generic_getter(:first_name)).to eq 'Blake'
57
+ end
58
+ end
59
+
60
+ describe '#read_attribute_for_serialization' do
61
+ it 'returns the value of the requested attributes' do
62
+ expect(subject.read_attribute_for_serialization(:first_name)).to eq 'Blake'
63
+ end
64
+ end
65
+ end
66
+
48
67
  describe Horza::Adapters::Options do
49
68
  subject { Horza::Adapters::Options.new(options) }
50
69
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: horza
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Turner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-29 00:00:00.000000000 Z
11
+ date: 2015-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie