Show More
Commit Description:
logs out users after contests changed
Commit Description:
logs out users after contests changed
References:
File last commit:
Show/Diff file:
Action:
spec/config_spec_helper.rb
| 38 lines
| 1.1 KiB
| text/x-ruby
| RubyLexer
|
|
r293 | |||
module ConfigSpecHelperMethods | ||||
def find_or_create_and_set_config(key, type, value) | ||||
c = Configuration.find_by_key(key) | ||||
c ||= Configuration.new(:key => key, | ||||
:value_type => type) | ||||
c.value = value | ||||
c.save! | ||||
end | ||||
def enable_multicontest | ||||
|
r294 | find_or_create_and_set_config(Configuration::MULTICONTESTS_KEY, | ||
'boolean','true') | ||||
|
r293 | end | ||
def disable_multicontest | ||||
|
r294 | find_or_create_and_set_config(Configuration::MULTICONTESTS_KEY, | ||
'boolean','false') | ||||
end | ||||
def set_indv_contest_mode | ||||
find_or_create_and_set_config(Configuration::SYSTEM_MODE_CONF_KEY, | ||||
'string','indv-contest') | ||||
|
r293 | end | ||
|
r294 | def set_standard_mode | ||
find_or_create_and_set_config(Configuration::SYSTEM_MODE_CONF_KEY, | ||||
'string','standard') | ||||
end | ||||
def set_contest_time_limit(limit) | ||||
find_or_create_and_set_config(Configuration::CONTEST_TIME_LIMIT_KEY, | ||||
'string',limit) | ||||
# clear old value | ||||
Configuration.contest_time_str = nil | ||||
end | ||||
|
r293 | end | ||