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 +4 -4
- data/lib/persisto/repository.rb +8 -4
- data/lib/persisto/version.rb +1 -1
- data/spec/adaptors/pg_spec.rb +20 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 998445886e5ca1d2ae5c29fc23c9ea6b4636e524
|
4
|
+
data.tar.gz: 3cbd98bbc492a68e6dd0ed820508bebd7ea58b0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4003c6a346623b384ccd8a3087a23fd9ca3de2241dcd9d06bc3f360b9b1ff504be482957050bbcab7a2bfbb452783cc2964af1b2505285321fb90f984132b490
|
7
|
+
data.tar.gz: 54f045ad4a2fa7d571261513ee8acac63f0193cd8d627996678bb72a7a353d6f53b539fd2ad52856080470cc94a34147c3fb3316ad228ff682c56c9180897f34
|
data/lib/persisto/repository.rb
CHANGED
@@ -30,14 +30,18 @@ module Persisto
|
|
30
30
|
@stores = {}
|
31
31
|
end
|
32
32
|
|
33
|
-
|
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
|
data/lib/persisto/version.rb
CHANGED
@@ -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.
|
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
|