ref: master
features/step_definitions/activate_enterprise_steps.rb
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_truthy 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_truthy (template.layout_template == enterprise.layout_template).should be_truthy (template.theme == enterprise.theme).should be_truthy (template.custom_header == enterprise.custom_header).should be_truthy (template.custom_footer == enterprise.custom_footer).should be_truthy 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_falsey (template.layout_template == enterprise.layout_template).should be_falsey (template.theme == enterprise.theme).should be_falsey (template.custom_header == enterprise.custom_header).should be_falsey (template.custom_footer == enterprise.custom_footer).should be_falsey end Given /^enterprise "([^\"]*)" is enabled$/ do |enterprise| Enterprise.find_by(name: enterprise).update_attribute(:enabled,true) Enterprise.find_by(name: enterprise).enabled?.should be_truthy end Given /^enterprise "([^\"]*)" should be blocked$/ do |enterprise| Enterprise.find_by(name: enterprise).blocked?.should be_truthy end Given /^enterprise "([^\"]*)" should not be blocked$/ do |enterprise| Enterprise.find_by(name: enterprise).blocked?.should_not be_truthy 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 |