ostatus 0.0.12 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +5 -1
- data/Gemfile +9 -1
- data/Rakefile +4 -12
- data/lib/ostatus/author.rb +3 -1
- data/lib/ostatus/version.rb +1 -1
- data/ostatus.gemspec +1 -1
- data/spec/activity_spec.rb +10 -12
- data/spec/author_spec.rb +11 -12
- data/spec/builder_spec.rb +17 -16
- data/spec/entry_spec.rb +21 -23
- data/spec/feed_spec.rb +6 -13
- data/spec/helper.rb +8 -0
- data/spec/portable_contacts_spec.rb +30 -29
- data/spec/salmon_spec.rb +2 -1
- metadata +11 -17
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6ba63cce4a938dc9ca74effd289d0e6d3f53efec
|
4
|
+
data.tar.gz: b5e1b731394b014d33f6ca09c840f96259cee19a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 63535f478d0be95a044553f0525715569db1e798e59c055fb38bc34c068fc1d7d3d8ef1905801233ccd7c506acf9c3d67ccc518a4789836415209c7da0131fb0
|
7
|
+
data.tar.gz: 864ad3ea5f9c82c27773f736f54f503a43c087641da04b48a11f3f7dcfd866fde2a4f9473e78b05e35f00acf42dff5b9beea3f3384d5942c179c566faa2c01ed
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,15 +1,7 @@
|
|
1
|
-
require
|
1
|
+
require "bundler/gem_tasks"
|
2
2
|
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
5
|
-
spec.pattern = 'spec/*_spec.rb'
|
6
|
-
end
|
3
|
+
require 'rake/testtask'
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
spec.pattern = 'spec/*_spec.rb'
|
11
|
-
spec.rspec_opts = ['--format documentation']
|
5
|
+
Rake::TestTask.new do |t|
|
6
|
+
t.pattern = "spec/*_spec.rb"
|
12
7
|
end
|
13
|
-
|
14
|
-
require 'bundler'
|
15
|
-
Bundler::GemHelper.install_tasks
|
data/lib/ostatus/author.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require_relative 'activity'
|
2
2
|
require_relative 'portable_contacts'
|
3
|
-
require 'date'
|
4
3
|
|
5
4
|
module OStatus
|
5
|
+
require 'atom'
|
6
6
|
|
7
7
|
# Holds information about the author of the Feed.
|
8
8
|
class Author < Atom::Person
|
9
|
+
require 'date'
|
10
|
+
|
9
11
|
include Atom::SimpleExtensions
|
10
12
|
|
11
13
|
add_extension_namespace :activity, ACTIVITY_NS
|
data/lib/ostatus/version.rb
CHANGED
data/ostatus.gemspec
CHANGED
data/spec/activity_spec.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
require_relative '
|
2
|
-
require_relative '../lib/ostatus/entry.rb'
|
1
|
+
require_relative 'helper'
|
3
2
|
require_relative '../lib/ostatus/activity.rb'
|
4
|
-
require_relative '../lib/ostatus/author.rb'
|
5
3
|
|
6
4
|
describe OStatus::Activity do
|
7
|
-
before
|
5
|
+
before do
|
8
6
|
feed = OStatus::Feed.from_url('test/example_feed.atom')
|
9
7
|
entry = feed.entries[0]
|
10
8
|
@activity = entry.activity
|
@@ -14,41 +12,41 @@ describe OStatus::Activity do
|
|
14
12
|
|
15
13
|
describe "#object" do
|
16
14
|
it "should give an Author containing the content of the activity:object tag" do
|
17
|
-
@activity.object.class.
|
15
|
+
@activity.object.class.must_equal(OStatus::Author)
|
18
16
|
end
|
19
17
|
|
20
18
|
it "should give nil when no activity:object was given" do
|
21
|
-
@activity_empty.object.
|
19
|
+
@activity_empty.object.must_equal(nil)
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
25
23
|
describe "#object-type" do
|
26
24
|
it "should give a String containing the content of the activity:object-type tag" do
|
27
|
-
@activity.object_type.
|
25
|
+
@activity.object_type.must_equal(:note)
|
28
26
|
end
|
29
27
|
|
30
28
|
it "should give nil when no activity:object-type was given" do
|
31
|
-
@activity_empty.object_type.
|
29
|
+
@activity_empty.object_type.must_equal(nil)
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
35
33
|
describe "#verb" do
|
36
34
|
it "should give a String containing the content of the activity:verb tag" do
|
37
|
-
@activity.verb.
|
35
|
+
@activity.verb.must_equal(:post)
|
38
36
|
end
|
39
37
|
|
40
38
|
it "should give nil when no activity:verb was given" do
|
41
|
-
@activity_empty.verb.
|
39
|
+
@activity_empty.verb.must_equal(nil)
|
42
40
|
end
|
43
41
|
end
|
44
42
|
|
45
43
|
describe "#target" do
|
46
44
|
it "should give a String containing the content of the activity:target tag" do
|
47
|
-
@activity.target.
|
45
|
+
@activity.target.must_equal('Barbaz')
|
48
46
|
end
|
49
47
|
|
50
48
|
it "should give nil when no activity:target was given" do
|
51
|
-
@activity_empty.target.
|
49
|
+
@activity_empty.target.must_equal(nil)
|
52
50
|
end
|
53
51
|
end
|
54
52
|
end
|
data/spec/author_spec.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'helper'
|
2
2
|
require_relative '../lib/ostatus/author.rb'
|
3
|
-
require_relative '../lib/ostatus/portable_contacts.rb'
|
4
3
|
|
5
4
|
describe OStatus::Author do
|
6
5
|
before(:each) do
|
@@ -12,51 +11,51 @@ describe OStatus::Author do
|
|
12
11
|
|
13
12
|
describe "#activity" do
|
14
13
|
it "should return an Activity instance" do
|
15
|
-
@author.activity.class.
|
14
|
+
@author.activity.class.must_equal(OStatus::Activity)
|
16
15
|
end
|
17
16
|
|
18
17
|
it "should give an Activity instance that is relevant to the author subtree" do
|
19
|
-
@author.activity.object_type.
|
18
|
+
@author.activity.object_type.must_equal(:person)
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
23
22
|
describe "#portable_contacts" do
|
24
23
|
it "should return an PortableContacts instance" do
|
25
|
-
@author.portable_contacts.class.
|
24
|
+
@author.portable_contacts.class.must_equal(OStatus::PortableContacts)
|
26
25
|
end
|
27
26
|
|
28
27
|
it "should give an PortableContacts instance that is relevant to the author subtree" do
|
29
|
-
@author.portable_contacts.preferred_username.
|
28
|
+
@author.portable_contacts.preferred_username.must_equal('greenmanspirit')
|
30
29
|
end
|
31
30
|
end
|
32
31
|
|
33
32
|
describe "#uri" do
|
34
33
|
it "should give a String containing the content of the uri tag" do
|
35
|
-
@author.uri.
|
34
|
+
@author.uri.must_equal('http://identi.ca/user/141464')
|
36
35
|
end
|
37
36
|
|
38
37
|
it "should give nil when no uri is given" do
|
39
|
-
@author_empty.uri.
|
38
|
+
@author_empty.uri.must_equal(nil)
|
40
39
|
end
|
41
40
|
end
|
42
41
|
|
43
42
|
describe "#name" do
|
44
43
|
it "should give a String containing the content of the name tag" do
|
45
|
-
@author.name.
|
44
|
+
@author.name.must_equal('greenmanspirit')
|
46
45
|
end
|
47
46
|
|
48
47
|
it "should give nil when no name is given" do
|
49
|
-
@author_empty.name.
|
48
|
+
@author_empty.name.must_equal(nil)
|
50
49
|
end
|
51
50
|
end
|
52
51
|
|
53
52
|
describe "email" do
|
54
53
|
it "should give a String containing the content of the email tag" do
|
55
|
-
@author.email.
|
54
|
+
@author.email.must_equal('foo@example.com')
|
56
55
|
end
|
57
56
|
|
58
57
|
it "should give nil when no email is given" do
|
59
|
-
@author_empty.email.
|
58
|
+
@author_empty.email.must_equal(nil)
|
60
59
|
end
|
61
60
|
end
|
62
61
|
end
|
data/spec/builder_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require_relative 'helper'
|
1
2
|
require_relative '../lib/ostatus/feed.rb'
|
2
3
|
|
3
4
|
describe 'XML builder' do
|
@@ -22,30 +23,30 @@ describe 'XML builder' do
|
|
22
23
|
end
|
23
24
|
|
24
25
|
it 'should generate the title' do
|
25
|
-
@feed.atom.
|
26
|
+
@feed.atom.must_match("<title>Dean's Updates")
|
26
27
|
end
|
27
28
|
|
28
29
|
it 'should generate the id' do
|
29
|
-
@feed.atom.
|
30
|
+
@feed.atom.must_match("<id>#{@feed_url}")
|
30
31
|
end
|
31
32
|
|
32
33
|
it 'should generate a self link' do
|
33
34
|
# depending on this attribute order is a really terrible idea, but oh well.
|
34
|
-
@feed.atom.
|
35
|
+
@feed.atom.must_match("<link rel=\"self\" href=\"#{@feed_url}\"/>")
|
35
36
|
end
|
36
37
|
|
37
38
|
it 'should generate the hub link' do
|
38
39
|
# depending on this attribute order is a really terrible idea, but oh well.
|
39
|
-
@feed.atom.
|
40
|
+
@feed.atom.must_match('<link rel="hub" href="http://example.org/hub"/>')
|
40
41
|
end
|
41
42
|
|
42
43
|
describe 'when generating the author' do
|
43
|
-
specify { @feed.atom.
|
44
|
-
specify { @feed.atom.
|
45
|
-
specify { @feed.atom.
|
46
|
-
specify { @feed.atom.
|
47
|
-
specify { @feed.atom.
|
48
|
-
specify { @feed.atom.
|
44
|
+
specify { @feed.atom.must_match('<name>Dean Venture') }
|
45
|
+
specify { @feed.atom.must_match('<email>dean@venture.com') }
|
46
|
+
specify { @feed.atom.must_match('<uri>http://geocities.com/~dean') }
|
47
|
+
specify { @feed.atom.must_match("<poco:id>#{@poco_id}") }
|
48
|
+
specify { @feed.atom.must_match('<poco:displayName>Dean Venture') }
|
49
|
+
specify { @feed.atom.must_match('<poco:preferredUsername>dean') }
|
49
50
|
end
|
50
51
|
|
51
52
|
describe 'when generating a feed with entries' do
|
@@ -62,11 +63,11 @@ describe 'XML builder' do
|
|
62
63
|
)
|
63
64
|
end
|
64
65
|
|
65
|
-
specify { @feed.atom.
|
66
|
-
specify { @feed.atom.
|
67
|
-
specify { @feed.atom.
|
68
|
-
specify { @feed.atom.
|
69
|
-
specify { @feed.atom.
|
70
|
-
specify { @feed.atom.
|
66
|
+
specify { @feed.atom.must_match('<title>atom powered robots') }
|
67
|
+
specify { @feed.atom.must_match('<content>atom powered robots') }
|
68
|
+
specify { @feed.atom.must_match(/#{Regexp.escape("<updated>#{@now.iso8601}")}/) }
|
69
|
+
specify { @feed.atom.must_match(/#{Regexp.escape("<published>#{@now.iso8601}")}/) }
|
70
|
+
specify { @feed.atom.must_match('<id>http://example.org/feed/1') }
|
71
|
+
specify { @feed.atom.must_match('<link href="http://example.org/feed/1"/>') }
|
71
72
|
end
|
72
73
|
end
|
data/spec/entry_spec.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'helper'
|
2
2
|
require_relative '../lib/ostatus/entry.rb'
|
3
|
-
require_relative '../lib/ostatus/activity.rb'
|
4
|
-
require_relative '../lib/ostatus/link.rb'
|
5
3
|
|
6
4
|
describe OStatus::Entry do
|
7
5
|
before(:each) do
|
@@ -13,93 +11,93 @@ describe OStatus::Entry do
|
|
13
11
|
|
14
12
|
describe "#activity" do
|
15
13
|
it "should return an Activity instance" do
|
16
|
-
@entry.activity.class.
|
14
|
+
@entry.activity.class.must_equal(OStatus::Activity)
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
20
18
|
describe "#title" do
|
21
19
|
it "should give a String containing the content of the title tag" do
|
22
|
-
@entry.title.
|
20
|
+
@entry.title.must_equal("staples come out of the head tomorrow, oh yeah")
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
26
24
|
describe "#content" do
|
27
25
|
it "should give a String containing the content of the content tag" do
|
28
|
-
@entry.content.
|
26
|
+
@entry.content.must_equal("staples come out of the head tomorrow, oh yeah")
|
29
27
|
end
|
30
28
|
end
|
31
29
|
|
32
30
|
describe "#updated" do
|
33
31
|
it "should return a DateTime instance" do
|
34
|
-
@entry.updated.instance_of?(DateTime).
|
32
|
+
@entry.updated.instance_of?(DateTime).must_equal(true)
|
35
33
|
end
|
36
34
|
|
37
35
|
it "should return a DateTime representing the time given in the updated tag" do
|
38
|
-
@entry.updated.strftime("%Y-%m-%dT%I:%M:%S%z").
|
36
|
+
@entry.updated.strftime("%Y-%m-%dT%I:%M:%S%z").must_equal('2011-03-22T02:15:14+0000')
|
39
37
|
end
|
40
38
|
end
|
41
39
|
|
42
40
|
describe "#published" do
|
43
41
|
it "should return a DateTime instance" do
|
44
|
-
@entry.published.instance_of?(DateTime).
|
42
|
+
@entry.published.instance_of?(DateTime).must_equal(true)
|
45
43
|
end
|
46
44
|
|
47
45
|
it "should return a DateTime representing the time given in the published tag" do
|
48
|
-
@entry.published.strftime("%Y-%m-%dT%I:%M:%S%z").
|
46
|
+
@entry.published.strftime("%Y-%m-%dT%I:%M:%S%z").must_equal('2011-02-21T02:15:14+0000')
|
49
47
|
end
|
50
48
|
end
|
51
49
|
|
52
50
|
describe "#id" do
|
53
51
|
it "should return the id given in the id tag" do
|
54
|
-
@entry.id.
|
52
|
+
@entry.id.must_equal('http://identi.ca/notice/64991641')
|
55
53
|
end
|
56
54
|
end
|
57
55
|
|
58
56
|
describe "#info" do
|
59
57
|
it "should give a Hash" do
|
60
|
-
@entry.info.instance_of?(Hash).
|
58
|
+
@entry.info.instance_of?(Hash).must_equal(true)
|
61
59
|
end
|
62
60
|
|
63
61
|
it "should contain the id" do
|
64
|
-
@entry.info[:id].
|
62
|
+
@entry.info[:id].must_equal('http://identi.ca/notice/64991641')
|
65
63
|
end
|
66
64
|
|
67
65
|
it "should contain the content" do
|
68
|
-
@entry.info[:content].
|
66
|
+
@entry.info[:content].must_equal("staples come out of the head tomorrow, oh yeah")
|
69
67
|
end
|
70
68
|
|
71
69
|
it "should contain the title" do
|
72
|
-
@entry.info[:title].
|
70
|
+
@entry.info[:title].must_equal("staples come out of the head tomorrow, oh yeah")
|
73
71
|
end
|
74
72
|
|
75
73
|
it "should contain a Hash for the link" do
|
76
|
-
@entry.info[:link].class.
|
74
|
+
@entry.info[:link].class.must_equal(Hash)
|
77
75
|
end
|
78
76
|
|
79
77
|
it "should contain the published DateTime" do
|
80
|
-
@entry.info[:published].class.
|
81
|
-
@entry.info[:published].strftime("%Y-%m-%dT%I:%M:%S%z").
|
78
|
+
@entry.info[:published].class.must_equal(DateTime)
|
79
|
+
@entry.info[:published].strftime("%Y-%m-%dT%I:%M:%S%z").must_equal('2011-02-21T02:15:14+0000')
|
82
80
|
end
|
83
81
|
|
84
82
|
it "should contain the updated DateTime" do
|
85
|
-
@entry.info[:updated].class.
|
86
|
-
@entry.info[:updated].strftime("%Y-%m-%dT%I:%M:%S%z").
|
83
|
+
@entry.info[:updated].class.must_equal(DateTime)
|
84
|
+
@entry.info[:updated].strftime("%Y-%m-%dT%I:%M:%S%z").must_equal('2011-03-22T02:15:14+0000')
|
87
85
|
end
|
88
86
|
end
|
89
87
|
|
90
88
|
describe "#links" do
|
91
89
|
it "should use OStatus::Link elements" do
|
92
|
-
@entry.links.first.class.
|
90
|
+
@entry.links.first.class.must_equal(OStatus::Link)
|
93
91
|
end
|
94
92
|
end
|
95
93
|
|
96
94
|
describe "#url" do
|
97
95
|
it "should return the alternate link's href attribute" do
|
98
|
-
@entry.url.
|
96
|
+
@entry.url.must_equal("http://identi.ca/notice/64991641")
|
99
97
|
end
|
100
98
|
|
101
99
|
it "should return the alternate link's content if there's no href" do
|
102
|
-
@entry_link_without_href.url.
|
100
|
+
@entry_link_without_href.url.must_equal("http://identi.ca/notice/89057569")
|
103
101
|
end
|
104
102
|
end
|
105
103
|
end
|
data/spec/feed_spec.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
+
require_relative 'helper'
|
1
2
|
require_relative '../lib/ostatus/feed.rb'
|
2
|
-
require_relative '../lib/ostatus/entry.rb'
|
3
3
|
|
4
4
|
describe OStatus::Feed do
|
5
|
-
|
6
5
|
describe "#initialize" do
|
7
6
|
it "should detect a feed URI in an HTML page" do
|
8
7
|
@feed = OStatus::Feed.from_url('test/example_page.html')
|
9
|
-
@feed.url.
|
8
|
+
@feed.url.must_equal 'test/example_feed.atom'
|
10
9
|
end
|
11
10
|
end
|
12
11
|
|
@@ -17,34 +16,28 @@ describe OStatus::Feed do
|
|
17
16
|
|
18
17
|
describe "#atom" do
|
19
18
|
it "should return a String containing the atom information" do
|
20
|
-
@feed.atom.start_with?("<?xml").
|
19
|
+
@feed.atom.start_with?("<?xml").must_equal(true)
|
21
20
|
end
|
22
21
|
end
|
23
22
|
|
24
23
|
describe "#hubs" do
|
25
24
|
it "should return a String containing the hub url given in the link tag" do
|
26
|
-
@feed.hubs.
|
25
|
+
@feed.hubs.must_equal(['http://identi.ca/main/push/hub', 'http://identi.ca/main/push/hub2'])
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
30
29
|
describe "#salmon" do
|
31
30
|
it "should return a String containing the salmon url given in the link tag" do
|
32
|
-
@feed.salmon.
|
31
|
+
@feed.salmon.must_equal('http://identi.ca/main/salmon/user/141464')
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
36
35
|
describe "#entries" do
|
37
36
|
it "should return an Array of Entry instances" do
|
38
37
|
@feed.entries.each do |entry|
|
39
|
-
entry.instance_of?(OStatus::Entry).
|
38
|
+
entry.instance_of?(OStatus::Entry).must_equal(true)
|
40
39
|
end
|
41
40
|
end
|
42
41
|
end
|
43
42
|
end
|
44
|
-
|
45
|
-
describe "#from_url" do
|
46
|
-
it "should be able to sort link elements with unknown MIME types" do
|
47
|
-
@feed = OStatus::Feed.from_url('test/mime_type_bug_feed.atom')
|
48
|
-
end
|
49
|
-
end
|
50
43
|
end
|
data/spec/helper.rb
ADDED
@@ -1,3 +1,4 @@
|
|
1
|
+
require_relative 'helper'
|
1
2
|
require_relative '../lib/ostatus/feed.rb'
|
2
3
|
require_relative '../lib/ostatus/entry.rb'
|
3
4
|
require_relative '../lib/ostatus/activity.rb'
|
@@ -17,141 +18,141 @@ describe OStatus::PortableContacts do
|
|
17
18
|
|
18
19
|
describe "#id" do
|
19
20
|
it "should give a String containing the content of the title tag" do
|
20
|
-
@poco.id.
|
21
|
+
@poco.id.must_equal('foobar')
|
21
22
|
end
|
22
23
|
|
23
24
|
it "should give nil if the id tag does not exist" do
|
24
|
-
@poco_empty.id.
|
25
|
+
@poco_empty.id.must_equal(nil)
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
28
29
|
describe "#display_name" do
|
29
30
|
it "should give a String containing the content of the displayName tag" do
|
30
|
-
@poco.display_name.
|
31
|
+
@poco.display_name.must_equal('Adam Hobaugh')
|
31
32
|
end
|
32
33
|
|
33
34
|
it "should give nil if the displayName tag does not exist" do
|
34
|
-
@poco_empty.display_name.
|
35
|
+
@poco_empty.display_name.must_equal(nil)
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
38
39
|
describe "#name" do
|
39
40
|
it "should give a String containing the content of the name tag" do
|
40
|
-
@poco.name.
|
41
|
+
@poco.name.must_equal('barbaz')
|
41
42
|
end
|
42
43
|
|
43
44
|
it "should give nil if the name tag does not exist" do
|
44
|
-
@poco_empty.name.
|
45
|
+
@poco_empty.name.must_equal(nil)
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
48
49
|
describe "#nickname" do
|
49
50
|
it "should give a String containing the content of the nickname tag" do
|
50
|
-
@poco.nickname.
|
51
|
+
@poco.nickname.must_equal('spaz')
|
51
52
|
end
|
52
53
|
|
53
54
|
it "should give nil if the nickname tag does not exist" do
|
54
|
-
@poco_empty.nickname.
|
55
|
+
@poco_empty.nickname.must_equal(nil)
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
58
59
|
describe "#published" do
|
59
60
|
it "should give a DateTime instance" do
|
60
|
-
@poco.published.class.
|
61
|
+
@poco.published.class.must_equal(DateTime)
|
61
62
|
end
|
62
63
|
|
63
64
|
it "should give a DateTime containing the content of the published tag" do
|
64
|
-
@poco.published.strftime("%Y-%m-%dT%I:%M:%S%z").
|
65
|
+
@poco.published.strftime("%Y-%m-%dT%I:%M:%S%z").must_equal('2012-02-21T02:15:14+0000')
|
65
66
|
end
|
66
67
|
|
67
68
|
it "should give nil if the published tag does not exist" do
|
68
|
-
@poco_empty.published.
|
69
|
+
@poco_empty.published.must_equal(nil)
|
69
70
|
end
|
70
71
|
end
|
71
72
|
|
72
73
|
describe "#updated" do
|
73
74
|
it "should give a DateTime instance" do
|
74
|
-
@poco.updated.class.
|
75
|
+
@poco.updated.class.must_equal(DateTime)
|
75
76
|
end
|
76
77
|
|
77
78
|
it "should give a DateTime containing the content of the updated tag" do
|
78
|
-
@poco.updated.strftime("%Y-%m-%dT%I:%M:%S%z").
|
79
|
+
@poco.updated.strftime("%Y-%m-%dT%I:%M:%S%z").must_equal('2013-02-21T02:15:14+0000')
|
79
80
|
end
|
80
81
|
|
81
82
|
it "should give nil if the updated tag does not exist" do
|
82
|
-
@poco_empty.updated.
|
83
|
+
@poco_empty.updated.must_equal(nil)
|
83
84
|
end
|
84
85
|
end
|
85
86
|
|
86
87
|
describe "#birthday" do
|
87
88
|
it "should give a Date instance" do
|
88
|
-
@poco.birthday.class.
|
89
|
+
@poco.birthday.class.must_equal(Date)
|
89
90
|
end
|
90
91
|
|
91
92
|
it "should give a Date containing the content of the birthday tag" do
|
92
|
-
@poco.birthday.strftime("%Y-%m-%d").
|
93
|
+
@poco.birthday.strftime("%Y-%m-%d").must_equal('2014-02-21')
|
93
94
|
end
|
94
95
|
|
95
96
|
it "should give nil if the birthday tag does not exist" do
|
96
|
-
@poco_empty.birthday.
|
97
|
+
@poco_empty.birthday.must_equal(nil)
|
97
98
|
end
|
98
99
|
end
|
99
100
|
|
100
101
|
describe "#anniversary" do
|
101
102
|
it "should give a Date instance" do
|
102
|
-
@poco.anniversary.class.
|
103
|
+
@poco.anniversary.class.must_equal(Date)
|
103
104
|
end
|
104
105
|
|
105
106
|
it "should give a Date containing the content of the anniversary tag" do
|
106
|
-
@poco.anniversary.strftime("%Y-%m-%d").
|
107
|
+
@poco.anniversary.strftime("%Y-%m-%d").must_equal('2015-02-21')
|
107
108
|
end
|
108
109
|
|
109
110
|
it "should give nil if the anniversary tag does not exist" do
|
110
|
-
@poco_empty.anniversary.
|
111
|
+
@poco_empty.anniversary.must_equal(nil)
|
111
112
|
end
|
112
113
|
end
|
113
114
|
|
114
115
|
describe "#gender" do
|
115
116
|
it "should give a String containing the content of the gender tag" do
|
116
|
-
@poco.gender.
|
117
|
+
@poco.gender.must_equal('male')
|
117
118
|
end
|
118
119
|
|
119
120
|
it "should give nil if the gender tag does not exist" do
|
120
|
-
@poco_empty.gender.
|
121
|
+
@poco_empty.gender.must_equal(nil)
|
121
122
|
end
|
122
123
|
end
|
123
124
|
|
124
125
|
describe "#note" do
|
125
126
|
it "should give a String containing the content of the note tag" do
|
126
|
-
@poco.note.
|
127
|
+
@poco.note.must_equal("foo\nbar")
|
127
128
|
end
|
128
129
|
|
129
130
|
it "should give nil if the note tag does not exist" do
|
130
|
-
@poco_empty.note.
|
131
|
+
@poco_empty.note.must_equal(nil)
|
131
132
|
end
|
132
133
|
end
|
133
134
|
|
134
135
|
describe "#preferred_username" do
|
135
136
|
it "should give a String containing the content of the preferred_username tag" do
|
136
|
-
@poco.preferred_username.
|
137
|
+
@poco.preferred_username.must_equal("greenmanspirit")
|
137
138
|
end
|
138
139
|
|
139
140
|
it "should give nil if the preferred_username tag does not exist" do
|
140
|
-
@poco_empty.preferred_username.
|
141
|
+
@poco_empty.preferred_username.must_equal(nil)
|
141
142
|
end
|
142
143
|
end
|
143
144
|
|
144
145
|
describe "#connected" do
|
145
146
|
it "should give a boolean true when the content of the connected tag is 'true'" do
|
146
|
-
@poco.connected.
|
147
|
+
@poco.connected.must_equal(true)
|
147
148
|
end
|
148
149
|
|
149
150
|
it "should give a boolean false when the content of the connected tag is 'false'" do
|
150
|
-
@poco_false.connected.
|
151
|
+
@poco_false.connected.must_equal(false)
|
151
152
|
end
|
152
153
|
|
153
154
|
it "should give nil if the connected tag does not exist" do
|
154
|
-
@poco_empty.connected.
|
155
|
+
@poco_empty.connected.must_equal(nil)
|
155
156
|
end
|
156
157
|
end
|
157
158
|
end
|
data/spec/salmon_spec.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
require_relative 'helper'
|
1
2
|
require_relative '../lib/ostatus/salmon.rb'
|
2
3
|
|
3
4
|
describe OStatus::Salmon do
|
4
5
|
describe "Salmon.from_xml" do
|
5
6
|
it "returns nil if source is empty string" do
|
6
|
-
OStatus::Salmon.from_xml("").
|
7
|
+
OStatus::Salmon.from_xml("").must_equal(nil)
|
7
8
|
end
|
8
9
|
end
|
9
10
|
end
|
metadata
CHANGED
@@ -1,36 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ostatus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Hackers of the Severed Hand
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-08-05 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: ratom
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
19
|
+
version: 0.8.2
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
26
|
+
version: 0.8.2
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -89,6 +82,7 @@ files:
|
|
89
82
|
- spec/builder_spec.rb
|
90
83
|
- spec/entry_spec.rb
|
91
84
|
- spec/feed_spec.rb
|
85
|
+
- spec/helper.rb
|
92
86
|
- spec/portable_contacts_spec.rb
|
93
87
|
- spec/salmon_spec.rb
|
94
88
|
- test/example_feed.atom
|
@@ -99,27 +93,26 @@ files:
|
|
99
93
|
- test/mime_type_bug_feed.atom
|
100
94
|
homepage: http://github.com/hotsh/ostatus
|
101
95
|
licenses: []
|
96
|
+
metadata: {}
|
102
97
|
post_install_message:
|
103
98
|
rdoc_options: []
|
104
99
|
require_paths:
|
105
100
|
- lib
|
106
101
|
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
102
|
requirements:
|
109
|
-
- -
|
103
|
+
- - '>='
|
110
104
|
- !ruby/object:Gem::Version
|
111
105
|
version: '0'
|
112
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
107
|
requirements:
|
115
|
-
- -
|
108
|
+
- - '>='
|
116
109
|
- !ruby/object:Gem::Version
|
117
110
|
version: '0'
|
118
111
|
requirements: []
|
119
112
|
rubyforge_project: ostatus
|
120
|
-
rubygems_version: 1.
|
113
|
+
rubygems_version: 2.1.11
|
121
114
|
signing_key:
|
122
|
-
specification_version:
|
115
|
+
specification_version: 4
|
123
116
|
summary: Implementations of the OStatus data stream objects.
|
124
117
|
test_files:
|
125
118
|
- spec/activity_spec.rb
|
@@ -127,6 +120,7 @@ test_files:
|
|
127
120
|
- spec/builder_spec.rb
|
128
121
|
- spec/entry_spec.rb
|
129
122
|
- spec/feed_spec.rb
|
123
|
+
- spec/helper.rb
|
130
124
|
- spec/portable_contacts_spec.rb
|
131
125
|
- spec/salmon_spec.rb
|
132
126
|
- test/example_feed.atom
|