From a740841aa455b43a5b2ef6c61b1f4565819246fe Mon Sep 17 00:00:00 2001 From: Herwin Date: Mon, 30 Dec 2024 15:45:15 +0100 Subject: [PATCH] Cleanup shared/enumerator Moved all contents to core/enumerator/shared. Also fixed the spec for Enumerator#to_enum, which used the wrong method. --- core/enumerator/each_with_index_spec.rb | 2 +- core/enumerator/each_with_object_spec.rb | 2 +- core/enumerator/enum_for_spec.rb | 2 +- {fixtures/enumerator => core/enumerator/fixtures}/classes.rb | 0 {shared/enumerator => core/enumerator/shared}/enum_for.rb | 0 {shared/enumerator => core/enumerator/shared}/with_index.rb | 4 ++-- {shared/enumerator => core/enumerator/shared}/with_object.rb | 2 +- core/enumerator/to_enum_spec.rb | 4 ++-- core/enumerator/with_index_spec.rb | 2 +- core/enumerator/with_object_spec.rb | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) rename {fixtures/enumerator => core/enumerator/fixtures}/classes.rb (100%) rename {shared/enumerator => core/enumerator/shared}/enum_for.rb (100%) rename {shared/enumerator => core/enumerator/shared}/with_index.rb (89%) rename {shared/enumerator => core/enumerator/shared}/with_object.rb (96%) diff --git a/core/enumerator/each_with_index_spec.rb b/core/enumerator/each_with_index_spec.rb index 271e61fec6..4898e86fa9 100644 --- a/core/enumerator/each_with_index_spec.rb +++ b/core/enumerator/each_with_index_spec.rb @@ -1,5 +1,5 @@ require_relative '../../spec_helper' -require_relative '../../shared/enumerator/with_index' +require_relative 'shared/with_index' require_relative '../enumerable/shared/enumeratorized' describe "Enumerator#each_with_index" do diff --git a/core/enumerator/each_with_object_spec.rb b/core/enumerator/each_with_object_spec.rb index 68524dc74a..84a45ae89d 100644 --- a/core/enumerator/each_with_object_spec.rb +++ b/core/enumerator/each_with_object_spec.rb @@ -1,5 +1,5 @@ require_relative '../../spec_helper' -require_relative '../../shared/enumerator/with_object' +require_relative 'shared/with_object' describe "Enumerator#each_with_object" do it_behaves_like :enum_with_object, :each_with_object diff --git a/core/enumerator/enum_for_spec.rb b/core/enumerator/enum_for_spec.rb index fd33f463bf..fbdf98545a 100644 --- a/core/enumerator/enum_for_spec.rb +++ b/core/enumerator/enum_for_spec.rb @@ -1,5 +1,5 @@ require_relative '../../spec_helper' -require_relative '../../shared/enumerator/enum_for' +require_relative 'shared/enum_for' describe "Enumerator#enum_for" do it_behaves_like :enum_for, :enum_for diff --git a/fixtures/enumerator/classes.rb b/core/enumerator/fixtures/classes.rb similarity index 100% rename from fixtures/enumerator/classes.rb rename to core/enumerator/fixtures/classes.rb diff --git a/shared/enumerator/enum_for.rb b/core/enumerator/shared/enum_for.rb similarity index 100% rename from shared/enumerator/enum_for.rb rename to core/enumerator/shared/enum_for.rb diff --git a/shared/enumerator/with_index.rb b/core/enumerator/shared/with_index.rb similarity index 89% rename from shared/enumerator/with_index.rb rename to core/enumerator/shared/with_index.rb index 89f40070e0..78771ffe82 100644 --- a/shared/enumerator/with_index.rb +++ b/core/enumerator/shared/with_index.rb @@ -1,8 +1,8 @@ -require_relative '../../spec_helper' +require_relative '../../../spec_helper' describe :enum_with_index, shared: true do - require_relative '../../fixtures/enumerator/classes' + require_relative '../fixtures/classes' before :each do @origin = [1, 2, 3, 4] diff --git a/shared/enumerator/with_object.rb b/core/enumerator/shared/with_object.rb similarity index 96% rename from shared/enumerator/with_object.rb rename to core/enumerator/shared/with_object.rb index c2e3a79366..d8e9d8e9f7 100644 --- a/shared/enumerator/with_object.rb +++ b/core/enumerator/shared/with_object.rb @@ -1,4 +1,4 @@ -require_relative '../../spec_helper' +require_relative '../../../spec_helper' describe :enum_with_object, shared: true do before :each do diff --git a/core/enumerator/to_enum_spec.rb b/core/enumerator/to_enum_spec.rb index cadfcf6314..7fb73d0c3c 100644 --- a/core/enumerator/to_enum_spec.rb +++ b/core/enumerator/to_enum_spec.rb @@ -1,6 +1,6 @@ require_relative '../../spec_helper' -require_relative '../../shared/enumerator/enum_for' +require_relative 'shared/enum_for' describe "Enumerator#to_enum" do - it_behaves_like :enum_for, :enum_for + it_behaves_like :enum_for, :to_enum end diff --git a/core/enumerator/with_index_spec.rb b/core/enumerator/with_index_spec.rb index 3aeb3fc869..e49aa7a939 100644 --- a/core/enumerator/with_index_spec.rb +++ b/core/enumerator/with_index_spec.rb @@ -1,5 +1,5 @@ require_relative '../../spec_helper' -require_relative '../../shared/enumerator/with_index' +require_relative 'shared/with_index' require_relative '../enumerable/shared/enumeratorized' describe "Enumerator#with_index" do diff --git a/core/enumerator/with_object_spec.rb b/core/enumerator/with_object_spec.rb index e7ba83fd9f..58031fd765 100644 --- a/core/enumerator/with_object_spec.rb +++ b/core/enumerator/with_object_spec.rb @@ -1,5 +1,5 @@ require_relative '../../spec_helper' -require_relative '../../shared/enumerator/with_object' +require_relative 'shared/with_object' describe "Enumerator#with_object" do it_behaves_like :enum_with_object, :with_object