Skip to content

Commit 1af09b5

Browse files
committed
[DSL] Changed the test framework to Minitest and configured the reporter
Previously, the "test-unit" gem has been use as the test framework, which caused the output to lack the test names, and only show the "dot" report. This patch switches the platform, changes the superclass for all the tests to inherit from `Minitest::Test`, and adds assertions to be compatible with `Test::Unit`.
1 parent bb680d5 commit 1af09b5

File tree

122 files changed

+171
-153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+171
-153
lines changed

Rakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ namespace :generate do
182182
module Elasticsearch
183183
module Test
184184
module #{module_name}
185-
class #{class_name}Test < ::Test::Unit::TestCase
185+
class #{class_name}Test < ::Elasticsearch::Test::UnitTestCase
186186
include Elasticsearch::DSL::Search::#{module_name}
187187
188188
context "#{class_name} #{options[:type]}" do

elasticsearch-dsl.gemspec

+2-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ Gem::Specification.new do |s|
2929

3030
s.add_development_dependency 'shoulda-context'
3131
s.add_development_dependency 'mocha'
32-
s.add_development_dependency 'minitest', '~> 4.0'
33-
s.add_development_dependency 'minitest-reporters'
32+
s.add_development_dependency 'minitest', '~> 5'
33+
s.add_development_dependency 'minitest-reporters', '~> 1'
3434
s.add_development_dependency 'simplecov'
35-
s.add_development_dependency 'simplecov-rcov'
3635
s.add_development_dependency 'ci_reporter', '~> 1.9'
3736
s.add_development_dependency 'yard'
3837
s.add_development_dependency 'cane'

test/test_helper.rb

+21-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77

88
at_exit { Elasticsearch::Test::IntegrationTestCase.__run_at_exit_hooks }
99

10-
require 'test/unit'
10+
require 'minitest/autorun'
1111
require 'shoulda-context'
1212
require 'mocha/setup'
1313

1414
require 'minitest/reporters'
1515
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
16+
# Minitest::Reporters.use! [ Minitest::Reporters::SpecReporter.new,
17+
# Minitest::Reporters::JUnitReporter.new,
18+
# Minitest::Reporters::HtmlReporter.new ]
1619

1720
require 'elasticsearch'
1821
require 'elasticsearch/extensions/test/cluster'
@@ -22,7 +25,23 @@
2225

2326
module Elasticsearch
2427
module Test
25-
class IntegrationTestCase < ::Test::Unit::TestCase
28+
module Assertions
29+
def assert_nothing_raised(*)
30+
yield
31+
end
32+
end
33+
34+
class UnitTestCase < ::Minitest::Test
35+
include Assertions
36+
alias_method :assert_not_nil, :refute_nil
37+
alias_method :assert_raise, :assert_raises
38+
end
39+
40+
class IntegrationTestCase < ::Minitest::Test
41+
include Assertions
42+
alias_method :assert_not_nil, :refute_nil
43+
alias_method :assert_raise, :assert_raises
44+
2645
include Elasticsearch::Extensions::Test
2746
extend StartupShutdown
2847

test/unit/aggregations/avg_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class AvgTest < ::Test::Unit::TestCase
6+
class AvgTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Avg agg" do

test/unit/aggregations/cardinality_test.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class CardinalityTest < ::Test::Unit::TestCase
6+
class CardinalityTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Cardinality agg" do
@@ -12,21 +12,21 @@ class CardinalityTest < ::Test::Unit::TestCase
1212
should "be converted to a Hash" do
1313
assert_equal({ cardinality: {} }, subject.to_hash)
1414
end
15-
15+
1616
should "have option methods" do
1717
subject = Cardinality.new :foo
18-
18+
1919
subject.field 'bar'
2020
subject.precision_threshold 'bar'
2121
subject.rehash 'bar'
2222
subject.script 'bar'
2323
subject.params 'bar'
24-
24+
2525
assert_equal %w[ field params precision_threshold rehash script ],
2626
subject.to_hash[:cardinality][:foo].keys.map(&:to_s).sort
2727
assert_equal 'bar', subject.to_hash[:cardinality][:foo][:field]
2828
end
29-
29+
3030
should "take a block" do
3131
subject = Cardinality.new :foo do
3232
field 'bar'

test/unit/aggregations/children_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class ChildrenTest < ::Test::Unit::TestCase
6+
class ChildrenTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Children aggregation" do

test/unit/aggregations/date_histogram_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class DateHistogramTest < ::Test::Unit::TestCase
6+
class DateHistogramTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "DateHistogram aggregation" do

test/unit/aggregations/date_range_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class DateRangeTest < ::Test::Unit::TestCase
6+
class DateRangeTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "DateRange aggregation" do

test/unit/aggregations/extended_stats_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class ExtendedStatsTest < ::Test::Unit::TestCase
6+
class ExtendedStatsTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "ExtendedStats agg" do

