software_registration_test.rb
1.2 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
require 'test_helper'
class SoftwareRegistrationTest < ActiveSupport::TestCase
def setup
@environment = Environment.default
@environment.enable_plugin(SoftwareCommunitiesPlugin)
@license_info = LicenseInfo.create(:version => "New License", :link => "#")
end
def teardown
Community.destroy_all
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 = 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 = CreateSoftware.create!(
:name => "Teste Two",
:requestor => person,
:environment => @environment,
:finality => "something",
:license_info => @license_info
)
software_count = SoftwareInfo.count
task.finish
assert_equal software_count+1, SoftwareInfo.count
end
end