juvet 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/juvet/configuration/adapter.rb +5 -1
- data/lib/juvet/configuration.rb +1 -3
- data/lib/juvet/version.rb +1 -1
- data/lib/juvet.rb +2 -2
- data/spec/juvet/configuration/adapter_spec.rb +7 -0
- data/spec/juvet/configuration_spec.rb +0 -6
- data/spec/juvet_spec.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ac5e5b95d6312d763f506e3ba5e5d60ae2da66a
|
4
|
+
data.tar.gz: 728de00cdd354de2f413f893e4f5c78aae180f06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e42c4c453fddc8fecfbfc6a7974fd8bd8d6b427ee601fd151393850eb65d4e05d1096227abd76780a20c2f306346d2ff5067dc469abe042529a368e8c42c2ef1
|
7
|
+
data.tar.gz: 3ec51c75ca8e74654b86c2a31da27a58ccd5a272c08c976b766bd7de8440e5da316c7e091223a6a6ef30dc4122260a6c46744ddd5fc102f8c19d6917f43065e6
|
data/Gemfile.lock
CHANGED
@@ -6,7 +6,7 @@ module Juvet
|
|
6
6
|
attr_reader :type
|
7
7
|
|
8
8
|
def initialize(options={})
|
9
|
-
opts = (options || {})
|
9
|
+
opts = default_options.merge((options || {}))
|
10
10
|
|
11
11
|
@type = opts.delete :type
|
12
12
|
@options = opts
|
@@ -20,6 +20,10 @@ module Juvet
|
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
|
+
def default_options
|
24
|
+
{ type: :null }.freeze
|
25
|
+
end
|
26
|
+
|
23
27
|
def load_adapter
|
24
28
|
require "juvet/adapters/#{type}_adapter"
|
25
29
|
rescue LoadError => e
|
data/lib/juvet/configuration.rb
CHANGED
data/lib/juvet/version.rb
CHANGED
data/lib/juvet.rb
CHANGED
@@ -20,6 +20,13 @@ describe Juvet::Configuration::Adapter do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
describe "default options" do
|
24
|
+
it "has a null adapter type" do
|
25
|
+
expect(described_class.new.type).to eq :null
|
26
|
+
expect(described_class.new.class_name).to eq "NullAdapter"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
23
30
|
describe "#build" do
|
24
31
|
let(:mapper) { double(:mapper, collection_for_repository: nil) }
|
25
32
|
subject { described_class.new type: :null }
|
@@ -2,7 +2,6 @@ describe Juvet::Configuration do
|
|
2
2
|
subject { described_class.new }
|
3
3
|
|
4
4
|
it "has a default repository adapter" do
|
5
|
-
subject.adapter = nil
|
6
5
|
expect(subject.adapter).to be_instance_of Juvet::Configuration::Adapter
|
7
6
|
end
|
8
7
|
|
@@ -13,11 +12,6 @@ describe Juvet::Configuration do
|
|
13
12
|
describe "#load!" do
|
14
13
|
subject { described_class.new }
|
15
14
|
|
16
|
-
before(:each) do
|
17
|
-
subject.adapter = { type: :null }
|
18
|
-
subject.mapping do; end
|
19
|
-
end
|
20
|
-
|
21
15
|
it "builds the mapping" do
|
22
16
|
expect(subject.mapping).to receive(:build).and_call_original
|
23
17
|
subject.load!
|
data/spec/juvet_spec.rb
CHANGED
@@ -16,5 +16,23 @@ describe Juvet do
|
|
16
16
|
expect(described_class.configuration).to receive(:load!)
|
17
17
|
described_class.configure
|
18
18
|
end
|
19
|
+
|
20
|
+
it "sets up the adapter" do
|
21
|
+
described_class.configure do
|
22
|
+
adapter type: :null, blah: "blah"
|
23
|
+
end
|
24
|
+
expect(described_class.configuration.adapter).to be_instance_of Juvet::Configuration::Adapter
|
25
|
+
expect(described_class.configuration.adapter.type).to eq :null
|
26
|
+
expect(described_class.configuration.adapter.options).to eq({ blah: "blah" })
|
27
|
+
expect(described_class.configuration.adapter.class_name).to eq "NullAdapter"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "sets up the mapping" do
|
31
|
+
described_class.configure do
|
32
|
+
mapping do
|
33
|
+
end
|
34
|
+
end
|
35
|
+
expect(described_class.configuration.mapping).to be_instance_of Juvet::Configuration::Mapping
|
36
|
+
end
|
19
37
|
end
|
20
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: juvet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Wright
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|