ubiquitously 0.0.1.6 → 0.1.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.
- data/README.markdown +224 -19
- data/Rakefile +12 -4
- data/bin/u.me +4 -0
- data/lib/ubiquitously.rb +56 -7
- data/lib/ubiquitously/commands/base.rb +118 -0
- data/lib/ubiquitously/commands/post.rb +108 -0
- data/lib/ubiquitously/commands/user.rb +111 -0
- data/lib/ubiquitously/extensions/callbacks.rb +62 -0
- data/lib/ubiquitously/extensions/core.rb +88 -0
- data/lib/ubiquitously/extensions/mechanize.rb +35 -0
- data/lib/ubiquitously/models/base.rb +18 -0
- data/lib/ubiquitously/models/page.rb +28 -0
- data/lib/ubiquitously/models/post.rb +66 -0
- data/lib/ubiquitously/models/service.rb +1 -0
- data/lib/ubiquitously/models/service/account.rb +57 -0
- data/lib/ubiquitously/models/service/account/authorizable.rb +58 -0
- data/lib/ubiquitously/models/service/account/loggable.rb +50 -0
- data/lib/ubiquitously/models/service/account/restful.rb +21 -0
- data/lib/ubiquitously/models/service/post.rb +59 -0
- data/lib/ubiquitously/models/service/post/loggable.rb +64 -0
- data/lib/ubiquitously/models/service/post/ownable.rb +31 -0
- data/lib/ubiquitously/models/service/post/postable.rb +73 -0
- data/lib/ubiquitously/models/service/post/restful.rb +52 -0
- data/lib/ubiquitously/models/user.rb +128 -0
- data/lib/ubiquitously/services/blogger_den.rb +68 -0
- data/lib/ubiquitously/services/chetzit.rb +37 -0
- data/lib/ubiquitously/services/code_project.rb +21 -0
- data/lib/ubiquitously/services/delicious.rb +54 -0
- data/lib/ubiquitously/services/design_bump.rb +41 -0
- data/lib/ubiquitously/services/designgizer.rb +21 -0
- data/lib/ubiquitously/services/designr_fix.rb +21 -0
- data/lib/ubiquitously/services/digg.rb +151 -0
- data/lib/ubiquitously/services/digzign.rb +25 -0
- data/lib/ubiquitously/services/diigo.rb +68 -0
- data/lib/ubiquitously/services/dzone.rb +132 -0
- data/lib/ubiquitously/services/dzone_snippets.rb +39 -0
- data/lib/ubiquitously/services/facebook.rb +42 -0
- data/lib/ubiquitously/services/faves.rb +81 -0
- data/lib/ubiquitously/services/favshare.rb +78 -0
- data/lib/ubiquitously/services/flikode.rb +38 -0
- data/lib/ubiquitously/services/friendfeed.rb +21 -0
- data/lib/ubiquitously/services/gist.rb +52 -0
- data/lib/ubiquitously/services/google_buzz.rb +15 -0
- data/lib/ubiquitously/services/identica.rb +15 -0
- data/lib/ubiquitously/services/jump_tags.rb +21 -0
- data/lib/ubiquitously/services/kailoon.rb +27 -0
- data/lib/ubiquitously/services/meta_filter.rb +26 -0
- data/lib/ubiquitously/services/mixx.rb +94 -0
- data/lib/ubiquitously/services/mmo.rb +22 -0
- data/lib/ubiquitously/services/mvc_forge.rb +37 -0
- data/lib/ubiquitously/services/my_space.rb +25 -0
- data/lib/ubiquitously/services/nestdev.rb +36 -0
- data/lib/ubiquitously/services/newsvine.rb +76 -0
- data/lib/ubiquitously/services/pixel_groovy.rb +22 -0
- data/lib/ubiquitously/services/posterous.rb +24 -0
- data/lib/ubiquitously/services/programmers_heaven.rb +21 -0
- data/lib/ubiquitously/{propeller.rb → services/propeller.rb} +17 -26
- data/lib/ubiquitously/services/queness.rb +38 -0
- data/lib/ubiquitously/services/reddit.rb +62 -0
- data/lib/ubiquitously/services/scribd.rb +21 -0
- data/lib/ubiquitously/services/script_and_style.rb +23 -0
- data/lib/ubiquitously/services/sharebrain.rb +19 -0
- data/lib/ubiquitously/services/shoutwire.rb +34 -0
- data/lib/ubiquitously/services/slideshare.rb +70 -0
- data/lib/ubiquitously/services/smipple.rb +21 -0
- data/lib/ubiquitously/services/snipplr.rb +67 -0
- data/lib/ubiquitously/services/snipt.rb +49 -0
- data/lib/ubiquitously/services/sphinn.rb +24 -0
- data/lib/ubiquitously/services/stumble_upon.rb +67 -0
- data/lib/ubiquitously/services/stumpedia.rb +13 -0
- data/lib/ubiquitously/services/tumblr.rb +28 -0
- data/lib/ubiquitously/services/tweako.rb +53 -0
- data/lib/ubiquitously/services/twitter.rb +60 -0
- data/lib/ubiquitously/services/web_blend.rb +25 -0
- data/lib/ubiquitously/services/webdev5.rb +32 -0
- data/lib/ubiquitously/services/who_freelance.rb +21 -0
- data/lib/ubiquitously/services/wordtaps.rb +36 -0
- data/lib/ubiquitously/services/yahoo_buzz.rb +64 -0
- data/lib/ubiquitously/services/youblr.rb +15 -0
- data/lib/ubiquitously/services/zabox.rb +22 -0
- data/lib/ubiquitously/support/active_record.rb +25 -0
- data/lib/ubiquitously/support/storage.rb +71 -0
- data/test/config/cookies.yml +111 -0
- data/test/config/credentials.yml +7 -0
- data/test/config/secrets.yml +33 -0
- data/test/config/tokens.yml +30 -0
- data/test/meta.html +19 -0
- data/test/test_delicious.rb +37 -0
- data/test/test_digg.rb +57 -0
- data/test/test_dzone.rb +23 -18
- data/test/test_facebook.rb +40 -0
- data/test/test_faves.rb +18 -20
- data/test/test_helper.rb +8 -1
- data/test/test_newsvine.rb +3 -3
- data/test/test_page.rb +21 -0
- data/test/test_post.rb +55 -0
- data/test/test_propeller.rb +2 -2
- data/test/test_reddit.rb +26 -4
- data/test/test_stumble_upon.rb +23 -3
- data/test/test_twitter.rb +33 -0
- data/test/test_user.rb +22 -0
- metadata +199 -24
- data/lib/ext.rb +0 -37
- data/lib/ubiquitously/base.rb +0 -56
- data/lib/ubiquitously/dzone.rb +0 -111
- data/lib/ubiquitously/faves.rb +0 -43
- data/lib/ubiquitously/mister_wong.rb +0 -11
- data/lib/ubiquitously/mixins/resourceful.rb +0 -50
- data/lib/ubiquitously/mixx.rb +0 -66
- data/lib/ubiquitously/newsvine.rb +0 -54
- data/lib/ubiquitously/reddit.rb +0 -46
- data/lib/ubiquitously/sphinn.rb +0 -11
- data/lib/ubiquitously/stumble_upon.rb +0 -61
- data/test/config.yml +0 -18
@@ -0,0 +1,33 @@
|
|
1
|
+
dzone:
|
2
|
+
key: viatropos
|
3
|
+
secret: "w!sd0m[:227]"
|
4
|
+
reddit:
|
5
|
+
key: viatropos
|
6
|
+
secret: "w!sd0m[:227]"
|
7
|
+
stumble_upon:
|
8
|
+
key: viatropos
|
9
|
+
secret: "tarq1986"
|
10
|
+
faves:
|
11
|
+
key: viatropos
|
12
|
+
secret: tarq1986
|
13
|
+
newsvine:
|
14
|
+
key: viatropos
|
15
|
+
secret: tarq1986
|
16
|
+
propeller:
|
17
|
+
key: viatropos
|
18
|
+
secret: tarq1986
|
19
|
+
delicious:
|
20
|
+
key: viatropos
|
21
|
+
secret: "w!sd0m[:227]"
|
22
|
+
digg:
|
23
|
+
key: viatropos
|
24
|
+
secret: tarq1986
|
25
|
+
diigo:
|
26
|
+
key: viatropos
|
27
|
+
secret: tarq1986
|
28
|
+
facebook:
|
29
|
+
key: "lancejpollard@gmail.com"
|
30
|
+
secret: growandchange
|
31
|
+
twitter:
|
32
|
+
key: viatropos
|
33
|
+
secret: "w!sd0m[:227]"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
connect:
|
2
|
+
twitter:
|
3
|
+
key: "1Vpei1j8mXcleMHxvGO5uQ"
|
4
|
+
secret: "hKPalfQZ2scNQM5pB7D8Q7jCIeTkBftg7HWPt3XElWs"
|
5
|
+
facebook:
|
6
|
+
key: "306987525268"
|
7
|
+
secret: "8fb39aa4fa807aadc37e964061347740"
|
8
|
+
options:
|
9
|
+
scope: "email, offline_access, publish_stream"
|
10
|
+
google:
|
11
|
+
key: "www.accd.org"
|
12
|
+
secret: "DkXmX6bXe4aDEMEVeOfLYrYo"
|
13
|
+
yahoo:
|
14
|
+
key: "dj0yJmk9WVBkZFN1Y1dwZ09zJmQ9WVdrOWRISm5PRkZUTjJVbWNHbzlNVGswTURBNU1UWTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD1mNQ--"
|
15
|
+
secret: "b04421eefc7424da56f5a2c529152c4c7188052c"
|
16
|
+
myspace:
|
17
|
+
key: "d4bf40761fac415b987bc309e91ec3ed"
|
18
|
+
secret: "af9dae46f6554da3828016ecf226ba3953edcd0047954ea9b2a1ca0917d5a943"
|
19
|
+
vimeo:
|
20
|
+
key: "ed7ba91182b0cc3292f3094b0d494aa1"
|
21
|
+
secret: "d21a5453e2a68bb"
|
22
|
+
linked_in:
|
23
|
+
key: "WPJ0TzP4UqaDc5pR2_mvLbu9D61awyKzpBeZ3zHoT9j7XOMdDcQ5uuUIPgXqK4RW"
|
24
|
+
secret: "dFs28hf-XzrSTeJjoJ9eRxdV5XNjmeQEZKwQs398Z48BAzMHhlhcKzP9jFHEF--b"
|
25
|
+
netflix:
|
26
|
+
key: ""
|
27
|
+
secret: ""
|
28
|
+
github:
|
29
|
+
key: "a5a3807f345f5bbb90bb"
|
30
|
+
secret: "42648708d07b2c30df1e89323e6e5a32c971543d"
|
data/test/meta.html
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html dir='ltr' lang='en-US' xmlns:fb='http://www.facebook.com/2008/fbml' xmlns:og='http://opengraphprotocol.org/schema/' xmlns='http://www.w3.org/1999/xhtml'>
|
3
|
+
<head profile='http://gmpg.org/xfn/11'>
|
4
|
+
<!-- meta -->
|
5
|
+
<title>Viatropos</title>
|
6
|
+
<meta content="text/html; charset=UTF-8" name="Content-Type" />
|
7
|
+
<meta content="Creativity and Emergence. A personal blog about writing code that the world can leverage." name="description" />
|
8
|
+
<meta content="jquery, html 5, css3, ajax, ruby-on-rails, ruby-on-rails-developer, ruby-on-rails-examples, rails-deployment, flex, actionscript, flash, open-source" name="keywords" />
|
9
|
+
<meta content="index follow" name="robots" />
|
10
|
+
<meta content="Viatropos - Lance Pollard" name="author" />
|
11
|
+
<meta content="Viatropos | All Rights Reserved" name="copyright" />
|
12
|
+
<meta content="United States" name="country" />
|
13
|
+
<link href='http://i.imgur.com/gpRNG.jpg' rel='image_src' />
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<div class='document' role='document'>
|
17
|
+
</div>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
module Ubiquitously
|
4
|
+
class DeliciousTest < ActiveSupport::TestCase
|
5
|
+
|
6
|
+
context "Delicious::Post" do
|
7
|
+
setup do
|
8
|
+
create_user
|
9
|
+
@post = Ubiquitously::Delicious::Post.new(
|
10
|
+
:user => @user,
|
11
|
+
:url => "http://github.com",
|
12
|
+
:title => "Github",
|
13
|
+
:description => "Place to host your code",
|
14
|
+
:tags => ["code", "git"]
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
should "find all delicious posts" do
|
19
|
+
puts @post.save.inspect
|
20
|
+
assert true
|
21
|
+
end
|
22
|
+
=begin
|
23
|
+
should "create a post" do
|
24
|
+
# http://www.Delicious.com/links/buttons.jsp
|
25
|
+
assert Ubiquitously::Delicious::Post.create(
|
26
|
+
:debug => true,
|
27
|
+
:title => "A Title",
|
28
|
+
:description => "A Description",
|
29
|
+
:tags => ["usability", "ruby", "web services", "open source"],
|
30
|
+
:url => "http://example.com/abcdef",
|
31
|
+
:user => Ubiquitously::Delicious::Account.new
|
32
|
+
)
|
33
|
+
end
|
34
|
+
=end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/test/test_digg.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
module Ubiquitously
|
4
|
+
class DiggTest < ActiveSupport::TestCase
|
5
|
+
=begin
|
6
|
+
context "Digg::Account" do
|
7
|
+
setup do
|
8
|
+
@user = Ubiquitously::Digg::Account.new
|
9
|
+
end
|
10
|
+
|
11
|
+
context "login" do
|
12
|
+
should "raise informative error if invalid password" do
|
13
|
+
@user.password = "bad password"
|
14
|
+
assert_raises(Ubiquitously::AuthenticationError) do
|
15
|
+
@user.login
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
should "login successfully if valid credentials" do
|
20
|
+
assert_equal true, @user.login
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
=end
|
25
|
+
context "Digg::Post" do
|
26
|
+
setup do
|
27
|
+
@user = Ubiquitously::User.new(
|
28
|
+
:username => "viatropos",
|
29
|
+
:cookies_path => "test/cookies.yml"
|
30
|
+
)
|
31
|
+
|
32
|
+
@title = "Viatropos"
|
33
|
+
@description = "Creativity and Emergence. A personal blog about writing code that the world can leverage."
|
34
|
+
@tags = %w(jquery html-5 css3 ajax ruby-on-rails ruby-on-rails-developer ruby-on-rails-examples rails-deployment flex actionscript flash open-source)
|
35
|
+
|
36
|
+
@post = Ubiquitously::Post.new(
|
37
|
+
:url => "./test/meta.html",
|
38
|
+
:title => @title,
|
39
|
+
:description => @description,
|
40
|
+
:tags => @tags,
|
41
|
+
:user => @user
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
should "find pre-existent post on digg" do
|
46
|
+
@post.url = "http://google.com"
|
47
|
+
result = @post.new_record?(:digg)
|
48
|
+
assert result
|
49
|
+
end
|
50
|
+
|
51
|
+
should "create a post" do
|
52
|
+
@post.url = "http://apple.com"
|
53
|
+
assert @post.save(:digg)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/test/test_dzone.rb
CHANGED
@@ -2,9 +2,10 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
2
2
|
|
3
3
|
module Ubiquitously
|
4
4
|
class DzoneTest < ActiveSupport::TestCase
|
5
|
-
|
5
|
+
=begin
|
6
|
+
context "Dzone::Account" do
|
6
7
|
setup do
|
7
|
-
@user = Ubiquitously::Dzone::
|
8
|
+
@user = Ubiquitously::Dzone::Account.new
|
8
9
|
end
|
9
10
|
|
10
11
|
context "login" do
|
@@ -16,27 +17,31 @@ module Ubiquitously
|
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
19
|
-
|
20
|
+
=end
|
20
21
|
context "Dzone::Post" do
|
21
22
|
setup do
|
22
|
-
@
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
@user = Ubiquitously::User.new(
|
24
|
+
:username => "viatropos",
|
25
|
+
:cookies_path => "test/cookies.yml"
|
26
|
+
)
|
27
|
+
|
28
|
+
@title = "Using Redis on Heroku"
|
29
|
+
@description = "The only javascript framework you'll need. Well, if you need Object Oriented JS, you'll have to do a little initial setup."
|
30
|
+
@tags = %w(javascript, frameworks, jquery)
|
31
|
+
|
32
|
+
@post = Ubiquitously::Post.new(
|
33
|
+
:url => "./test/meta.html",
|
34
|
+
:title => @title,
|
35
|
+
:description => @description,
|
36
|
+
:tags => @tags,
|
37
|
+
:categories => ["web-design"],
|
38
|
+
:user => @user
|
39
|
+
)
|
29
40
|
end
|
30
41
|
|
31
42
|
should "create a post" do
|
32
|
-
|
33
|
-
assert
|
34
|
-
:debug => true,
|
35
|
-
:title => "A Title",
|
36
|
-
:description => "A Description",
|
37
|
-
:tags => ["usability", "ruby", "web services", "open source"],
|
38
|
-
:url => "http://example.com/abcdef"
|
39
|
-
)
|
43
|
+
@post.url = "http://www.zhione.com/security/understanding-network-security-in-plain-english/"
|
44
|
+
assert @post.save(:dzone)
|
40
45
|
end
|
41
46
|
end
|
42
47
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
module Ubiquitously
|
4
|
+
class FacebookTest < ActiveSupport::TestCase
|
5
|
+
context "Facebook::Account" do
|
6
|
+
setup do
|
7
|
+
create_user(:storage => "test/config")
|
8
|
+
end
|
9
|
+
|
10
|
+
context "login" do
|
11
|
+
should "login successfully if valid credentials" do
|
12
|
+
assert_equal true, @user.login(:facebook)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "Facebook::Post" do
|
18
|
+
setup do
|
19
|
+
create_user(:storage => "test/config")
|
20
|
+
|
21
|
+
@title = "Viatropos"
|
22
|
+
@description = "Facebook posting ubiquitously"
|
23
|
+
@tags = %w(ubiquitous)
|
24
|
+
|
25
|
+
@post = Ubiquitously::Post.new(
|
26
|
+
:url => "./test/meta.html",
|
27
|
+
:title => @title,
|
28
|
+
:description => @description,
|
29
|
+
:tags => @tags,
|
30
|
+
:user => @user
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
should "create a post" do
|
35
|
+
assert @post.save(:facebook)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
data/test/test_faves.rb
CHANGED
@@ -1,42 +1,40 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
-
|
2
|
+
|
3
3
|
module Ubiquitously
|
4
4
|
class FavesTest < ActiveSupport::TestCase
|
5
|
-
context "Faves::
|
5
|
+
context "Faves::Account" do
|
6
6
|
setup do
|
7
|
-
|
7
|
+
create_user(:storage => "test/config")
|
8
8
|
end
|
9
9
|
|
10
10
|
context "login" do
|
11
|
-
should "raise informative error if invalid password" do
|
12
|
-
@user.password = "bad password"
|
13
|
-
assert_raises(Ubiquitously::AuthenticationError) do
|
14
|
-
@user.login
|
15
|
-
end
|
16
|
-
end
|
17
11
|
|
18
12
|
should "login successfully if valid credentials" do
|
19
|
-
assert_equal true, @user.login
|
13
|
+
assert_equal true, @user.login(:faves)
|
20
14
|
end
|
21
15
|
end
|
22
16
|
end
|
23
|
-
=begin
|
24
17
|
context "Faves::Post" do
|
25
18
|
setup do
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
19
|
+
create_user(:storage => "test/config")
|
20
|
+
|
21
|
+
@title = "Viatropos"
|
22
|
+
@description = "Mechanically logging in"
|
23
|
+
@tags = %w(ubiquitous)
|
24
|
+
|
25
|
+
@post = Ubiquitously::Post.new(
|
26
|
+
:url => "http://twitter.com/",
|
27
|
+
:title => @title,
|
28
|
+
:description => @description,
|
29
|
+
:tags => @tags,
|
30
|
+
:user => @user
|
33
31
|
)
|
34
32
|
end
|
35
33
|
|
36
34
|
should "create a post" do
|
37
|
-
assert @post.save
|
35
|
+
assert @post.save(:faves)
|
38
36
|
end
|
39
37
|
end
|
40
|
-
|
38
|
+
|
41
39
|
end
|
42
40
|
end
|
data/test/test_helper.rb
CHANGED
@@ -10,4 +10,11 @@ require 'rr'
|
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/../lib/ubiquitously'
|
12
12
|
|
13
|
-
Ubiquitously.configure("test/config.yml")
|
13
|
+
Ubiquitously.configure("test/config/secrets.yml")
|
14
|
+
Passport.configure("test/config/tokens.yml")
|
15
|
+
|
16
|
+
ActiveSupport::TestCase.class_eval do
|
17
|
+
def create_user(options)
|
18
|
+
@user = Ubiquitously::User.new(options.merge(:username => "viatropos"))
|
19
|
+
end
|
20
|
+
end
|
data/test/test_newsvine.rb
CHANGED
@@ -2,9 +2,9 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
2
2
|
|
3
3
|
module Ubiquitously
|
4
4
|
class NewsvineTest < ActiveSupport::TestCase
|
5
|
-
context "Newsvine::
|
5
|
+
context "Newsvine::Account" do
|
6
6
|
setup do
|
7
|
-
@user = Ubiquitously::Newsvine::
|
7
|
+
@user = Ubiquitously::Newsvine::Account.new
|
8
8
|
end
|
9
9
|
|
10
10
|
context "login" do
|
@@ -30,7 +30,7 @@ module Ubiquitously
|
|
30
30
|
:description => "A Description",
|
31
31
|
:tags => ["usability", "ruby", "web services", "open source"],
|
32
32
|
:url => "http://example.com/abcdef",
|
33
|
-
:user => Ubiquitously::Newsvine::
|
33
|
+
:user => Ubiquitously::Newsvine::Account.new
|
34
34
|
)
|
35
35
|
end
|
36
36
|
|
data/test/test_page.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
module Ubiquitously
|
4
|
+
class PageTest < ActiveSupport::TestCase
|
5
|
+
context "Page" do
|
6
|
+
setup do
|
7
|
+
@page = Ubiquitously::Page.new(:url => "./test/meta.html")
|
8
|
+
@title = "Viatropos"
|
9
|
+
@description = "Creativity and Emergence. A personal blog about writing code that the world can leverage."
|
10
|
+
@tags = %w(jquery html-5 css3 ajax ruby-on-rails ruby-on-rails-developer ruby-on-rails-examples rails-deployment flex actionscript flash open-source)
|
11
|
+
end
|
12
|
+
|
13
|
+
should "parse the page" do
|
14
|
+
@page.parse
|
15
|
+
assert_equal @title, @page.title
|
16
|
+
assert_equal @description, @page.description
|
17
|
+
assert_equal @tags, @page.tags
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/test/test_post.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
module Ubiquitously
|
4
|
+
class PostTest < ActiveSupport::TestCase
|
5
|
+
context "Post" do
|
6
|
+
setup do
|
7
|
+
@user = Ubiquitously::User.new(
|
8
|
+
:username => "viatropos",
|
9
|
+
:cookies_path => "test/cookies.yml"
|
10
|
+
)
|
11
|
+
|
12
|
+
@title = "Viatropos"
|
13
|
+
@description = "Creativity and Emergence. A personal blog about writing code that the world can leverage."
|
14
|
+
@tags = %w(jquery html-5 css3 ajax ruby-on-rails ruby-on-rails-developer ruby-on-rails-examples rails-deployment flex actionscript flash open-source)
|
15
|
+
|
16
|
+
@post = Ubiquitously::Post.new(
|
17
|
+
:url => "./test/meta.html",
|
18
|
+
:title => @title,
|
19
|
+
:description => @description,
|
20
|
+
:tags => @tags,
|
21
|
+
:user => @user
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
should "parse the page" do
|
26
|
+
@page = @post.page
|
27
|
+
assert_equal @title, @page.title
|
28
|
+
assert_equal @description, @page.description
|
29
|
+
assert_equal @tags, @page.tags
|
30
|
+
end
|
31
|
+
|
32
|
+
should "respond to dynamic methods" do
|
33
|
+
assert_equal true, @post.respond_to?(:dzone?)
|
34
|
+
assert_equal true, @post.respond_to?(:digg?)
|
35
|
+
end
|
36
|
+
|
37
|
+
should "dynamically create post service objects" do
|
38
|
+
assert_kind_of Ubiquitously::Dzone::Post, @post.dzone
|
39
|
+
assert_equal true, @post.dzone.new_record?
|
40
|
+
assert_equal false, @post.dzone? # it's a new record
|
41
|
+
end
|
42
|
+
|
43
|
+
should "be able to create the post" do
|
44
|
+
@post.faves.save(:debug => true)
|
45
|
+
assert @post.faves.valid?
|
46
|
+
end
|
47
|
+
|
48
|
+
should "be able to find posts" do
|
49
|
+
result = @post.faves.find
|
50
|
+
assert result
|
51
|
+
assert @post.faves.new_record?
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|