persisto 0.1.2 → 0.1.3

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: 139bc2b58186b7a9419ee5311733f395567ded2b
4
- data.tar.gz: 25c6467395887914861a18ac6ac587a0c221ebcc
3
+ metadata.gz: 998445886e5ca1d2ae5c29fc23c9ea6b4636e524
4
+ data.tar.gz: 3cbd98bbc492a68e6dd0ed820508bebd7ea58b0f
5
5
  SHA512:
6
- metadata.gz: cc36fdc942924a22b4124b42e24281b711886f1a3c746646feb2e6669de303849b0d7722ca8524d4ff743ba53a3e06c3379e863913ac21a4b668dcca292dab8a
7
- data.tar.gz: 13986452d7502faab2aff22dead1141cba2c0b5a27354f1c19d35c38d347f9a198e39658378c81b4b2063d427f5ce6c0178befbb801809278d2102488e546bc0
6
+ metadata.gz: 4003c6a346623b384ccd8a3087a23fd9ca3de2241dcd9d06bc3f360b9b1ff504be482957050bbcab7a2bfbb452783cc2964af1b2505285321fb90f984132b490
7
+ data.tar.gz: 54f045ad4a2fa7d571261513ee8acac63f0193cd8d627996678bb72a7a353d6f53b539fd2ad52856080470cc94a34147c3fb3316ad228ff682c56c9180897f34
@@ -30,14 +30,18 @@ module Persisto
30
30
  @stores = {}
31
31
  end
32
32
 
33
- private
34
-
35
- def adaptor
36
- @adaptor
33
+ def transaction &block
34
+ adaptor.transaction &block
37
35
  end
38
36
 
37
+ private
38
+
39
39
  def store store_name
40
40
  @stores[store_name] ||= self.class.store_registry[store_name].new(adaptor, self.class.mapper.new)
41
41
  end
42
+
43
+ def adaptor
44
+ @adaptor
45
+ end
42
46
  end
43
47
  end
@@ -1,3 +1,3 @@
1
1
  module Persisto
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+ require 'persisto/adaptors/pg'
3
+
4
+ describe Persisto::Pg do
5
+ let(:database) { stub }
6
+ let(:adaptor) { Persisto::Pg.new(database) }
7
+
8
+ describe '#select' do
9
+ let(:sql){ 'sql' }
10
+ let(:query_object){ stub(:query => sql) }
11
+ let(:dataset){ stub }
12
+ let(:data){ stub }
13
+
14
+ it 'returns data array' do
15
+ database.expects(:fetch).with(sql).returns(dataset)
16
+ dataset.expects(:all).returns(data)
17
+ adaptor.select(query_object).must_equal data
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: persisto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Lott
@@ -89,6 +89,7 @@ files:
89
89
  - lib/persisto/store.rb
90
90
  - lib/persisto/version.rb
91
91
  - persisto.gemspec
92
+ - spec/adaptors/pg_spec.rb
92
93
  - spec/repository_spec.rb
93
94
  - spec/spec_helper.rb
94
95
  - spec/store_spec.rb
@@ -117,6 +118,7 @@ signing_key:
117
118
  specification_version: 4
118
119
  summary: Kodio lightweight data access layer for ruby
119
120
  test_files:
121
+ - spec/adaptors/pg_spec.rb
120
122
  - spec/repository_spec.rb
121
123
  - spec/spec_helper.rb
122
124
  - spec/store_spec.rb