discoverer 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/discoverer.gemspec +1 -1
- data/lib/discoverer/model.rb +2 -2
- data/lib/discoverer/version.rb +1 -1
- data/spec/discoverer/discoverer_spec.rb +1 -1
- data/spec/discoverer/model_spec.rb +4 -8
- data/spec/discoverer/pattern_spec.rb +1 -1
- data/spec/discoverer/reader_spec.rb +1 -1
- data/spec/discoverer/writer_spec.rb +1 -1
- metadata +7 -7
data/discoverer.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.summary = %q{Discoverer functionality with focus in writers and readers}
|
9
9
|
gem.homepage = ""
|
10
10
|
|
11
|
-
gem.add_dependency 'virtus'
|
11
|
+
gem.add_dependency 'virtus', '~> 1.0'
|
12
12
|
|
13
13
|
gem.add_development_dependency 'rspec'
|
14
14
|
gem.add_development_dependency 'pry'
|
data/lib/discoverer/model.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Discoverer
|
2
2
|
# {include:file:docs/Discoverer/Model.md}
|
3
3
|
class Model
|
4
|
-
include Virtus
|
4
|
+
include Virtus.model
|
5
5
|
include Reader
|
6
6
|
include Writer
|
7
7
|
|
@@ -39,4 +39,4 @@ module Discoverer
|
|
39
39
|
"#{self}".split("::").last.downcase
|
40
40
|
end
|
41
41
|
end
|
42
|
-
end
|
42
|
+
end
|
data/lib/discoverer/version.rb
CHANGED
@@ -32,7 +32,7 @@ describe Discoverer do
|
|
32
32
|
it 'should return false' do
|
33
33
|
module SomeAdaptation; end
|
34
34
|
|
35
|
-
not_name =
|
35
|
+
not_name = double 'not name'
|
36
36
|
not_name.should_receive(:name).and_return nil
|
37
37
|
Discoverer.has_adapter_for?(SomeAdaptation, not_name).should == false
|
38
38
|
end
|
@@ -9,10 +9,6 @@ describe Discoverer::Model do
|
|
9
9
|
Discoverer::Model.ancestors.should include Discoverer::Writer
|
10
10
|
end
|
11
11
|
|
12
|
-
it 'should include Virtus' do
|
13
|
-
Discoverer::Model.ancestors.should include Virtus
|
14
|
-
end
|
15
|
-
|
16
12
|
it 'should include the attribute _id' do
|
17
13
|
flag = false
|
18
14
|
Discoverer::Model.attribute_set.each do |attribute|
|
@@ -53,7 +49,7 @@ describe Discoverer::Model do
|
|
53
49
|
context 'only one attribute is set' do
|
54
50
|
context 'my_attr was set' do
|
55
51
|
it 'should return the attribute that was set' do
|
56
|
-
Discoverer::Model.any_instance.should_receive(:from).and_return
|
52
|
+
Discoverer::Model.any_instance.should_receive(:from).and_return double(:default => nil)
|
57
53
|
model = Discoverer::Model.new :my_attr => "value"
|
58
54
|
model.attributes!.should == { :my_attr => "value" }
|
59
55
|
end
|
@@ -114,7 +110,7 @@ describe Discoverer::Model do
|
|
114
110
|
|
115
111
|
context 'a Hash without _id key is passed' do
|
116
112
|
it 'should return a new instance with the attributes set' do
|
117
|
-
reader =
|
113
|
+
reader = double 'reader'
|
118
114
|
Discoverer::Model.any_instance.should_receive(:from).and_return reader
|
119
115
|
reader.should_receive :default
|
120
116
|
mod = Discoverer::Model.new :my_attr => "345345"
|
@@ -122,7 +118,7 @@ describe Discoverer::Model do
|
|
122
118
|
end
|
123
119
|
|
124
120
|
it 'should call the reader #from and send the method #default' do
|
125
|
-
reader =
|
121
|
+
reader = double 'reader'
|
126
122
|
Discoverer::Model.any_instance.should_receive(:from).and_return reader
|
127
123
|
reader.should_receive :default
|
128
124
|
Discoverer::Model.new :my_attr => "234"
|
@@ -130,4 +126,4 @@ describe Discoverer::Model do
|
|
130
126
|
end
|
131
127
|
end
|
132
128
|
end
|
133
|
-
end
|
129
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discoverer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: virtus
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
21
|
+
version: '1.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
29
|
+
version: '1.0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rspec
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 1.8.
|
109
|
+
rubygems_version: 1.8.25
|
110
110
|
signing_key:
|
111
111
|
specification_version: 3
|
112
112
|
summary: Discoverer functionality with focus in writers and readers
|