test_helper.rb
1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require File.dirname(__FILE__) + '/../../../test/test_helper'
def create_hub(name, community, user)
hub = CommunityHubPlugin::Hub.new(:abstract => 'abstract', :body => 'body', :name => name, :profile => community, :last_changed_by_id => user.id )
hub.save!
hub
end
def create_mediation(hub, community)
mediation = CommunityHubPlugin::Mediation.new(:profile => community)
mediation.name = CommunityHubPlugin::Mediation.timestamp
mediation.save!
mediation
end
def create_message(hub,user)
message = Comment.new
message.author = user
message.title = "hub-message-#{(Time.now.to_f * 1000).to_i}"
message.body = 'body'
message.article = hub
message.save!
message
end
def create_mediation(hub, user, community)
#raise community.inspect
mediation = CommunityHubPlugin::Mediation.new
mediation.name = CommunityHubPlugin::Mediation.timestamp
mediation.profile = community
mediation.last_changed_by = user
mediation.created_by_id = user.id
mediation.source = 'local'
mediation.parent_id = hub.id
mediation.save!
mediation
end