plugin_test_helper.rb
1.93 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
require File.dirname(__FILE__) + '/../helpers/institution_test_helper'
module PluginTestHelper
def create_public_institution *params
InstitutionTestHelper.create_public_institution *params
end
def create_community name
community = fast_create(Community)
community.name = name
community.save
community
end
def create_software_info name, finality = "something", acronym = ""
community = create_community(name)
software_info = SoftwareInfo.new
software_info.community = community
software_info.finality = finality
software_info.acronym = acronym
software_info.public_software = true
software_info.save!
software_info
end
def create_private_institution name, acronym, country, state, city, cnpj
InstitutionTestHelper.create_private_institution(
name,
acronym,
country,
state,
city,
cnpj
)
end
def create_community_institution name, country, state, city
community = fast_create(Community)
community.name = name
community.country = country
community.state = state
community.city = city
community.save
community
end
def create_person name, email, password, password_confirmation, state, city
user = create_user(
name.to_slug,
email,
password,
password_confirmation,
)
person = Person::new
user.person = person
person.user = user
person.name = name
person.identifier = name.to_slug
person.state = state
person.city = city
user.save
person.save
person
end
def create_user login, email, password, password_confirmation
user = User.new
user.login = login
user.email = email
user.password = password
user.password_confirmation = password_confirmation
user
end
def create_license_info version, link = ""
license = LicenseInfo.create(:version => version)
license.link = link
license.save
license
end
end