[yast-commit] <rest-service> master : systemtime: fix issue with super and utcstatus
ref: refs/heads/master commit af27b8ed76c06580041427ad8f002c645b268825 Author: Josef Reidinger <jreidinger@suse.cz> Date: Mon Dec 14 14:33:46 2009 +0100 systemtime: fix issue with super and utcstatus super sometime doesn't work with included modules so I use alias utcstatus localtime use keywork local not localtime --- plugins/time/app/models/systemtime.rb | 6 ++++-- plugins/time/test/unit/systemtime_test.rb | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/time/app/models/systemtime.rb b/plugins/time/app/models/systemtime.rb index 0c715d7..fcf881d 100644 --- a/plugins/time/app/models/systemtime.rb +++ b/plugins/time/app/models/systemtime.rb @@ -60,7 +60,7 @@ class Systemtime < BaseModel::Base @utcstatus = case response["utcstatus"] when "UTC" then true - when "localtime" then false + when "local" then false when "UTCOnly" then nil else Rails.logger.warn "Unknown key in utcstatus #{response["utcstatus"]}" @@ -70,6 +70,8 @@ class Systemtime < BaseModel::Base @timezones = response["zones"] end +#super sometime doesn't work (need more investigation - in test work always, in real code sometime report no method in superclass) + alias orig_to_xml to_xml def to_xml(options={}) tmp =@timezones @timezones = @timezones.clone @@ -81,7 +83,7 @@ class Systemtime < BaseModel::Base end zone["entries"] = newentry end - res = super options + res = orig_to_xml options @timezones = tmp return res end diff --git a/plugins/time/test/unit/systemtime_test.rb b/plugins/time/test/unit/systemtime_test.rb index df11fae..9bf6407 100644 --- a/plugins/time/test/unit/systemtime_test.rb +++ b/plugins/time/test/unit/systemtime_test.rb @@ -38,18 +38,18 @@ class SystemtimeTest < ActiveSupport::TestCase WRITE_ARGUMENTS_NONE = { "timezone"=> "America/Kentucky/Monticello", - "utcstatus"=> "localtime" + "utcstatus"=> "local" } WRITE_ARGUMENTS_TIME = { "timezone"=> "America/Kentucky/Monticello", - "utcstatus"=> "localtime", + "utcstatus"=> "local", "time" => "2009-07-02 - 12:18:00" } WRITE_ARGUMENTS_NTP = { :timezone=> "America/Kentucky/Monticello", - :utcstatus=> "localtime", + :utcstatus=> "local", } def setup -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
Josef Reidinger