fetcher-microdata 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fetcher-microdata/review.rb +1 -1
- data/lib/fetcher-microdata/version.rb +1 -1
- data/spec/fetcher/microdata/article_small_spec.rb +13 -9
- data/spec/fetcher/microdata/person_user_spec.rb +11 -9
- data/spec/fetcher/microdata/review_spec.rb +16 -12
- data/spec/writer/fetcher/microdata/review_spec.rb +3 -3
- metadata +1 -1
@@ -3,7 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe Fetcher::Microdata::ArticleSmall do
|
4
4
|
describe '.new' do
|
5
5
|
it 'should set the _type to schema.org/Article/Small' do
|
6
|
-
|
6
|
+
@arg = stub "arg"
|
7
|
+
article = Fetcher::Microdata::ArticleSmall.new @arg, @argument, @viewer
|
7
8
|
article._type.should == "http://schema.org/Article/Small"
|
8
9
|
end
|
9
10
|
end
|
@@ -20,46 +21,49 @@ describe Fetcher::Microdata::ArticleSmall do
|
|
20
21
|
|
21
22
|
describe 'attributes' do
|
22
23
|
before do
|
24
|
+
@arg1 = stub "args1"
|
25
|
+
@arg2 = stub "args2"
|
26
|
+
@arg3 = stub "args3"
|
23
27
|
Fetcher::Microdata::ArticleSmall.any_instance.stub :coerce
|
24
28
|
end
|
25
29
|
|
26
30
|
it 'should set attribute additionalType' do
|
27
|
-
Fetcher::Microdata::ArticleSmall.new(@
|
31
|
+
Fetcher::Microdata::ArticleSmall.new(@arg1, @arg2, @arg3)
|
28
32
|
.attributes.should have_key :additionalType
|
29
33
|
end
|
30
34
|
|
31
35
|
it 'should set attribute id' do
|
32
|
-
Fetcher::Microdata::ArticleSmall.new(@
|
36
|
+
Fetcher::Microdata::ArticleSmall.new(@arg1, @arg2, @arg3)
|
33
37
|
.attributes.should have_key :id
|
34
38
|
end
|
35
39
|
|
36
40
|
it 'should set attribute articleBody' do
|
37
|
-
Fetcher::Microdata::ArticleSmall.new(@
|
41
|
+
Fetcher::Microdata::ArticleSmall.new(@arg1, @arg2, @arg3)
|
38
42
|
.attributes.should have_key :articleBody
|
39
43
|
end
|
40
44
|
|
41
45
|
it 'should set attribute author' do
|
42
|
-
Fetcher::Microdata::ArticleSmall.new(@
|
46
|
+
Fetcher::Microdata::ArticleSmall.new(@arg1, @arg2, @arg3)
|
43
47
|
.attributes.should have_key :author
|
44
48
|
end
|
45
49
|
|
46
50
|
it 'should set attribute viewer' do
|
47
|
-
Fetcher::Microdata::ArticleSmall.new(@
|
51
|
+
Fetcher::Microdata::ArticleSmall.new(@arg1, @arg2, @arg3)
|
48
52
|
.attributes.should have_key :viewer
|
49
53
|
end
|
50
54
|
|
51
55
|
it 'should set attribute dateCreated' do
|
52
|
-
Fetcher::Microdata::ArticleSmall.new(@
|
56
|
+
Fetcher::Microdata::ArticleSmall.new(@arg1, @arg2, @arg3)
|
53
57
|
.attributes.should have_key :dateCreated
|
54
58
|
end
|
55
59
|
|
56
60
|
it 'should set attribute provider' do
|
57
|
-
Fetcher::Microdata::ArticleSmall.new(@
|
61
|
+
Fetcher::Microdata::ArticleSmall.new(@arg1, @arg2, @arg3)
|
58
62
|
.attributes.should have_key :provider
|
59
63
|
end
|
60
64
|
|
61
65
|
it 'should set attribute url' do
|
62
|
-
Fetcher::Microdata::ArticleSmall.new(@
|
66
|
+
Fetcher::Microdata::ArticleSmall.new(@arg1, @arg2, @arg3)
|
63
67
|
.attributes.should have_key :url
|
64
68
|
end
|
65
69
|
end
|
@@ -2,8 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Fetcher::Microdata::PersonUser do
|
4
4
|
describe '.new' do
|
5
|
-
it 'should set the _type to schema.org/Person/User' do
|
6
|
-
|
5
|
+
it 'should set the _type to schema.org/Person/User' do
|
6
|
+
@arg = stub "arg"
|
7
|
+
person = Fetcher::Microdata::PersonUser.new @arg, @argument
|
7
8
|
person._type.should == "http://schema.org/Person/User"
|
8
9
|
end
|
9
10
|
end
|
@@ -20,31 +21,32 @@ describe Fetcher::Microdata::PersonUser do
|
|
20
21
|
|
21
22
|
describe 'attributes' do
|
22
23
|
before do
|
23
|
-
@
|
24
|
+
@arg1 = stub "arg1"
|
25
|
+
@arg2 = stub "arg2"
|
24
26
|
end
|
25
27
|
|
26
28
|
it 'should have the attribute additionalType' do
|
27
|
-
Fetcher::Microdata::PersonUser.new(@
|
29
|
+
Fetcher::Microdata::PersonUser.new(@arg1, @arg2).attributes.should have_key :additionalType
|
28
30
|
end
|
29
31
|
|
30
32
|
it 'should have the attribute id' do
|
31
|
-
Fetcher::Microdata::PersonUser.new(@
|
33
|
+
Fetcher::Microdata::PersonUser.new(@arg1, @arg2).attributes.should have_key :id
|
32
34
|
end
|
33
35
|
|
34
36
|
it 'should have the attribute name' do
|
35
|
-
Fetcher::Microdata::PersonUser.new(@
|
37
|
+
Fetcher::Microdata::PersonUser.new(@arg1, @arg2).attributes.should have_key :name
|
36
38
|
end
|
37
39
|
|
38
40
|
it 'should have the attribute dateRegistered' do
|
39
|
-
Fetcher::Microdata::PersonUser.new(@
|
41
|
+
Fetcher::Microdata::PersonUser.new(@arg1, @arg2).attributes.should have_key :dateRegistered
|
40
42
|
end
|
41
43
|
|
42
44
|
it 'should have the attribute description' do
|
43
|
-
Fetcher::Microdata::PersonUser.new(@
|
45
|
+
Fetcher::Microdata::PersonUser.new(@arg1, @arg2).attributes.should have_key :description
|
44
46
|
end
|
45
47
|
|
46
48
|
it 'should have the attribute url' do
|
47
|
-
Fetcher::Microdata::PersonUser.new(@
|
49
|
+
Fetcher::Microdata::PersonUser.new(@arg1, @arg2).attributes.should have_key :url
|
48
50
|
end
|
49
51
|
end
|
50
52
|
end
|
@@ -3,7 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe Fetcher::Microdata::Review do
|
4
4
|
describe '.new' do
|
5
5
|
it 'should set the _type to schema.org/Review' do
|
6
|
-
|
6
|
+
@arg = stub "arg"
|
7
|
+
article = Fetcher::Microdata::Review.new @arg, @argument, @viewer
|
7
8
|
article._type.should == "http://schema.org/Review"
|
8
9
|
end
|
9
10
|
end
|
@@ -20,52 +21,55 @@ describe Fetcher::Microdata::Review do
|
|
20
21
|
|
21
22
|
describe 'attributes' do
|
22
23
|
before do
|
24
|
+
@arg1 = stub "args1"
|
25
|
+
@arg2 = stub "args2"
|
26
|
+
@arg3 = stub "args3"
|
23
27
|
Fetcher::Microdata::Review.any_instance.stub :coerce
|
24
28
|
end
|
25
29
|
|
26
30
|
it 'should set attribute additionalType' do
|
27
|
-
Fetcher::Microdata::Review.new(@
|
31
|
+
Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3)
|
28
32
|
.attributes.should have_key :additionalType
|
29
33
|
end
|
30
34
|
|
31
35
|
it 'should set attribute id' do
|
32
|
-
Fetcher::Microdata::Review.new(@
|
36
|
+
Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3)
|
33
37
|
.attributes.should have_key :id
|
34
38
|
end
|
35
39
|
|
36
40
|
it 'should set attribute articleBody' do
|
37
|
-
Fetcher::Microdata::Review.new(@
|
38
|
-
.attributes.should have_key :
|
41
|
+
Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3)
|
42
|
+
.attributes.should have_key :reviewBody
|
39
43
|
end
|
40
44
|
|
41
45
|
it 'should set attribute author' do
|
42
|
-
Fetcher::Microdata::Review.new(@
|
46
|
+
Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3)
|
43
47
|
.attributes.should have_key :author
|
44
48
|
end
|
45
49
|
|
46
50
|
it 'should set attribute viewer' do
|
47
|
-
Fetcher::Microdata::Review.new(@
|
51
|
+
Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3)
|
48
52
|
.attributes.should have_key :viewer
|
49
53
|
end
|
50
54
|
|
51
55
|
it 'should set attribute dateCreated' do
|
52
|
-
Fetcher::Microdata::Review.new(@
|
56
|
+
Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3)
|
53
57
|
.attributes.should have_key :dateCreated
|
54
58
|
end
|
55
59
|
|
56
60
|
it 'should set attribute provider' do
|
57
|
-
Fetcher::Microdata::Review.new(@
|
61
|
+
Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3)
|
58
62
|
.attributes.should have_key :provider
|
59
63
|
end
|
60
64
|
|
61
65
|
it 'should set attribute url' do
|
62
|
-
Fetcher::Microdata::Review.new(@
|
66
|
+
Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3)
|
63
67
|
.attributes.should have_key :url
|
64
68
|
end
|
65
69
|
|
66
70
|
it 'should set attribute original_tweet' do
|
67
|
-
Fetcher::Microdata::Review.new(@
|
68
|
-
.attributes.should have_key :
|
71
|
+
Fetcher::Microdata::Review.new(@arg1, @arg2, @arg3)
|
72
|
+
.attributes.should have_key :itemReviewed
|
69
73
|
end
|
70
74
|
end
|
71
75
|
end
|
@@ -49,15 +49,15 @@ describe Writer::Fetcher::Microdata::Review do
|
|
49
49
|
.and_return :id => 234536234, :author => @author_stub, :viewer => @viewer_stub
|
50
50
|
end
|
51
51
|
|
52
|
-
it 'should include the
|
52
|
+
it 'should include the itemReviewed' do
|
53
53
|
@properties_hash = {
|
54
|
-
"
|
54
|
+
"itemReviewed" => [
|
55
55
|
"some body"
|
56
56
|
]
|
57
57
|
}
|
58
58
|
|
59
59
|
@schema_stub.should_receive(:attributes)
|
60
|
-
.and_return :
|
60
|
+
.and_return :itemReviewed => "some body", :author => @author_stub, :viewer => @viewer_stub
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'should include the author' do
|