Skip to content

Commit 6565c83

Browse files
author
Kevin Kirsche
committed
Fix tests
1 parent 36018fd commit 6565c83

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

elasticsearch-api/test/unit/exists_document_test.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ class ExistsTest < ::Test::Unit::TestCase
99

1010
should "require the :index argument" do
1111
assert_raise ArgumentError do
12-
subject.exists :type => 'bar', :id => '1'
12+
subject.exists? :type => 'bar', :id => '1'
1313
end
1414
end
1515

1616
should "NOT require the :type argument" do
1717
assert_nothing_raised do
18-
subject.exists :index => 'foo', :id => '1'
18+
subject.exists? :index => 'foo', :id => '1'
1919
end
2020
end
2121

2222
should "require the :id argument" do
2323
assert_raise ArgumentError do
24-
subject.exists :index => 'foo', :type => 'bar'
24+
subject.exists? :index => 'foo', :type => 'bar'
2525
end
2626
end
2727

@@ -34,7 +34,7 @@ class ExistsTest < ::Test::Unit::TestCase
3434
true
3535
end.returns(FakeResponse.new)
3636

37-
subject.exists :index => 'foo', :type => 'bar', :id => '1'
37+
subject.exists? :index => 'foo', :type => 'bar', :id => '1'
3838
end
3939

4040
should "pass the URL parameters" do
@@ -44,7 +44,7 @@ class ExistsTest < ::Test::Unit::TestCase
4444
true
4545
end.returns(FakeResponse.new)
4646

47-
subject.exists :index => 'foo', :type => 'bar', :id => '1', :routing => 'abc123'
47+
subject.exists? :index => 'foo', :type => 'bar', :id => '1', :routing => 'abc123'
4848
end
4949

5050
should "URL-escape the parts" do
@@ -53,28 +53,28 @@ class ExistsTest < ::Test::Unit::TestCase
5353
true
5454
end.returns(FakeResponse.new)
5555

56-
subject.exists :index => 'foo', :type => 'bar/bam', :id => '1'
56+
subject.exists? :index => 'foo', :type => 'bar/bam', :id => '1'
5757
end
5858

5959
should "return true for successful response" do
6060
subject.expects(:perform_request).returns(FakeResponse.new 200, 'OK')
61-
assert_equal true, subject.exists(:index => 'foo', :type => 'bar', :id => '1')
61+
assert_equal true, subject.exists?(:index => 'foo', :type => 'bar', :id => '1')
6262
end
6363

6464
should "return false for 404 response" do
6565
subject.expects(:perform_request).returns(FakeResponse.new 404, 'Not Found')
66-
assert_equal false, subject.exists(:index => 'foo', :type => 'bar', :id => '1')
66+
assert_equal false, subject.exists?(:index => 'foo', :type => 'bar', :id => '1')
6767
end
6868

6969
should "return false on 'not found' exceptions" do
7070
subject.expects(:perform_request).raises(StandardError.new '404 NotFound')
71-
assert_equal false, subject.exists(:index => 'foo', :type => 'bar', :id => '1')
71+
assert_equal false, subject.exists?(:index => 'foo', :type => 'bar', :id => '1')
7272
end
7373

7474
should "re-raise generic exceptions" do
7575
subject.expects(:perform_request).raises(StandardError)
7676
assert_raise(StandardError) do
77-
assert_equal false, subject.exists(:index => 'foo', :type => 'bar', :id => '1')
77+
assert_equal false, subject.exists?(:index => 'foo', :type => 'bar', :id => '1')
7878
end
7979
end
8080

elasticsearch-api/test/unit/indices/exists_alias_test.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class IndicesExistsAliasTest < ::Test::Unit::TestCase
1616
true
1717
end.returns(FakeResponse.new)
1818

19-
subject.indices.exists_alias :name => 'foo'
19+
subject.indices.exists_alias? :name => 'foo'
2020
end
2121

2222
should "perform request against multiple indices" do
@@ -25,7 +25,7 @@ class IndicesExistsAliasTest < ::Test::Unit::TestCase
2525
true
2626
end.returns(FakeResponse.new)
2727

28-
subject.indices.exists_alias :index => ['foo','bar'], :name => 'bam'
28+
subject.indices.exists_alias? :index => ['foo','bar'], :name => 'bam'
2929
end
3030

3131
should "URL-escape the parts" do
@@ -34,30 +34,30 @@ class IndicesExistsAliasTest < ::Test::Unit::TestCase
3434
true
3535
end.returns(FakeResponse.new)
3636

37-
subject.indices.exists_alias :index => 'foo^bar', :name => 'bar/bam'
37+
subject.indices.exists_alias? :index => 'foo^bar', :name => 'bar/bam'
3838
end
3939

4040
should "return true for successful response" do
4141
subject.expects(:perform_request).returns(FakeResponse.new 200, 'OK')
42-
assert_equal true, subject.indices.exists_alias(:name => 'foo')
42+
assert_equal true, subject.indices.exists_alias?(:name => 'foo')
4343
end
4444

4545
should "return false for 404 response" do
4646
subject.expects(:perform_request).returns(FakeResponse.new 404, 'Not Found')
47-
assert_equal false, subject.indices.exists_alias(:name => 'none')
47+
assert_equal false, subject.indices.exists_alias?(:name => 'none')
4848
end
4949

