social_stream 0.28.4 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -1
- data/.travis.yml +0 -2
- data/Gemfile +3 -0
- data/base/app/controllers/activities_controller.rb +14 -12
- data/base/app/controllers/api_controller.rb +0 -13
- data/base/app/controllers/frontpage_controller.rb +0 -6
- data/base/app/models/activity.rb +21 -61
- data/base/app/models/actor.rb +4 -8
- data/base/app/models/audience.rb +2 -0
- data/base/app/models/comment.rb +2 -1
- data/base/app/models/group.rb +0 -2
- data/base/app/models/relation/custom.rb +17 -4
- data/base/app/models/relation.rb +5 -1
- data/base/app/models/tie.rb +0 -2
- data/base/app/models/user.rb +0 -2
- data/base/app/views/activities/_options.html.erb +1 -1
- data/base/app/views/activities/index.atom.builder +48 -0
- data/base/app/views/activity_objects/_activity_object.atom.erb +1 -0
- data/base/config/locales/en.yml +8 -0
- data/base/config/locales/es.yml +8 -0
- data/base/config/routes.rb +0 -8
- data/base/lib/rails/social_stream.rb +1 -1
- data/base/lib/social_stream/ability/base.rb +4 -16
- data/base/lib/social_stream/activity_streams/subtype.rb +11 -0
- data/base/lib/social_stream/activity_streams/supertype.rb +12 -0
- data/base/lib/social_stream/activity_streams.rb +39 -0
- data/base/lib/social_stream/base/dependencies.rb +2 -0
- data/base/lib/social_stream/base/engine.rb +6 -0
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/lib/social_stream/models/object.rb +5 -0
- data/base/lib/social_stream/models/subject.rb +1 -1
- data/base/lib/social_stream/models/subtype.rb +2 -0
- data/base/lib/social_stream/models/supertype.rb +2 -0
- data/base/lib/social_stream-base.rb +5 -0
- data/base/social_stream-base.gemspec +2 -0
- data/base/spec/controllers/activities_controller_spec.rb +18 -0
- data/base/spec/controllers/frontpage_controller_spec.rb +0 -5
- data/base/spec/models/activity_wall_spec.rb +96 -0
- data/base/spec/models/post_authorization_spec.rb +370 -0
- data/base/spec/models/post_spec.rb +0 -2
- data/base/spec/models/relation_spec.rb +22 -0
- data/base/spec/social_stream_activity_streams_spec.rb +16 -0
- data/base/spec/social_stream_spec.rb +1 -1
- data/documents/app/views/common_documents/_document_info.html.erb +2 -2
- data/documents/app/views/common_documents/_index.html.erb +2 -2
- data/documents/lib/social_stream/documents/engine.rb +7 -0
- data/documents/lib/social_stream/documents/version.rb +1 -1
- data/documents/social_stream-documents.gemspec +1 -1
- data/events/app/decorators/social_stream/base/actor_decorator.rb +3 -0
- data/events/app/decorators/social_stream/base/document_decorator.rb +3 -0
- data/events/lib/social_stream/events/engine.rb +2 -10
- data/events/lib/social_stream/events/version.rb +1 -1
- data/events/social_stream-events.gemspec +1 -1
- data/lib/generators/social_stream/install_generator.rb +1 -0
- data/lib/social_stream/version.rb +1 -1
- data/lib/social_stream.rb +7 -6
- data/linkser/lib/social_stream/linkser/engine.rb +3 -0
- data/linkser/lib/social_stream/linkser/version.rb +1 -1
- data/linkser/social_stream-linkser.gemspec +1 -1
- data/ostatus/Gemfile +3 -0
- data/ostatus/MIT-LICENSE +20 -0
- data/ostatus/README.rdoc +26 -0
- data/ostatus/Rakefile +26 -0
- data/{base → ostatus}/app/assets/images/logos/actor/remote_subject.png +0 -0
- data/ostatus/app/assets/images/logos/contact/remote_subject.png +0 -0
- data/ostatus/app/assets/images/logos/original/remote_subject.png +0 -0
- data/ostatus/app/assets/images/logos/profile/remote_subject.png +0 -0
- data/ostatus/app/controllers/host_meta_controller.rb +9 -0
- data/ostatus/app/controllers/pshb_controller.rb +26 -0
- data/ostatus/app/controllers/remote_subjects_controller.rb +19 -0
- data/ostatus/app/controllers/salmon_controller.rb +15 -0
- data/ostatus/app/controllers/subjects_controller.rb +5 -0
- data/ostatus/app/controllers/webfinger_controller.rb +24 -0
- data/ostatus/app/decorators/social_stream/base/activity_decorator.rb +3 -0
- data/ostatus/app/decorators/social_stream/base/actor_decorator.rb +3 -0
- data/ostatus/app/decorators/social_stream/base/audience_decorator.rb +3 -0
- data/ostatus/app/decorators/social_stream/base/relation/custom_decorator.rb +3 -0
- data/ostatus/app/decorators/social_stream/base/tie_decorator.rb +3 -0
- data/ostatus/app/models/actor_key.rb +30 -0
- data/ostatus/app/models/remote_subject.rb +139 -0
- data/ostatus/app/views/remote_subjects/_show.html.erb +6 -0
- data/ostatus/app/views/remote_subjects/show.html.erb +5 -0
- data/ostatus/config/locales/en.yml +34 -0
- data/ostatus/config/routes.rb +13 -0
- data/ostatus/db/migrate/20120905145030_create_social_stream_ostatus.rb +20 -0
- data/ostatus/db/migrate/20120918194708_create_actor_keys.rb +18 -0
- data/ostatus/lib/generators/social_stream/ostatus/install_generator.rb +16 -0
- data/ostatus/lib/generators/social_stream/ostatus/templates/initializer.rb +18 -0
- data/ostatus/lib/social_stream/migrations/ostatus.rb +9 -0
- data/ostatus/lib/social_stream/ostatus/activity_streams.rb +79 -0
- data/ostatus/lib/social_stream/ostatus/controllers/debug_requests.rb +24 -0
- data/ostatus/lib/social_stream/ostatus/engine.rb +21 -0
- data/ostatus/lib/social_stream/ostatus/models/activity.rb +41 -0
- data/ostatus/lib/social_stream/ostatus/models/actor.rb +89 -0
- data/ostatus/lib/social_stream/ostatus/models/audience.rb +19 -0
- data/ostatus/lib/social_stream/ostatus/models/object.rb +28 -0
- data/ostatus/lib/social_stream/ostatus/models/relation/custom.rb +22 -0
- data/ostatus/lib/social_stream/ostatus/models/tie.rb +24 -0
- data/ostatus/lib/social_stream/ostatus/version.rb +5 -0
- data/ostatus/lib/social_stream-ostatus.rb +54 -0
- data/ostatus/social_stream-ostatus.gemspec +28 -0
- data/ostatus/spec/controllers/host_meta_controller_spec.rb +10 -0
- data/ostatus/spec/controllers/remote_subjects_controller_spec.rb +37 -0
- data/ostatus/spec/controllers/webfinger_controller_spec.rb +13 -0
- data/ostatus/spec/dummy/Rakefile +7 -0
- data/ostatus/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/ostatus/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/ostatus/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/ostatus/spec/dummy/config/application.rb +45 -0
- data/ostatus/spec/dummy/config/boot.rb +10 -0
- data/ostatus/spec/dummy/config/database.yml +22 -0
- data/ostatus/spec/dummy/config/environment.rb +5 -0
- data/ostatus/spec/dummy/config/environments/development.rb +26 -0
- data/ostatus/spec/dummy/config/environments/production.rb +49 -0
- data/ostatus/spec/dummy/config/environments/test.rb +35 -0
- data/ostatus/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/ostatus/spec/dummy/config/initializers/inflections.rb +10 -0
- data/ostatus/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/ostatus/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/ostatus/spec/dummy/config/initializers/session_store.rb +8 -0
- data/ostatus/spec/dummy/config/locales/en.yml +5 -0
- data/ostatus/spec/dummy/config/routes.rb +58 -0
- data/ostatus/spec/dummy/config.ru +4 -0
- data/ostatus/spec/dummy/public/404.html +26 -0
- data/ostatus/spec/dummy/public/422.html +26 -0
- data/ostatus/spec/dummy/public/500.html +26 -0
- data/ostatus/spec/dummy/public/favicon.ico +0 -0
- data/ostatus/spec/dummy/public/javascripts/application.js +2 -0
- data/ostatus/spec/dummy/public/javascripts/controls.js +965 -0
- data/ostatus/spec/dummy/public/javascripts/dragdrop.js +974 -0
- data/ostatus/spec/dummy/public/javascripts/effects.js +1123 -0
- data/ostatus/spec/dummy/public/javascripts/prototype.js +6001 -0
- data/ostatus/spec/dummy/public/javascripts/rails.js +191 -0
- data/ostatus/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/ostatus/spec/dummy/script/rails +6 -0
- data/ostatus/spec/factories/remote_subject.rb +39 -0
- data/ostatus/spec/integration/navigation_spec.rb +9 -0
- data/ostatus/spec/models/actor_key_spec.rb +9 -0
- data/ostatus/spec/models/post_spec.rb +25 -0
- data/ostatus/spec/models/remote_subject_spec.rb +24 -0
- data/ostatus/spec/social_stream_ostatus.spec.rb +9 -0
- data/ostatus/spec/social_stream_ostatus_activity_streams.spec.rb +31 -0
- data/ostatus/spec/spec_helper.rb +33 -0
- data/presence/app/decorators/social_stream/base/models/group_decorator.rb +3 -0
- data/presence/app/decorators/social_stream/base/models/tie_decorator.rb +3 -0
- data/presence/lib/generators/social_stream/presence/install_generator.rb +1 -1
- data/presence/lib/social_stream/presence/engine.rb +0 -12
- data/presence/lib/social_stream/presence/version.rb +1 -1
- data/presence/social_stream-presence.gemspec +1 -1
- data/social_stream.gemspec +6 -5
- data/spec/support/db.rb +1 -1
- metadata +125 -18
- data/base/app/assets/images/logos/actor/remote_user.png +0 -0
- data/base/app/controllers/subjects_controller.rb +0 -7
- data/base/app/views/api/activity_atom_feed.atom.builder +0 -40
- data/base/app/views/frontpage/host_meta.xml.builder +0 -11
- data/base/spec/models/activity_authorization_spec.rb +0 -354
@@ -0,0 +1,21 @@
|
|
1
|
+
module SocialStream
|
2
|
+
module Ostatus
|
3
|
+
class Engine < Rails::Engine
|
4
|
+
initializer 'social_stream-ostatus.activity_streams' do
|
5
|
+
SocialStream::ActivityStreams.class_eval do
|
6
|
+
extend SocialStream::Ostatus::ActivityStreams
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
initializer 'social_stream-ostatus.models.object' do
|
11
|
+
SocialStream::Models::Object::ClassMethods.module_eval do
|
12
|
+
include SocialStream::Ostatus::Models::Object::ClassMethods
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
initializer "social_stream-ostatus.remote_subject_in_social_stream_subjects" do
|
17
|
+
SocialStream.subjects << :remote_subject unless SocialStream.subjects.include?(:remote_subject)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module SocialStream
|
2
|
+
module Ostatus
|
3
|
+
module Models
|
4
|
+
module Activity
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
after_commit :send_salmon
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
# Send Salmon notification to remote subject
|
14
|
+
def send_salmon
|
15
|
+
return if sender.subject_type == "RemoteSubject" ||
|
16
|
+
receiver.subject_type != "RemoteSubject"
|
17
|
+
|
18
|
+
entry =
|
19
|
+
Proudhon::Entry.new id: "tag:#{ SocialStream::Ostatus.activity_feed_host },2005:activity-#{ id }",
|
20
|
+
title: stream_title,
|
21
|
+
content: stream_content,
|
22
|
+
verb: SocialStream::ActivityStreams.verb(verb),
|
23
|
+
author: Proudhon::Author.new(name: sender.name,
|
24
|
+
uri: sender.webfinger_uri)
|
25
|
+
salmon = entry.to_salmon
|
26
|
+
|
27
|
+
if SocialStream::Ostatus.debug_requests
|
28
|
+
logger.info entry.to_xml
|
29
|
+
end
|
30
|
+
|
31
|
+
# FIXME: Rails 4 queues
|
32
|
+
Thread.new do
|
33
|
+
salmon.deliver receiver_subject.salmon_url, sender.rsa_key
|
34
|
+
|
35
|
+
ActiveRecord::Base.connection.close
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require "net/http"
|
2
|
+
require "uri"
|
3
|
+
|
4
|
+
module SocialStream
|
5
|
+
module Ostatus
|
6
|
+
module Models
|
7
|
+
module Actor
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
include Rails.application.routes.url_helpers
|
11
|
+
|
12
|
+
included do
|
13
|
+
has_one :actor_key, dependent: :destroy,
|
14
|
+
validate: true,
|
15
|
+
autosave: true
|
16
|
+
|
17
|
+
after_commit :publish_feed
|
18
|
+
end
|
19
|
+
|
20
|
+
module ClassMethods
|
21
|
+
# Extract the slug from the webfinger id and return the actor
|
22
|
+
# searching by that slug
|
23
|
+
def find_by_webfinger!(link)
|
24
|
+
link =~ /(acct:)?(.*)@/
|
25
|
+
|
26
|
+
find_by_slug! $2
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# The Webfinger ID for this {Actor}
|
31
|
+
def webfinger_id
|
32
|
+
"#{ slug }@#{ SocialStream::Ostatus.activity_feed_host }"
|
33
|
+
end
|
34
|
+
|
35
|
+
# The Webfinger URI for this {Actor}
|
36
|
+
def webfinger_uri
|
37
|
+
"acct:#{ webfinger_id }"
|
38
|
+
end
|
39
|
+
|
40
|
+
# Fetch or create the associated {ActorKey}
|
41
|
+
def actor_key!
|
42
|
+
actor_key ||
|
43
|
+
create_actor_key!
|
44
|
+
end
|
45
|
+
|
46
|
+
# OpenSSL::PKey::RSA key
|
47
|
+
#
|
48
|
+
# The key is generated if it does not exist
|
49
|
+
def rsa_key
|
50
|
+
actor_key!.key
|
51
|
+
end
|
52
|
+
|
53
|
+
# Set OpenSSL::PKey::RSA key
|
54
|
+
def rsa_key= key
|
55
|
+
k = actor_key || build_actor_key
|
56
|
+
k.key = key
|
57
|
+
end
|
58
|
+
|
59
|
+
# Public RSA instance of {#rsa_key}
|
60
|
+
def rsa_public_key
|
61
|
+
rsa_key.public_key
|
62
|
+
end
|
63
|
+
|
64
|
+
# MagicKey string from public key
|
65
|
+
def magic_public_key
|
66
|
+
Proudhon::MagicKey.to_s rsa_public_key
|
67
|
+
end
|
68
|
+
|
69
|
+
def publish_feed
|
70
|
+
return if subject_type == "RemoteSubject"
|
71
|
+
|
72
|
+
# FIXME: Rails 4 queues
|
73
|
+
Thread.new do
|
74
|
+
uri = URI.parse(SocialStream::Ostatus.hub)
|
75
|
+
topic = polymorphic_url [subject, :activities],
|
76
|
+
:format => :atom,
|
77
|
+
:host => SocialStream::Ostatus.activity_feed_host
|
78
|
+
|
79
|
+
response = Net::HTTP::post_form uri, { 'hub.mode' => 'publish',
|
80
|
+
'hub.url' => topic }
|
81
|
+
#TODO: process 4XX look at: response.status
|
82
|
+
|
83
|
+
ActiveRecord::Base.connection.close
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module SocialStream
|
2
|
+
module Ostatus
|
3
|
+
module Models
|
4
|
+
module Audience
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
after_create :update_feed_to_hub
|
9
|
+
end
|
10
|
+
|
11
|
+
def update_feed_to_hub
|
12
|
+
if relation.is_a?(::Relation::Public)
|
13
|
+
activity.owner.publish_feed
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module SocialStream
|
2
|
+
module Ostatus
|
3
|
+
module Models
|
4
|
+
module Object
|
5
|
+
module ClassMethods
|
6
|
+
# Creates an new instance from ActivityStreams entry
|
7
|
+
#
|
8
|
+
def from_entry! entry, receiver
|
9
|
+
create! do |obj|
|
10
|
+
obj.author =
|
11
|
+
obj.user_author =
|
12
|
+
SocialStream::ActivityStreams.actor_from_entry!(entry)
|
13
|
+
|
14
|
+
obj.owner = receiver || obj.author
|
15
|
+
|
16
|
+
obj.title = entry.title
|
17
|
+
obj.description = entry.summary || entry.content
|
18
|
+
|
19
|
+
obj.relation_ids = [ ::Relation::Public.instance.id ]
|
20
|
+
|
21
|
+
yield obj if block_given?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module SocialStream
|
2
|
+
module Ostatus
|
3
|
+
module Models
|
4
|
+
module Relation
|
5
|
+
module Custom
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
const_get("DEFAULT")['remote_subject'] = {
|
10
|
+
'default' => {
|
11
|
+
'name' => 'default',
|
12
|
+
'permissions' => [
|
13
|
+
[ 'read', 'activity' ]
|
14
|
+
]
|
15
|
+
}
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module SocialStream
|
2
|
+
module Ostatus
|
3
|
+
module Models
|
4
|
+
module Tie
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
# Create a new {Tie} from OStatus entry
|
9
|
+
def from_entry! entry, receiver
|
10
|
+
# Sender must be remote
|
11
|
+
sender = RemoteSubject.find_or_create_by_webfinger_uri! entry.author.uri
|
12
|
+
|
13
|
+
contact = sender.contact_to!(receiver)
|
14
|
+
|
15
|
+
# FIXME: hack
|
16
|
+
contact.user_author = sender
|
17
|
+
|
18
|
+
contact.relation_ids = [::Relation::Public.instance.id]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'social_stream-base'
|
2
|
+
|
3
|
+
# Ruby implementation of OStatus
|
4
|
+
require 'proudhon'
|
5
|
+
|
6
|
+
module SocialStream
|
7
|
+
module Ostatus
|
8
|
+
# PuSH hub
|
9
|
+
mattr_accessor :hub
|
10
|
+
# Default to the PubSubHubbub reference Hub server
|
11
|
+
@@hub = 'http://pubsubhubbub.appspot.com'
|
12
|
+
|
13
|
+
# The host where the hub should take the activity feed from
|
14
|
+
mattr_accessor :activity_feed_host
|
15
|
+
@@activity_feed_host = 'localhost:3000'
|
16
|
+
|
17
|
+
# The host where the PuSH should send the callbacks to
|
18
|
+
mattr_accessor :pshb_host
|
19
|
+
@@pshb_host = 'localhost:3000'
|
20
|
+
|
21
|
+
# Debug OStatus request with logger.info
|
22
|
+
mattr_accessor :debug_requests
|
23
|
+
@@debug_requests = false
|
24
|
+
|
25
|
+
class << self
|
26
|
+
def setup
|
27
|
+
yield self
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
autoload :ActivityStreams, 'social_stream/ostatus/activity_streams'
|
32
|
+
|
33
|
+
module Models
|
34
|
+
autoload :Activity, 'social_stream/ostatus/models/activity'
|
35
|
+
autoload :Actor, 'social_stream/ostatus/models/actor'
|
36
|
+
autoload :Audience, 'social_stream/ostatus/models/audience'
|
37
|
+
autoload :Tie, 'social_stream/ostatus/models/tie'
|
38
|
+
|
39
|
+
module Object
|
40
|
+
autoload :ClassMethods, 'social_stream/ostatus/models/object'
|
41
|
+
end
|
42
|
+
|
43
|
+
module Relation
|
44
|
+
autoload :Custom, 'social_stream/ostatus/models/relation/custom'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
module Controllers
|
49
|
+
autoload :DebugRequests, 'social_stream/ostatus/controllers/debug_requests'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
require 'social_stream/ostatus/engine'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding UTF-8
|
2
|
+
require File.join(File.dirname(__FILE__), 'lib', 'social_stream', 'ostatus', 'version')
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "social_stream-ostatus"
|
6
|
+
s.version = SocialStream::Ostatus::VERSION.dup
|
7
|
+
s.authors = ["Antonio Tapiador", "GING - DIT - UPM"]
|
8
|
+
s.summary = "Provides a Social Stream node with social network federation support via OStatus protocol"
|
9
|
+
s.description = "This gem allow you to connect several social stream nodes using PSHB hubs, also allows to follow, and share streams with social stream users in any node."
|
10
|
+
s.email = "social-stream@dit.upm.es"
|
11
|
+
s.homepage = "http://social-stream.dit.upm.es"
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
|
14
|
+
# Gem dependencies
|
15
|
+
s.add_runtime_dependency('social_stream-base', '~> 0.23.0')
|
16
|
+
s.add_runtime_dependency('proudhon','>= 0.3.5')
|
17
|
+
s.add_runtime_dependency('nokogiri','> 1.4.4')
|
18
|
+
|
19
|
+
# Development Gem dependencies
|
20
|
+
s.add_development_dependency('sqlite3-ruby')
|
21
|
+
if RUBY_VERSION < '1.9'
|
22
|
+
s.add_development_dependency('ruby-debug')
|
23
|
+
end
|
24
|
+
s.add_development_dependency('rspec-rails')
|
25
|
+
s.add_development_dependency('factory_girl')
|
26
|
+
s.add_development_dependency('forgery')
|
27
|
+
s.add_development_dependency('capybara')
|
28
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RemoteSubjectsController do
|
4
|
+
render_views
|
5
|
+
|
6
|
+
context "with remote subject" do
|
7
|
+
before do
|
8
|
+
@remote_subject = Factory(:remote_subject)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should redirect index to show" do
|
12
|
+
get :index, q: @remote_subject.webfinger_id
|
13
|
+
|
14
|
+
response.should redirect_to(@remote_subject)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should render show" do
|
18
|
+
get :show, id: @remote_subject.slug
|
19
|
+
|
20
|
+
response.should be_success
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
describe "refreshing show" do
|
25
|
+
before do
|
26
|
+
RemoteSubject.should_receive(:find_by_slug!).with(@remote_subject.slug) { @remote_subject }
|
27
|
+
@remote_subject.should_receive(:refresh_webfinger!)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should refresh remote_subject" do
|
31
|
+
get :show, id: @remote_subject.slug, refresh: true
|
32
|
+
|
33
|
+
response.should be_success
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
5
|
+
require 'rake'
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|