@@ -676,15 +676,13 @@ class ::DummyIndexingModelForRecreate
676
676
end
677
677
678
678
context 'when the index is not found' do
679
+ let ( :logger ) { nil }
680
+ let ( :transport ) do
681
+ Elasticsearch ::Transport ::Client . new ( logger : logger )
682
+ end
683
+
679
684
let ( :client ) do
680
- double (
681
- 'client' ,
682
- indices : indices ,
683
- transport : double (
684
- 'transport' ,
685
- double ( 'transport' , { logger : nil } )
686
- )
687
- )
685
+ double ( 'client' , indices : indices , transport : transport )
688
686
end
689
687
690
688
let ( :indices ) do
@@ -698,19 +696,17 @@ class ::DummyIndexingModelForRecreate
698
696
end
699
697
700
698
context 'when the force option is true' do
701
-
702
699
it 'deletes the index without raising an exception' do
703
700
expect ( DummyIndexingModelForRecreate . delete_index! ( force : true ) ) . to be_nil
704
701
end
705
702
706
703
context 'when the client has a logger' do
707
-
708
704
let ( :logger ) do
709
705
Logger . new ( STDOUT ) . tap { |l | l . level = Logger ::DEBUG }
710
706
end
711
707
712
708
let ( :client ) do
713
- double ( 'client' , indices : indices , transport : double ( ' transport' , { logger : logger } ) )
709
+ double ( 'client' , indices : indices , transport : transport )
714
710
end
715
711
716
712
it 'deletes the index without raising an exception' do
@@ -918,7 +914,11 @@ class ::DummyIndexingModelForRefresh
918
914
end
919
915
920
916
let ( :client ) do
921
- double ( 'client' , indices : indices , transport : double ( 'transport' , { logger : nil } ) )
917
+ double ( 'client' , indices : indices , transport : transport )
918
+ end
919
+
920
+ let ( :transport ) do
921
+ Elasticsearch ::Transport ::Client . new ( logger : nil )
922
922
end
923
923
924
924
let ( :indices ) do
@@ -930,9 +930,7 @@ class ::DummyIndexingModelForRefresh
930
930
end
931
931
932
932
context 'when the force option is true' do
933
-
934
933
context 'when the operation raises a NotFound exception' do
935
-
936
934
before do
937
935
expect ( indices ) . to receive ( :refresh ) . and_raise ( NotFound )
938
936
end
@@ -942,13 +940,16 @@ class ::DummyIndexingModelForRefresh
942
940
end
943
941
944
942
context 'when the client has a logger' do
945
-
946
943
let ( :logger ) do
947
944
Logger . new ( STDOUT ) . tap { |l | l . level = Logger ::DEBUG }
948
945
end
949
946
950
947
let ( :client ) do
951
- double ( 'client' , indices : indices , transport : double ( 'transport' , { logger : logger } ) )
948
+ double ( 'client' , indices : indices , transport : transport )
949
+ end
950
+
951
+ let ( :transport ) do
952
+ Elasticsearch ::Transport ::Client . new ( logger : logger )
952
953
end
953
954
954
955
it 'does not raise an exception' do
@@ -963,7 +964,6 @@ class ::DummyIndexingModelForRefresh
963
964
end
964
965
965
966
context 'when the operation raises another type of exception' do
966
-
967
967
before do
968
968
expect ( indices ) . to receive ( :refresh ) . and_raise ( Exception )
969
969
end
@@ -977,7 +977,6 @@ class ::DummyIndexingModelForRefresh
977
977
end
978
978
979
979
context 'when an index name is provided in the options' do
980
-
981
980
before do
982
981
expect ( indices ) . to receive ( :refresh ) . with ( index : 'custom-foo' )
983
982
end
0 commit comments