5050
should "return false on 'not found' exceptions" do
5151
subject.expects(:perform_request).raises(StandardError.new '404 NotFound')
5252
assert_nothing_raised do
53-
assert_equal false, subject.indices.exists_alias(:name => 'none')
53+
assert_equal false, subject.indices.exists_alias?(:name => 'none')
5454
end
5555
end
5656

5757
should "re-raise generic exceptions" do
5858
subject.expects(:perform_request).raises(StandardError)
5959
assert_raise(StandardError) do
60-
assert_equal false, subject.indices.exists_alias(:name => 'none')
60+
assert_equal false, subject.indices.exists_alias?(:name => 'none')
6161
end
6262
end
6363

elasticsearch-api/test/unit/indices/exists_test.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class IndicesExistsTest < ::Test::Unit::TestCase
1616
true
1717
end.returns(FakeResponse.new)
1818

19-
subject.indices.exists(:index => 'foo')
19+
subject.indices.exists?(:index => 'foo')
2020
end
2121

2222
should "perform the request against multiple indices" do
@@ -25,7 +25,7 @@ class IndicesExistsTest < ::Test::Unit::TestCase
2525
true
2626
end.returns(FakeResponse.new)
2727

28-
subject.indices.exists(:index => ['foo', 'bar'])
28+
subject.indices.exists?(:index => ['foo', 'bar'])
2929
end
3030

3131
should "URL-escape the parts" do
@@ -34,28 +34,28 @@ class IndicesExistsTest < ::Test::Unit::TestCase
3434
true
3535
end.returns(FakeResponse.new)
3636

37-
subject.indices.exists :index => 'foo^bar,bar/bam'
37+
subject.indices.exists? :index => 'foo^bar,bar/bam'
3838
end
3939

4040
should "return true for successful response" do
4141
subject.expects(:perform_request).returns(FakeResponse.new 200, 'OK')
42-
assert_equal true, subject.indices.exists(:index => 'foo')
42+
assert_equal true, subject.indices.exists?(:index => 'foo')
4343
end
4444

4545
should "return false for 404 response" do
4646
subject.expects(:perform_request).returns(FakeResponse.new 404, 'Not Found')
47-
assert_equal false, subject.indices.exists(:index => 'none')
47+
assert_equal false, subject.indices.exists?(:index => 'none')
4848
end
4949

5050
should "return false on 'not found' exceptions" do
5151
subject.expects(:perform_request).raises(StandardError.new '404 NotFound')
52-
assert_equal false, subject.indices.exists(:index => 'none')
52+
assert_equal false, subject.indices.exists?(:index => 'none')
5353
end
5454

5555
should "re-raise generic exceptions" do
5656
subject.expects(:perform_request).raises(StandardError)
5757
assert_raise(StandardError) do
58-
assert_equal false, subject.indices.exists(:index => 'none')
58+
assert_equal false, subject.indices.exists?(:index => 'none')
5959
end
6060
end
6161

elasticsearch-api/test/unit/indices/exists_type_test.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class IndicesExistsTypeTest < ::Test::Unit::TestCase
1616
true
1717
end.returns(FakeResponse.new)
1818

19-
subject.indices.exists_type :index => 'foo', :type => 'bar'
19+
subject.indices.exists_type? :index => 'foo', :type => 'bar'
2020
end
2121

2222
should "perform request against multiple indices" do
@@ -25,7 +25,7 @@ class IndicesExistsTypeTest < ::Test::Unit::TestCase
2525
true
2626
end.returns(FakeResponse.new)
2727

28-
subject.indices.exists_type :index => ['foo','bar'], :type => 'bam'
28+
subject.indices.exists_type? :index => ['foo','bar'], :type => 'bam'
2929
end
3030

3131
should "URL-escape the parts" do
@@ -34,30 +34,30 @@ class IndicesExistsTypeTest < ::Test::Unit::TestCase
3434
true
3535
end.returns(FakeResponse.new)
3636

37-
subject.indices.exists_type :index => 'foo^bar', :type => 'bar/bam'
37+
subject.indices.exists_type? :index => 'foo^bar', :type => 'bar/bam'
3838
end
3939

4040
should "return true for successful response" do
4141
subject.expects(:perform_request).returns(FakeResponse.new 200, 'OK')
42-
assert_equal true, subject.indices.exists_type(:index => 'foo', :type => 'bar')
42+
assert_equal true, subject.indices.exists_type?(:index => 'foo', :type => 'bar')
4343
end
4444

4545
should "return false for 404 response" do
4646
subject.expects(:perform_request).returns(FakeResponse.new 404, 'Not Found')
47-
assert_equal false, subject.indices.exists_type(:index => 'foo', :type => 'none')
47+
assert_equal false, subject.indices.exists_type?(:index => 'foo', :type => 'none')
4848
end
4949

5050
should "return false on 'not found' exceptions" do
5151
subject.expects(:perform_request).raises(StandardError.new '404 NotFound')
5252
assert_nothing_raised do
53-
assert_equal false, subject.indices.exists_type(:index => 'foo', :type => 'none')
53+
assert_equal false, subject.indices.exists_type?(:index => 'foo', :type => 'none')
5454
end
5555
end
5656

5757
should "re-raise generic exceptions" do
5858
subject.expects(:perform_request).raises(StandardError)
5959
assert_raise(StandardError) do
60-
assert_equal false, subject.indices.exists_type(:index => 'foo', :type => 'none')
60+
assert_equal false, subject.indices.exists_type?(:index => 'foo', :type => 'none')
6161
end
6262
end
6363

0 commit comments

Comments
 (0)