software_registration_test.rb
1.25 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
require File.dirname(__FILE__) + '/../../../../test/test_helper'
class SoftwareRegistrationTest < ActiveSupport::TestCase
def setup
@environment = Environment.default
@environment.enable_plugin(SoftwareCommunitiesPlugin)
end
def teardown
Community.destroy_all
SoftwareCommunitiesPlugin::SoftwareInfo.destroy_all
Task.destroy_all
end
should 'include software registration task if is admin' do
person = create_user('molly').person
@environment.add_admin(person)
task = SoftwareCommunitiesPlugin::CreateSoftware.create!(
:name => "Teste One",
:requestor => person,
:environment => @environment
)
assert_equal [task], Task.to(person).pending
end
should 'create software when admin accept software create task' do
person = create_user('Pedro').person
@environment.add_admin(person)
task = SoftwareCommunitiesPlugin::CreateSoftware.create!(
:name => "Teste Two",
:requestor => person,
:environment => @environment,
:finality => "something"
)
software_count = SoftwareCommunitiesPlugin::SoftwareInfo.count
task.finish
assert_equal software_count+1, SoftwareCommunitiesPlugin::SoftwareInfo.count
end
end