Kosuke Asami
null+****@clear*****
Tue Jul 23 16:16:06 JST 2013
Kosuke Asami 2013-07-23 16:16:06 +0900 (Tue, 23 Jul 2013) New Revision: 94831a6b74370cacdcfc85b2b10c2d5c7bee298c https://github.com/groonga/fluent-plugin-droonga/commit/94831a6b74370cacdcfc85b2b10c2d5c7bee298c Message: test adapter_select: extract common request hashes and an assert as a method Modified files: test/plugin/adapter/groonga/test_select.rb Modified: test/plugin/adapter/groonga/test_select.rb (+8 -35) =================================================================== --- test/plugin/adapter/groonga/test_select.rb 2013-07-23 16:12:21 +0900 (91a1338) +++ test/plugin/adapter/groonga/test_select.rb 2013-07-23 16:16:06 +0900 (80d9010) @@ -96,10 +96,10 @@ class AdapterGroongaSelectTest < Test::Unit::TestCase end class MatchColumnsTest < self - def test_single_column + def assert_matchTo(expected_matchTo, match_columns) select_request = { "table" => "EmptyTable", - "match_columns" => "_key", + "match_columns" => match_columns, "query" => "QueryTest", "output_columns" => "_id", } @@ -110,7 +110,7 @@ class AdapterGroongaSelectTest < Test::Unit::TestCase "source" => "EmptyTable", "condition"=> { "query" => "QueryTest", - "matchTo"=> ["_key"], + "matchTo"=> expected_matchTo, "defaultOperator"=> "&&", "allowPragma"=> false, "allowColumn"=> true, @@ -131,39 +131,12 @@ class AdapterGroongaSelectTest < Test::Unit::TestCase assert_equal(expected_search_request, convert(select_request)) end - def test_multiple_columns - select_request = { - "table" => "EmptyTable", - "match_columns" => "_key || content", - "query" => "QueryTest", - "output_columns" => "_id", - } + def test_single_column + assert_matchTo(["_key"], "_key") + end - expected_search_request = { - "queries" => { - "EmptyTable" => { - "source" => "EmptyTable", - "condition"=> { - "query" => "QueryTest", - "matchTo"=> ["_key", "content"], - "defaultOperator"=> "&&", - "allowPragma"=> false, - "allowColumn"=> true, - }, - "output" => { - "elements" => [ - "startTime", - "elapsedTime", - "count", - "attributes", - "records", - ], - "attributes" => ["_id"], - }, - }, - }, - } - assert_equal(expected_search_request, convert(select_request)) + def test_multiple_columns + assert_matchTo(["_key", "content"], "_key || content") end end end -------------- next part -------------- HTML����������������������������...Download