Hi everyone,

I'm performing a series of validations on boolean workitem fields:

filter :in => [ {:field => 'header.x', :has => true, :record => true}.
...(more validations)...
]

The next participant receives the result of the filter:

"__validation_errors__":
[[{"field":"header.x","has":true},"header.x",true],
...(identical errors)... ]

Which makes no sense to me.

So I cloned the latest ruote and added a small test case to test/unit/
ut_22_filter.rb:

---8<---
  def test_has_boolean
    assert_valid(
      [ { 'field' => 'x', 'type' => 'boolean' } ], { 'x' => true })
    assert_valid(
      [ { 'field' => 'x', 'has' => true } ],
      { 'x' => true })

    assert_not_valid(
      [ { 'field' => 'x', 'type' => 'boolean' } ], { 'x' => 'nada' })
    assert_not_valid(
      [ { 'field' => 'x', 'has' => true } ],
      { 'x' => false })
  end
--->8---

The result is as follows:

---8<---
coruscant:ruote nando$ ruby test/unit/ut_22_filter.rb
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
Thu Jun 16 11:48:50 +0200 2011
using json 1.5.0
Loaded suite test/unit/ut_22_filter
Started
..........

#<Ruote::ValidationError: validation failed with 1 deviation(s)>
[[{"has"=>true, "field"=>"x"}, "x", true]]

hash:
{"x"=>true}
filter:
{"has"=>true, "field"=>"x"}

F...............................................
Finished in 0.245535 seconds.

  1) Failure:
test_has_boolean(UtFilterTest)
    [test/unit/ut_22_filter.rb:450:in `assert_valid'
     test/unit/ut_22_filter.rb:1047:in `test_has_boolean']:
<false> is not true.

58 tests, 270 assertions, 1 failures, 0 errors

--->8---

Is this a bug? Or am I still missing something. The documentation at
http://ruote.rubyforge.org/exp/filter.html doesn't include any
examples with boolean values, only boolean :type.

Thanks for your attention :-)

Best regards,
//nando

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to