mida 0.3.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +8 -3
- data/lib/mida/datatype/enumeration.rb +2 -4
- data/lib/mida/datatype/generic.rb +1 -3
- data/lib/mida/datatype/iso8601date.rb +1 -1
- data/lib/mida/document.rb +1 -1
- data/lib/mida/version.rb +1 -1
- data/mida.gemspec +2 -3
- data/spec/datatype/boolean_spec.rb +8 -8
- data/spec/datatype/enumeration_spec.rb +3 -3
- data/spec/datatype/float_spec.rb +3 -3
- data/spec/datatype/generic_spec.rb +9 -9
- data/spec/datatype/integer_spec.rb +4 -4
- data/spec/datatype/iso8601date_spec.rb +3 -3
- data/spec/datatype/number_spec.rb +3 -3
- data/spec/datatype/text_spec.rb +2 -2
- data/spec/datatype/url_spec.rb +4 -4
- data/spec/document_spec.rb +30 -23
- data/spec/item_spec.rb +80 -80
- data/spec/itemprop_spec.rb +13 -12
- data/spec/itemscope_spec.rb +21 -21
- data/spec/propertydesc_spec.rb +6 -6
- data/spec/vocabulary_spec.rb +35 -35
- metadata +7 -22
- data/Gemfile.lock +0 -38
data/spec/propertydesc_spec.rb
CHANGED
@@ -7,11 +7,11 @@ describe Mida::PropertyDesc, 'when initialized without a block' do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it '#to_h[:num] should equal num passed' do
|
10
|
-
@propertyDesc.to_h[:num].
|
10
|
+
expect(@propertyDesc.to_h[:num]).to eq(3)
|
11
11
|
end
|
12
12
|
|
13
13
|
it '#to_h[:types] should equal DataType::Text' do
|
14
|
-
@propertyDesc.to_h[:types].
|
14
|
+
expect(@propertyDesc.to_h[:types]).to eq([Mida::DataType::Text])
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -21,7 +21,7 @@ describe Mida::PropertyDesc, 'when initialized with a block with no specified ty
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it '#to_h[:types] should equal DataType::Text' do
|
24
|
-
@propertyDesc.to_h[:types].
|
24
|
+
expect(@propertyDesc.to_h[:types]).to eq([Mida::DataType::Text])
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -31,7 +31,7 @@ describe Mida::PropertyDesc, 'when initialized with a block that specifies types
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it '#to_h[:types] should equal [String, Array]' do
|
34
|
-
@propertyDesc.to_h[:types].
|
34
|
+
expect(@propertyDesc.to_h[:types]).to eq([String, Array])
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -44,13 +44,13 @@ describe Mida::PropertyDesc, 'when initialized with a block that specifies types
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'should warn on initialization if types() is used in the block' do
|
47
|
-
@error.
|
47
|
+
expect(@error).to eq("[DEPRECATION] Mida::PropertyDesc#types is deprecated. "+
|
48
48
|
"Please use Mida::PropertyDesc#extract instead."
|
49
49
|
)
|
50
50
|
end
|
51
51
|
|
52
52
|
it '#to_h[:types] should equal [String, Array]' do
|
53
|
-
@propertyDesc.to_h[:types].
|
53
|
+
expect(@propertyDesc.to_h[:types]).to eq([String, Array])
|
54
54
|
end
|
55
55
|
|
56
56
|
end
|
data/spec/vocabulary_spec.rb
CHANGED
@@ -11,16 +11,16 @@ describe Mida::Vocabulary, 'when subclassed and given has statements with no blo
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it '#itemtype should return the correct regexp' do
|
14
|
-
Organization.itemtype.
|
14
|
+
expect(Organization.itemtype).to eq(%r{http://example\.com.*?organization$}i)
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should specify name to appear once' do
|
18
|
-
Organization.properties['name'][:num].
|
18
|
+
expect(Organization.properties['name'][:num]).to eq(:one)
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should specify tel and url to appear many times' do
|
22
|
-
Organization.properties['tel'][:num].
|
23
|
-
Organization.properties['url'][:num].
|
22
|
+
expect(Organization.properties['tel'][:num]).to eq(:many)
|
23
|
+
expect(Organization.properties['url'][:num]).to eq(:many)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -49,31 +49,31 @@ describe Mida::Vocabulary, 'when subclassed and given has statements with blocks
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it '#itemtype should return the correct regexp' do
|
52
|
-
Review.itemtype.
|
52
|
+
expect(Review.itemtype).to eq(%r{http://example\.com.*?review$}i)
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should specify itemreviewed to appear once' do
|
56
|
-
Review.properties['itemreviewed'][:num].
|
56
|
+
expect(Review.properties['itemreviewed'][:num]).to eq(:one)
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'should specify that itemreviewed only have the type Mida::DataType::Text' do
|
60
|
-
Review.properties['itemreviewed'][:types].
|
60
|
+
expect(Review.properties['itemreviewed'][:types]).to eq([Mida::DataType::Text])
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'should specify rating to appear once' do
|
64
|
-
Review.properties['rating'][:num].
|
64
|
+
expect(Review.properties['rating'][:num]).to eq(:one)
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'should specify rating to only have the types: Rating, Mida::DataType::Text' do
|
68
|
-
Review.properties['rating'][:types].
|
68
|
+
expect(Review.properties['rating'][:types]).to eq([Rating, Mida::DataType::Text])
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'should specify comments to appear many times' do
|
72
|
-
Review.properties['comments'][:num].
|
72
|
+
expect(Review.properties['comments'][:num]).to eq(:many)
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'should specify that comments only have the type Comment' do
|
76
|
-
Review.properties['comments'][:types].
|
76
|
+
expect(Review.properties['comments'][:types]).to eq([Comment])
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -89,19 +89,19 @@ describe Mida::Vocabulary, 'when subclassed and used with :any for properties an
|
|
89
89
|
end
|
90
90
|
|
91
91
|
it '#itemtype should return the correct regexp' do
|
92
|
-
Person.itemtype.
|
92
|
+
expect(Person.itemtype).to eq(%r{http://example.com/vocab/person})
|
93
93
|
end
|
94
94
|
|
95
95
|
it 'should specify that name only appears once' do
|
96
|
-
Person.properties['name'][:num].
|
96
|
+
expect(Person.properties['name'][:num]).to eq(:one)
|
97
97
|
end
|
98
98
|
|
99
99
|
it 'should specify that any other property can appear many times' do
|
100
|
-
Person.properties[:any][:num].
|
100
|
+
expect(Person.properties[:any][:num]).to eq(:many)
|
101
101
|
end
|
102
102
|
|
103
103
|
it 'should specify that any other property can have any type' do
|
104
|
-
Person.properties[:any][:types].
|
104
|
+
expect(Person.properties[:any][:types]).to eq([:any])
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -123,11 +123,11 @@ describe Mida::Vocabulary, 'when subclassed' do
|
|
123
123
|
end
|
124
124
|
|
125
125
|
it 'should register the vocabulary subclass' do
|
126
|
-
Mida::Vocabulary.vocabularies.
|
126
|
+
expect(Mida::Vocabulary.vocabularies).to include(Person)
|
127
127
|
end
|
128
128
|
|
129
129
|
it '#included_vocabularies should be empty' do
|
130
|
-
Person.included_vocabularies.empty
|
130
|
+
expect(Person.included_vocabularies.empty?).to be_truthy
|
131
131
|
end
|
132
132
|
|
133
133
|
end
|
@@ -142,11 +142,11 @@ describe Mida::Vocabulary, 'when subclassed and has no properties' do
|
|
142
142
|
end
|
143
143
|
|
144
144
|
it 'should register the vocabulary subclass' do
|
145
|
-
Mida::Vocabulary.vocabularies.
|
145
|
+
expect(Mida::Vocabulary.vocabularies).to include(Empty)
|
146
146
|
end
|
147
147
|
|
148
148
|
it '#properties should return an empty hash' do
|
149
|
-
Mida::Vocabulary.properties.
|
149
|
+
expect(Mida::Vocabulary.properties).to eq({})
|
150
150
|
end
|
151
151
|
|
152
152
|
end
|
@@ -180,42 +180,42 @@ describe Mida::Vocabulary, 'when subclassed and using #include_vocabulary' do
|
|
180
180
|
end
|
181
181
|
|
182
182
|
it '#itemtype should return the new regexp' do
|
183
|
-
Car.itemtype.
|
183
|
+
expect(Car.itemtype).to eq(%r{http://example\.com.*?car$}i)
|
184
184
|
end
|
185
185
|
|
186
186
|
it "should contain included vocabularies' properties" do
|
187
187
|
['description', 'make','model', 'colour'].each do
|
188
|
-
|prop| Car.properties[prop][:num].
|
188
|
+
|prop| expect(Car.properties[prop][:num]).to eq(:one)
|
189
189
|
end
|
190
|
-
Car.properties['addons'][:num].
|
190
|
+
expect(Car.properties['addons'][:num]).to eq(:many)
|
191
191
|
end
|
192
192
|
|
193
193
|
it "should contain new properties" do
|
194
|
-
Car.properties['engine'][:num].
|
195
|
-
Car.properties['stickers'][:num].
|
194
|
+
expect(Car.properties['engine'][:num]).to eq(:one)
|
195
|
+
expect(Car.properties['stickers'][:num]).to eq(:many)
|
196
196
|
end
|
197
197
|
|
198
198
|
it '#included_vocabularies should return the included vocabularies' do
|
199
199
|
[Thing, Product, Vehicle].each do |vocab|
|
200
|
-
Car.included_vocabularies.
|
200
|
+
expect(Car.included_vocabularies).to include(vocab)
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
204
|
it '.kind_of? should still work with plain Vocabulary' do
|
205
|
-
Car.kind_of?(Mida::Vocabulary).
|
205
|
+
expect(Car.kind_of?(Mida::Vocabulary)).to be_truthy
|
206
206
|
end
|
207
207
|
|
208
208
|
it '.kind_of? should recognize included vocabularies' do
|
209
|
-
Car.kind_of?(Car).
|
210
|
-
Car.kind_of?(Vehicle).
|
211
|
-
Vehicle.kind_of?(Product).
|
212
|
-
Car.kind_of?(Product).
|
213
|
-
Car.kind_of?(Thing).
|
209
|
+
expect(Car.kind_of?(Car)).to be_truthy
|
210
|
+
expect(Car.kind_of?(Vehicle)).to be_truthy
|
211
|
+
expect(Vehicle.kind_of?(Product)).to be_truthy
|
212
|
+
expect(Car.kind_of?(Product)).to be_truthy
|
213
|
+
expect(Car.kind_of?(Thing)).to be_truthy
|
214
214
|
end
|
215
215
|
|
216
216
|
it '.kind_of? should recognize vocabularies without a relationship' do
|
217
|
-
Vehicle.kind_of?(Car).
|
218
|
-
Thing.kind_of?(Product).
|
217
|
+
expect(Vehicle.kind_of?(Car)).to be_falsey
|
218
|
+
expect(Thing.kind_of?(Product)).to be_falsey
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
@@ -265,7 +265,7 @@ describe Mida::Vocabulary, 'when subclassed with circular dependancies' do
|
|
265
265
|
'use_with' => {types: [Medicine], num: :many},
|
266
266
|
'similar_to' => {types: [Potion], num: :many}
|
267
267
|
}
|
268
|
-
Medicine.properties.
|
269
|
-
Potion.properties.
|
268
|
+
expect(Medicine.properties).to eq(expected_properties)
|
269
|
+
expect(Potion.properties).to eq(expected_properties)
|
270
270
|
end
|
271
271
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mida
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lawrence Woodman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: blankslate
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 3.1.3
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 3.1.3
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: nokogiri
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +30,14 @@ dependencies:
|
|
44
30
|
requirements:
|
45
31
|
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
33
|
+
version: '2.4'
|
48
34
|
type: :runtime
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
38
|
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
40
|
+
version: '2.4'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: bundler
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +72,14 @@ dependencies:
|
|
86
72
|
requirements:
|
87
73
|
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
75
|
+
version: '3.1'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
82
|
+
version: '3.1'
|
97
83
|
description: A Microdata parser and extractor library which includes support for the
|
98
84
|
schema.org vocabularies
|
99
85
|
email: lwoodman@vlifesystems.com
|
@@ -110,7 +96,6 @@ files:
|
|
110
96
|
- ".travis.yml"
|
111
97
|
- CHANGELOG.rdoc
|
112
98
|
- Gemfile
|
113
|
-
- Gemfile.lock
|
114
99
|
- LICENCE.rdoc
|
115
100
|
- README.rdoc
|
116
101
|
- Rakefile
|
@@ -465,7 +450,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
465
450
|
version: '0'
|
466
451
|
requirements: []
|
467
452
|
rubyforge_project:
|
468
|
-
rubygems_version: 2.
|
453
|
+
rubygems_version: 2.5.1
|
469
454
|
signing_key:
|
470
455
|
specification_version: 4
|
471
456
|
summary: A Microdata parser/extractor library
|
data/Gemfile.lock
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
mida (0.3.8)
|
5
|
-
addressable (~> 2.3.8)
|
6
|
-
blankslate (= 3.1.3)
|
7
|
-
nokogiri (>= 1.6)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
addressable (2.3.8)
|
13
|
-
blankslate (3.1.3)
|
14
|
-
diff-lcs (1.1.3)
|
15
|
-
mini_portile (0.6.2)
|
16
|
-
nokogiri (1.6.6.3)
|
17
|
-
mini_portile (~> 0.6.0)
|
18
|
-
rake (10.1.0)
|
19
|
-
rspec (2.10.0)
|
20
|
-
rspec-core (~> 2.10.0)
|
21
|
-
rspec-expectations (~> 2.10.0)
|
22
|
-
rspec-mocks (~> 2.10.0)
|
23
|
-
rspec-core (2.10.1)
|
24
|
-
rspec-expectations (2.10.0)
|
25
|
-
diff-lcs (~> 1.1.3)
|
26
|
-
rspec-mocks (2.10.1)
|
27
|
-
|
28
|
-
PLATFORMS
|
29
|
-
ruby
|
30
|
-
|
31
|
-
DEPENDENCIES
|
32
|
-
bundler (~> 1.6)
|
33
|
-
mida!
|
34
|
-
rake
|
35
|
-
rspec (~> 2.10.0)
|
36
|
-
|
37
|
-
BUNDLED WITH
|
38
|
-
1.10.6
|