Skip to content

Commit

Permalink
move example_type initialization logic to run_rspec file
Browse files Browse the repository at this point in the history
  • Loading branch information
Judahmeek committed Jun 27, 2024
1 parent 6a640c5 commit 2726d61
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
7 changes: 7 additions & 0 deletions rakelib/run_rspec.rake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ require_relative "example_type"
# rubocop:disable Metrics/BlockLength
namespace :run_rspec do
include ReactOnRails::TaskHelpers
# Loads data from examples_config.yml and instantiates corresponding ExampleType objects
examples_config_file = File.expand_path("examples_config.yml", __dir__)
examples_config = symbolize_keys(YAML.safe_load_file(examples_config_file))
examples_config[:example_type_data].each do |example_type_data|
ExampleType.new(packer_type: "shakapacker_examples", **symbolize_keys(example_type_data))
ExampleType.new(packer_type: "webpacker_examples", **symbolize_keys(example_type_data))
end

spec_dummy_dir = File.join("spec", "dummy")

Expand Down
6 changes: 0 additions & 6 deletions rakelib/shakapacker_examples.rake
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ require_relative "task_helpers"

namespace :shakapacker_examples do # rubocop:disable Metrics/BlockLength
include ReactOnRails::TaskHelpers
# Loads data from examples_config.yml and instantiates corresponding ExampleType objects
examples_config_file = File.expand_path("examples_config.yml", __dir__)
examples_config = symbolize_keys(YAML.safe_load_file(examples_config_file))
examples_config[:example_type_data].each do |example_type_data|
ExampleType.new(packer_type: "shakapacker_examples", **symbolize_keys(example_type_data))
end

# Define tasks for each example type
ExampleType.all[:shakapacker_examples].each do |example_type|
Expand Down
6 changes: 0 additions & 6 deletions rakelib/webpacker_examples.rake
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ require_relative "task_helpers"

namespace :webpacker_examples do # rubocop:disable Metrics/BlockLength
include ReactOnRails::TaskHelpers
# Loads data from examples_config.yml and instantiates corresponding ExampleType objects
examples_config_file = File.expand_path("examples_config.yml", __dir__)
examples_config = symbolize_keys(YAML.safe_load_file(examples_config_file))
examples_config[:example_type_data].each do |example_type_data|
ExampleType.new(packer_type: "webpacker_examples", **symbolize_keys(example_type_data))
end

# Define tasks for each example type
ExampleType.all[:webpacker_examples].each do |example_type|
Expand Down

0 comments on commit 2726d61

Please sign in to comment.