Permalink
Browse files

enhanced test coverage (Thanks Copper Hill)

  • Loading branch information...
1 parent 6ff311a commit e284a8c871592148e8c3e841b448ee814f8b2c3a @jmettraux committed Dec 9, 2010
Showing with 81 additions and 6 deletions.
  1. +1 −0 CREDITS.txt
  2. +1 −0 ruote.gemspec
  3. +36 −0 test/functional/ft_51_misc.rb
  4. +27 −6 test/unit/storage.rb
  5. +16 −0 test/unit/ut_15_util.rb
View
1 CREDITS.txt
@@ -45,6 +45,7 @@ Richard Jennings
Feedback
--------
+Copper Hill - test coverage enhancements
Claudio Petasecca Donati - 'lose' expression and attribute reminder
Daniel Neighman "hassox" - :on_timeout => "error" and many issue reports
Eric Platon - engine.launch_single idea
View
1 ruote.gemspec
@@ -223,6 +223,7 @@ ruote is an open source ruby workflow engine.
"test/functional/ft_49_engine_on_error.rb",
"test/functional/ft_4_cancel.rb",
"test/functional/ft_50_engine_config.rb",
+ "test/functional/ft_51_misc.rb",
"test/functional/ft_5_on_error.rb",
"test/functional/ft_6_on_cancel.rb",
"test/functional/ft_7_tags.rb",
View
36 test/functional/ft_51_misc.rb
@@ -0,0 +1,36 @@
+
+#
+# testing ruote
+#
+# Thu Dec 9 16:39:54 JST 2010
+#
+
+require 'stringio'
+require File.join(File.dirname(__FILE__), 'base')
+
+
+class FtMiscTest < Test::Unit::TestCase
+ include FunctionalBase
+
+ def test_noisy
+
+ result = String.new
+ out = StringIO.new(result, 'w+')
+
+ $stdout = out
+
+ @engine.noisy = true
+
+ wfid = @engine.launch(Ruote.define do
+ echo 'nada'
+ end)
+
+ @engine.wait_for(wfid)
+
+ out.close
+ $stdout = STDOUT
+
+ assert_not_nil result
+ end
+end
+
View
33 test/unit/storage.rb
@@ -214,12 +214,7 @@ def test_get_many
def test_get_many_options
- 30.times do |i|
- @s.put(
- '_id' => sprintf("yy!%0.2d", i),
- 'type' => 'errors',
- 'msg' => "whatever #{i}")
- end
+ load_30_errors
# limit
@@ -255,5 +250,31 @@ def test_get_many_options
'errors', nil, :skip => 0, :limit => 3, :descending => true
).collect { |d| d['_id'] })
end
+
+ def test_dump
+
+ load_30_errors
+
+ assert @s.dump('errors').length > 0
+ end
+
+ def test_ids
+
+ load_30_errors
+
+ assert_equal 31, @s.ids('errors').length
+ end
+
+ protected
+
+ def load_30_errors
+
+ 30.times do |i|
+ @s.put(
+ '_id' => sprintf("yy!%0.2d", i),
+ 'type' => 'errors',
+ 'msg' => "whatever #{i}")
+ end
+ end
end
View
16 test/unit/ut_15_util.rb
@@ -44,5 +44,21 @@ def test_regex_or_s
assert_equal 'nada', Ruote.regex_or_s('nada')
assert_equal nil, Ruote.regex_or_s(nil)
end
+
+ class Klass
+ def initialize (s)
+ @s = s
+ end
+ end
+
+ def test_fulldup
+
+ a = Klass.new('hello')
+ b = Ruote.fulldup(a)
+
+ assert_equal Klass, b.class
+ assert_not_equal a.object_id, b.object_id
+ assert_equal 'hello', b.instance_variable_get(:@s)
+ end
end

0 comments on commit e284a8c

Please sign in to comment.