[yast-commit] <rest-service> backgroud_patches_bnc550934 : use constants instead of variables in tests
ref: refs/heads/backgroud_patches_bnc550934 commit 756c532b8ae90a8db4304f18b933e4c5ad24d1b7 Author: Ladislav Slezak <lslezak@novell.com> Date: Fri Dec 18 12:45:47 2009 +0100 use constants instead of variables in tests --- webservice/test/unit/background_status_test.rb | 36 +++++++++++------------ 1 files changed, 17 insertions(+), 19 deletions(-) diff --git a/webservice/test/unit/background_status_test.rb b/webservice/test/unit/background_status_test.rb index c63b93d..607f7e3 100644 --- a/webservice/test/unit/background_status_test.rb +++ b/webservice/test/unit/background_status_test.rb @@ -19,54 +19,52 @@ class ObserverTest end end +TEST_STATUS = 'testing status' +TEST_PROGRESS = 10 +TEST_SUBPROGRESS = 5 + class BackgroundStatusTest < ActiveSupport::TestCase def setup @bs = BackgroundStatus.new end def test_assignemnt - s = 'status' - p = 10 - sp = 5 - @bs.status = s - @bs.progress = p - @bs.subprogress = sp - - assert_equal s, @bs.status - assert_equal p, @bs.progress - assert_equal sp, @bs.subprogress + @bs.status = TEST_STATUS + @bs.progress = TEST_PROGRESS + @bs.subprogress = TEST_SUBPROGRESS + + assert_equal TEST_STATUS, @bs.status + assert_equal TEST_PROGRESS, @bs.progress + assert_equal TEST_SUBPROGRESS, @bs.subprogress end def test_observing ot = ObserverTest.new(@bs) - s = 'dummy status' - p = 10 - sp = 5 # test progress change ot.reset - @bs.progress = p + @bs.progress = TEST_PROGRESS assert ot.changed? ot.reset - @bs.subprogress = sp + @bs.subprogress = TEST_SUBPROGRESS assert ot.changed? ot.reset - @bs.status = s + @bs.status = TEST_STATUS assert ot.changed? # no change must not emit change event ot.reset - @bs.progress = p + @bs.progress = TEST_PROGRESS assert !ot.changed? ot.reset - @bs.subprogress = sp + @bs.subprogress = TEST_SUBPROGRESS assert !ot.changed? ot.reset - @bs.status = s + @bs.status = TEST_STATUS assert !ot.changed? end -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
Ladislav Slezak