create_enterprise_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
43
44
require File.dirname(__FILE__) + '/../test_helper'
class CreateEnterpriseTest < Test::Unit::TestCase
should 'provide needed data' do
task = CreateEnterprise.new
%w[ name identifier address contact_phone contact_person acronym foundation_year legal_form economic_activity management_information ].each do |field|
assert task.respond_to?(field)
assert task.respond_to?("#{field}=")
end
end
should 'accept only numbers as foundation year' do
task = CreateEnterprise.new
task.foundation_year = "test"
task.valid?
assert task.errors.invalid?(:foundation_year)
task.foundation_year = 2006
task.valid?
assert !task.errors.invalid?(:foundation_year)
end
should 'require a requestor' do
task = CreateEnterprise.new
task.valid?
assert task.errors.invalid?(:requestor_id)
task.requestor = User.create!(:login => 'testuser', :password => 'test', :password_confirmation => 'test', :email => 'testuser@localhost.localdomain').person
task.valid?
assert !task.errors.invalid?(:requestor_id)
end
should 'require a target (validator organization)' do
flunk 'need to write'
end
should 'associate task requestor as enterprise administrator when creating' do
flunk 'need to write'
end
end