activate_enterprise_steps.rb
2.55 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
Given /^I fill in "([^\"]*)" with code of "([^\"]*)"$/ do |field, enterprise|
enterprise = Enterprise.find_by_name(enterprise)
value = EnterpriseActivation.all.select { |task| task.enterprise == enterprise}.first.code
fill_in(field, :with => value)
end
Given /^enterprise "([^\"]*)" should be enabled$/ do |enterprise|
Enterprise.find_by_name(enterprise).enabled?.should be_true
end
Given /^"([^\"]*)" is the active enterprise template$/ do |enterprise|
template = Enterprise.find_by_name(enterprise)
template.boxes.destroy_all
template.boxes << Box.new
template.layout_template = 'leftbar'
template.theme = 'template_theme'
template.custom_header = 'template header'
template.custom_footer = 'template_footer'
template.save!
e = Environment.default
e.enterprise_default_template = template
e.save
end
Given /^"([^\"]*)" has "([^\"]*)" as template$/ do |ent, templ|
template = Enterprise.find_by_name(templ)
enterprise = Enterprise.find_by_name(ent)
(template.boxes.size == enterprise.boxes.size).should be_true
(template.layout_template == enterprise.layout_template).should be_true
(template.theme == enterprise.theme).should be_true
(template.custom_header == enterprise.custom_header).should be_true
(template.custom_footer == enterprise.custom_footer).should be_true
end
Given /^"([^\"]*)" doesnt have "([^\"]*)" as template$/ do |ent, templ|
template = Enterprise.find_by_name(templ)
enterprise = Enterprise.find_by_name(ent)
(template.boxes.size == enterprise.boxes.size).should be_false
(template.layout_template == enterprise.layout_template).should be_false
(template.theme == enterprise.theme).should be_false
(template.custom_header == enterprise.custom_header).should be_false
(template.custom_footer == enterprise.custom_footer).should be_false
end
Given /^enterprise "([^\"]*)" is enabled$/ do |enterprise|
Enterprise.find_by_name(enterprise).update_attribute(:enabled,true)
Enterprise.find_by_name(enterprise).enabled?.should be_true
end
Given /^enterprise "([^\"]*)" should be blocked$/ do |enterprise|
Enterprise.find_by_name(enterprise).blocked?.should be_true
end
Given /^enterprise "([^\"]*)" should not be blocked$/ do |enterprise|
Enterprise.find_by_name(enterprise).blocked?.should_not be_true
end
Given /^enterprise template must be replaced after enable$/ do
e = Environment.default
e.replace_enterprise_template_when_enable = true
e.save
end
Given /^enterprise template must not be replaced after enable$/ do
e = Environment.default
e.replace_enterprise_template_when_enable = false
e.save
end