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,191 @@
|
|
1
|
+
(function() {
|
2
|
+
// Technique from Juriy Zaytsev
|
3
|
+
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
|
4
|
+
function isEventSupported(eventName) {
|
5
|
+
var el = document.createElement('div');
|
6
|
+
eventName = 'on' + eventName;
|
7
|
+
var isSupported = (eventName in el);
|
8
|
+
if (!isSupported) {
|
9
|
+
el.setAttribute(eventName, 'return;');
|
10
|
+
isSupported = typeof el[eventName] == 'function';
|
11
|
+
}
|
12
|
+
el = null;
|
13
|
+
return isSupported;
|
14
|
+
}
|
15
|
+
|
16
|
+
function isForm(element) {
|
17
|
+
return Object.isElement(element) && element.nodeName.toUpperCase() == 'FORM'
|
18
|
+
}
|
19
|
+
|
20
|
+
function isInput(element) {
|
21
|
+
if (Object.isElement(element)) {
|
22
|
+
var name = element.nodeName.toUpperCase()
|
23
|
+
return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA'
|
24
|
+
}
|
25
|
+
else return false
|
26
|
+
}
|
27
|
+
|
28
|
+
var submitBubbles = isEventSupported('submit'),
|
29
|
+
changeBubbles = isEventSupported('change')
|
30
|
+
|
31
|
+
if (!submitBubbles || !changeBubbles) {
|
32
|
+
// augment the Event.Handler class to observe custom events when needed
|
33
|
+
Event.Handler.prototype.initialize = Event.Handler.prototype.initialize.wrap(
|
34
|
+
function(init, element, eventName, selector, callback) {
|
35
|
+
init(element, eventName, selector, callback)
|
36
|
+
// is the handler being attached to an element that doesn't support this event?
|
37
|
+
if ( (!submitBubbles && this.eventName == 'submit' && !isForm(this.element)) ||
|
38
|
+
(!changeBubbles && this.eventName == 'change' && !isInput(this.element)) ) {
|
39
|
+
// "submit" => "emulated:submit"
|
40
|
+
this.eventName = 'emulated:' + this.eventName
|
41
|
+
}
|
42
|
+
}
|
43
|
+
)
|
44
|
+
}
|
45
|
+
|
46
|
+
if (!submitBubbles) {
|
47
|
+
// discover forms on the page by observing focus events which always bubble
|
48
|
+
document.on('focusin', 'form', function(focusEvent, form) {
|
49
|
+
// special handler for the real "submit" event (one-time operation)
|
50
|
+
if (!form.retrieve('emulated:submit')) {
|
51
|
+
form.on('submit', function(submitEvent) {
|
52
|
+
var emulated = form.fire('emulated:submit', submitEvent, true)
|
53
|
+
// if custom event received preventDefault, cancel the real one too
|
54
|
+
if (emulated.returnValue === false) submitEvent.preventDefault()
|
55
|
+
})
|
56
|
+
form.store('emulated:submit', true)
|
57
|
+
}
|
58
|
+
})
|
59
|
+
}
|
60
|
+
|
61
|
+
if (!changeBubbles) {
|
62
|
+
// discover form inputs on the page
|
63
|
+
document.on('focusin', 'input, select, texarea', function(focusEvent, input) {
|
64
|
+
// special handler for real "change" events
|
65
|
+
if (!input.retrieve('emulated:change')) {
|
66
|
+
input.on('change', function(changeEvent) {
|
67
|
+
input.fire('emulated:change', changeEvent, true)
|
68
|
+
})
|
69
|
+
input.store('emulated:change', true)
|
70
|
+
}
|
71
|
+
})
|
72
|
+
}
|
73
|
+
|
74
|
+
function handleRemote(element) {
|
75
|
+
var method, url, params;
|
76
|
+
|
77
|
+
var event = element.fire("ajax:before");
|
78
|
+
if (event.stopped) return false;
|
79
|
+
|
80
|
+
if (element.tagName.toLowerCase() === 'form') {
|
81
|
+
method = element.readAttribute('method') || 'post';
|
82
|
+
url = element.readAttribute('action');
|
83
|
+
params = element.serialize();
|
84
|
+
} else {
|
85
|
+
method = element.readAttribute('data-method') || 'get';
|
86
|
+
url = element.readAttribute('href');
|
87
|
+
params = {};
|
88
|
+
}
|
89
|
+
|
90
|
+
new Ajax.Request(url, {
|
91
|
+
method: method,
|
92
|
+
parameters: params,
|
93
|
+
evalScripts: true,
|
94
|
+
|
95
|
+
onComplete: function(request) { element.fire("ajax:complete", request); },
|
96
|
+
onSuccess: function(request) { element.fire("ajax:success", request); },
|
97
|
+
onFailure: function(request) { element.fire("ajax:failure", request); }
|
98
|
+
});
|
99
|
+
|
100
|
+
element.fire("ajax:after");
|
101
|
+
}
|
102
|
+
|
103
|
+
function handleMethod(element) {
|
104
|
+
var method = element.readAttribute('data-method'),
|
105
|
+
url = element.readAttribute('href'),
|
106
|
+
csrf_param = $$('meta[name=csrf-param]')[0],
|
107
|
+
csrf_token = $$('meta[name=csrf-token]')[0];
|
108
|
+
|
109
|
+
var form = new Element('form', { method: "POST", action: url, style: "display: none;" });
|
110
|
+
element.parentNode.insert(form);
|
111
|
+
|
112
|
+
if (method !== 'post') {
|
113
|
+
var field = new Element('input', { type: 'hidden', name: '_method', value: method });
|
114
|
+
form.insert(field);
|
115
|
+
}
|
116
|
+
|
117
|
+
if (csrf_param) {
|
118
|
+
var param = csrf_param.readAttribute('content'),
|
119
|
+
token = csrf_token.readAttribute('content'),
|
120
|
+
field = new Element('input', { type: 'hidden', name: param, value: token });
|
121
|
+
form.insert(field);
|
122
|
+
}
|
123
|
+
|
124
|
+
form.submit();
|
125
|
+
}
|
126
|
+
|
127
|
+
|
128
|
+
document.on("click", "*[data-confirm]", function(event, element) {
|
129
|
+
var message = element.readAttribute('data-confirm');
|
130
|
+
if (!confirm(message)) event.stop();
|
131
|
+
});
|
132
|
+
|
133
|
+
document.on("click", "a[data-remote]", function(event, element) {
|
134
|
+
if (event.stopped) return;
|
135
|
+
handleRemote(element);
|
136
|
+
event.stop();
|
137
|
+
});
|
138
|
+
|
139
|
+
document.on("click", "a[data-method]", function(event, element) {
|
140
|
+
if (event.stopped) return;
|
141
|
+
handleMethod(element);
|
142
|
+
event.stop();
|
143
|
+
});
|
144
|
+
|
145
|
+
document.on("submit", function(event) {
|
146
|
+
var element = event.findElement(),
|
147
|
+
message = element.readAttribute('data-confirm');
|
148
|
+
if (message && !confirm(message)) {
|
149
|
+
event.stop();
|
150
|
+
return false;
|
151
|
+
}
|
152
|
+
|
153
|
+
var inputs = element.select("input[type=submit][data-disable-with]");
|
154
|
+
inputs.each(function(input) {
|
155
|
+
input.disabled = true;
|
156
|
+
input.writeAttribute('data-original-value', input.value);
|
157
|
+
input.value = input.readAttribute('data-disable-with');
|
158
|
+
});
|
159
|
+
|
160
|
+
var element = event.findElement("form[data-remote]");
|
161
|
+
if (element) {
|
162
|
+
handleRemote(element);
|
163
|
+
event.stop();
|
164
|
+
}
|
165
|
+
});
|
166
|
+
|
167
|
+
document.on("ajax:after", "form", function(event, element) {
|
168
|
+
var inputs = element.select("input[type=submit][disabled=true][data-disable-with]");
|
169
|
+
inputs.each(function(input) {
|
170
|
+
input.value = input.readAttribute('data-original-value');
|
171
|
+
input.removeAttribute('data-original-value');
|
172
|
+
input.disabled = false;
|
173
|
+
});
|
174
|
+
});
|
175
|
+
|
176
|
+
Ajax.Responders.register({
|
177
|
+
onCreate: function(request) {
|
178
|
+
var csrf_meta_tag = $$('meta[name=csrf-token]')[0];
|
179
|
+
|
180
|
+
if (csrf_meta_tag) {
|
181
|
+
var header = 'X-CSRF-Token',
|
182
|
+
token = csrf_meta_tag.readAttribute('content');
|
183
|
+
|
184
|
+
if (!request.options.requestHeaders) {
|
185
|
+
request.options.requestHeaders = {};
|
186
|
+
}
|
187
|
+
request.options.requestHeaders[header] = token;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
});
|
191
|
+
})();
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby1.8
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class << Proudhon::Finger
|
2
|
+
def fetch id
|
3
|
+
obj = Object.new
|
4
|
+
def obj.links
|
5
|
+
{ updates_from: 'feed' }
|
6
|
+
end
|
7
|
+
|
8
|
+
def obj.magic_key
|
9
|
+
OpenSSL::PKey::RSA.generate 256
|
10
|
+
end
|
11
|
+
|
12
|
+
obj
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class << Proudhon::Atom
|
17
|
+
def from_uri uri
|
18
|
+
obj = Object.new
|
19
|
+
|
20
|
+
def obj.subscribe(callback)
|
21
|
+
true
|
22
|
+
end
|
23
|
+
|
24
|
+
obj
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
RemoteSubject.class_eval do
|
29
|
+
def build_webfinger_info
|
30
|
+
{
|
31
|
+
aliases: [ "http://example.com/#{ webfinger_id.split('@').first }" ]
|
32
|
+
}
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Factory.define :remote_subject do |s|
|
38
|
+
s.sequence(:webfinger_id) { |n| "remote_subject-#{ n }@example.com" }
|
39
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Post do
|
4
|
+
describe "from_entry!" do
|
5
|
+
before do
|
6
|
+
@remote_subject = Factory(:remote_subject)
|
7
|
+
@entry = double("Proudhon::Entry")
|
8
|
+
|
9
|
+
SocialStream::ActivityStreams.should_receive(:actor_from_entry!) { @remote_subject }
|
10
|
+
|
11
|
+
@entry.should_receive(:title) { "testing" }
|
12
|
+
@entry.should_receive(:summary) { "testing" }
|
13
|
+
|
14
|
+
end
|
15
|
+
it "should create post" do
|
16
|
+
post_count = Post.count
|
17
|
+
|
18
|
+
post = Post.from_entry! @entry, nil
|
19
|
+
|
20
|
+
post.author.should == @remote_subject.actor
|
21
|
+
|
22
|
+
Post.count.should == post_count + 1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RemoteSubject do
|
4
|
+
describe "find_or_create_by_webfinger_uri" do
|
5
|
+
before do
|
6
|
+
@remote_subject = Factory(:remote_subject)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should find without acct:" do
|
10
|
+
RemoteSubject.find_or_create_by_webfinger_uri!(@remote_subject.webfinger_id).should == @remote_subject
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should find with acct:" do
|
14
|
+
RemoteSubject.find_or_create_by_webfinger_uri!("acct:#{ @remote_subject.webfinger_id}").should == @remote_subject
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should find with alias" do
|
18
|
+
splt = @remote_subject.webfinger_id.split('@')
|
19
|
+
uri = "http://#{ splt.last }/#{ splt.first }"
|
20
|
+
|
21
|
+
RemoteSubject.find_or_create_by_webfinger_uri!(uri)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SocialStream::Ostatus::ActivityStreams do
|
4
|
+
describe "from_pshb_callback" do
|
5
|
+
before do
|
6
|
+
@entry = double("Proudhon::Entry")
|
7
|
+
|
8
|
+
@remote_subject = double("RemoteSubject")
|
9
|
+
|
10
|
+
Proudhon::Atom.should_receive(:parse) { [ @entry ] }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "with post note" do
|
14
|
+
before do
|
15
|
+
@entry.should_receive(:verb) { :post }
|
16
|
+
@entry.should_receive(:objtype) { :note }
|
17
|
+
|
18
|
+
@post = double "post"
|
19
|
+
|
20
|
+
@post.should_receive :post_activity
|
21
|
+
|
22
|
+
Post.should_receive(:from_entry!).with(@entry) { @post }
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should call stubs" do
|
26
|
+
SocialStream::ActivityStreams.from_pshb_callback "test"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Configure Rails Envinronment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
require "rspec/rails"
|
7
|
+
|
8
|
+
ActionMailer::Base.delivery_method = :test
|
9
|
+
ActionMailer::Base.perform_deliveries = true
|
10
|
+
ActionMailer::Base.default_url_options[:host] = "test.com"
|
11
|
+
|
12
|
+
Rails.backtrace_cleaner.remove_silencers!
|
13
|
+
|
14
|
+
# Configure capybara for integration testing
|
15
|
+
require "capybara/rails"
|
16
|
+
Capybara.default_driver = :rack_test
|
17
|
+
Capybara.default_selector = :css
|
18
|
+
|
19
|
+
# Run any available migration
|
20
|
+
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
21
|
+
|
22
|
+
# Load support files
|
23
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
24
|
+
|
25
|
+
RSpec.configure do |config|
|
26
|
+
# Remove this line if you don't want RSpec's should and should_not
|
27
|
+
# methods or matchers
|
28
|
+
require 'rspec/expectations'
|
29
|
+
config.include RSpec::Matchers
|
30
|
+
|
31
|
+
# == Mock Framework
|
32
|
+
config.mock_with :rspec
|
33
|
+
end
|
@@ -4,7 +4,7 @@ class SocialStream::Presence::InstallGenerator < Rails::Generators::Base
|
|
4
4
|
source_root File.expand_path('../templates', __FILE__)
|
5
5
|
|
6
6
|
def create_initializer_file
|
7
|
-
template 'initializer.rb', 'config/initializers/
|
7
|
+
template 'initializer.rb', 'config/initializers/social_stream-presence.rb'
|
8
8
|
end
|
9
9
|
|
10
10
|
def create_migration_file
|
@@ -1,18 +1,6 @@
|
|
1
1
|
module SocialStream
|
2
2
|
module Presence
|
3
3
|
class Engine < Rails::Engine
|
4
|
-
initializer "social_stream-presence.tie" do
|
5
|
-
ActiveSupport.on_load(:tie) do
|
6
|
-
include SocialStream::Presence::Models::BuddyManager
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
initializer "social_stream-presence.group" do
|
11
|
-
ActiveSupport.on_load(:group) do
|
12
|
-
include SocialStream::Presence::Models::GroupManager
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
4
|
initializer "social_stream-presence.views.settings" do
|
17
5
|
SocialStream::Views::Settings.module_eval do
|
18
6
|
include SocialStream::Views::Settings::Presence
|