test/unit/aggregations/filter_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class FilterTest < ::Test::Unit::TestCase
6+
class FilterTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Filter agg" do

test/unit/aggregations/filters_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class FiltersTest < ::Test::Unit::TestCase
6+
class FiltersTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Filters agg" do

test/unit/aggregations/geo_bounds_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class GeoBoundsTest < ::Test::Unit::TestCase
6+
class GeoBoundsTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "GeoBounds agg" do

test/unit/aggregations/geo_distance_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class GeoDistanceTest < ::Test::Unit::TestCase
6+
class GeoDistanceTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "GeoDistance aggregation" do

test/unit/aggregations/geohash_grid_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class GeohashGridTest < ::Test::Unit::TestCase
6+
class GeohashGridTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "GeohashGrid aggregation" do

test/unit/aggregations/global_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class GlobalTest < ::Test::Unit::TestCase
6+
class GlobalTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Global agg" do

test/unit/aggregations/histogram_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class HistogramTest < ::Test::Unit::TestCase
6+
class HistogramTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Histogram aggregation" do

test/unit/aggregations/ip_range_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class IpRangeTest < ::Test::Unit::TestCase
6+
class IpRangeTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "IpRange aggregation" do

test/unit/aggregations/max_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class MaxTest < ::Test::Unit::TestCase
6+
class MaxTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Max agg" do

test/unit/aggregations/min_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class MinTest < ::Test::Unit::TestCase
6+
class MinTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Min agg" do

test/unit/aggregations/missing_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class MissingTest < ::Test::Unit::TestCase
6+
class MissingTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Missing aggregation" do

test/unit/aggregations/nested_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class NestedTest < ::Test::Unit::TestCase
6+
class NestedTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Nested aggregation" do

test/unit/aggregations/percentile_ranks_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class PercentileRanksTest < ::Test::Unit::TestCase
6+
class PercentileRanksTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "PercentileRanks agg" do

test/unit/aggregations/percentiles_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class PercentilesTest < ::Test::Unit::TestCase
6+
class PercentilesTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Percentiles agg" do

test/unit/aggregations/pipeline/avg_bucket_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class AvgBucketTest < ::Test::Unit::TestCase
6+
class AvgBucketTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Avg Bucket agg" do

test/unit/aggregations/pipeline/bucket_script_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class BucketScriptTest < ::Test::Unit::TestCase
6+
class BucketScriptTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Bucket Script agg" do

test/unit/aggregations/pipeline/bucket_selector_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class BucketSelectorTest < ::Test::Unit::TestCase
6+
class BucketSelectorTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Bucket Selector agg" do

test/unit/aggregations/pipeline/cumulative_sum_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class CumulativeSumTest < ::Test::Unit::TestCase
6+
class CumulativeSumTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Cumulative Sum Bucket agg" do

test/unit/aggregations/pipeline/derivative_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class DerivativeTest < ::Test::Unit::TestCase
6+
class DerivativeTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Derivative agg" do

test/unit/aggregations/pipeline/extended_stats_bucket_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class ExtendedStatsBucketTest < ::Test::Unit::TestCase
6+
class ExtendedStatsBucketTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Extended Stats Bucket agg" do

test/unit/aggregations/pipeline/max_bucket_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class MaxBucketTest < ::Test::Unit::TestCase
6+
class MaxBucketTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Max Bucket agg" do

test/unit/aggregations/pipeline/min_bucket_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class MinBucketTest < ::Test::Unit::TestCase
6+
class MinBucketTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Min Bucket agg" do

test/unit/aggregations/pipeline/moving_avg_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class MovingAvgTest < ::Test::Unit::TestCase
6+
class MovingAvgTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Moving Average Bucket agg" do

test/unit/aggregations/pipeline/percentiles_bucket_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class PercentilesBucketTest < ::Test::Unit::TestCase
6+
class PercentilesBucketTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Percentiles Bucket agg" do

test/unit/aggregations/pipeline/serial_diff_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class SerialDiffTest < ::Test::Unit::TestCase
6+
class SerialDiffTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Serial Defferencing agg" do

test/unit/aggregations/pipeline/stats_bucket_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class StatsBucketTest < ::Test::Unit::TestCase
6+
class StatsBucketTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Stats Bucket agg" do

test/unit/aggregations/pipeline/sum_bucket_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class SumBucketTest < ::Test::Unit::TestCase
6+
class SumBucketTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Sum Bucket agg" do

test/unit/aggregations/range_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Elasticsearch
44
module Test
55
module Aggregations
6-
class RangeTest < ::Test::Unit::TestCase
6+
class RangeTest < ::Elasticsearch::Test::UnitTestCase
77
include Elasticsearch::DSL::Search::Aggregations
88

99
context "Range aggregation" do

0 commit comments

Comments
 (0)