From 46c86cda58826b9e60118a660055bc0804b84bb8 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Sat, 12 Mar 2022 14:00:07 +0100 Subject: [PATCH 1/4] Move to new coverage approach --- .github/workflows/plugin-tests.yml | 7 +- .simplecov | 6 ++ .../controllers}/custom_wizard/admin/admin.rb | 0 .../controllers}/custom_wizard/admin/api.rb | 0 .../custom_wizard/admin/custom_fields.rb | 0 .../controllers}/custom_wizard/admin/logs.rb | 0 .../custom_wizard/admin/manager.rb | 0 .../custom_wizard/admin/submissions.rb | 0 .../custom_wizard/admin/wizard.rb | 0 .../custom_wizard/realtime_validations.rb | 0 .../controllers}/custom_wizard/steps.rb | 0 .../controllers}/custom_wizard/wizard.rb | 2 +- .../jobs}/refresh_api_access_token.rb | 0 {jobs => app/jobs}/set_after_time_wizard.rb | 0 .../api/authorization_serializer.rb | 0 .../api/basic_endpoint_serializer.rb | 0 .../custom_wizard/api/endpoint_serializer.rb | 0 .../custom_wizard/api/log_serializer.rb | 0 .../custom_wizard/api_serializer.rb | 0 .../custom_wizard/basic_api_serializer.rb | 0 .../custom_wizard/basic_wizard_serializer.rb | 0 .../custom_wizard/custom_field_serializer.rb | 0 .../custom_wizard/log_serializer.rb | 0 .../similar_topics_serializer.rb | 0 .../custom_wizard/submission_serializer.rb | 0 .../custom_wizard/wizard_field_serializer.rb | 0 .../custom_wizard/wizard_serializer.rb | 0 .../custom_wizard/wizard_step_serializer.rb | 0 {views => app/views}/layouts/wizard.html.erb | 0 coverage/.last_run.json | 2 +- .../extensions}/custom_field/extension.rb | 0 .../extensions}/custom_field/preloader.rb | 0 .../extensions}/custom_field/serializer.rb | 0 .../extensions}/discourse_tagging.rb | 0 .../extensions}/extra_locales_controller.rb | 0 .../custom_wizard/extensions}/guardian.rb | 0 .../extensions}/invites_controller.rb | 0 .../extensions}/tags_controller.rb | 0 .../extensions}/users_controller.rb | 0 plugin.rb | 70 +++++++++---------- spec/components/custom_wizard/action_spec.rb | 1 - spec/components/custom_wizard/builder_spec.rb | 1 - spec/components/custom_wizard/cache_spec.rb | 2 - .../custom_wizard/custom_field_spec.rb | 2 - spec/components/custom_wizard/field_spec.rb | 1 - spec/components/custom_wizard/log_spec.rb | 1 - spec/components/custom_wizard/mapper_spec.rb | 1 - .../custom_wizard/realtime_validation_spec.rb | 2 - .../similar_topics_spec.rb | 2 - spec/components/custom_wizard/step_spec.rb | 1 - .../custom_wizard/submission_spec.rb | 1 - .../components/custom_wizard/template_spec.rb | 1 - .../custom_wizard/template_validator_spec.rb | 1 - .../custom_wizard/update_validator_spec.rb | 1 - spec/components/custom_wizard/wizard_spec.rb | 2 - .../custom_field_extensions_spec.rb | 2 - .../extra_locales_controller_spec.rb | 1 - spec/extensions/guardian_extension_spec.rb | 2 - spec/extensions/invites_controller_spec.rb | 1 - spec/extensions/sprockets_directive_spec.rb | 2 - spec/extensions/tags_controller_spec.rb | 2 - spec/extensions/users_controller_spec.rb | 1 - spec/jobs/set_after_time_wizard_spec.rb | 2 - spec/plugin_helper.rb | 17 ----- .../admin/custom_fields_controller_spec.rb | 1 - .../admin/logs_controller_spec.rb | 1 - .../admin/manager_controller_spec.rb | 1 - .../admin/submissions_controller_spec.rb | 1 - .../admin/wizard_controller_spec.rb | 1 - .../application_controller_spec.rb | 1 - .../custom_field_extensions_spec.rb | 2 - .../realtime_validations_spec.rb | 2 - .../custom_wizard/steps_controller_spec.rb | 1 - .../custom_wizard/wizard_controller_spec.rb | 1 - .../basic_wizard_serializer_spec.rb | 2 - .../custom_field_serializer_spec.rb | 2 - .../custom_wizard/log_serializer_spec.rb | 2 - .../wizard_field_serializer_spec.rb | 2 - .../custom_wizard/wizard_serializer_spec.rb | 2 - .../wizard_step_serializer_spec.rb | 2 - 80 files changed, 49 insertions(+), 112 deletions(-) create mode 100644 .simplecov rename {controllers => app/controllers}/custom_wizard/admin/admin.rb (100%) rename {controllers => app/controllers}/custom_wizard/admin/api.rb (100%) rename {controllers => app/controllers}/custom_wizard/admin/custom_fields.rb (100%) rename {controllers => app/controllers}/custom_wizard/admin/logs.rb (100%) rename {controllers => app/controllers}/custom_wizard/admin/manager.rb (100%) rename {controllers => app/controllers}/custom_wizard/admin/submissions.rb (100%) rename {controllers => app/controllers}/custom_wizard/admin/wizard.rb (100%) rename {controllers => app/controllers}/custom_wizard/realtime_validations.rb (100%) rename {controllers => app/controllers}/custom_wizard/steps.rb (100%) rename {controllers => app/controllers}/custom_wizard/wizard.rb (98%) rename {jobs => app/jobs}/refresh_api_access_token.rb (100%) rename {jobs => app/jobs}/set_after_time_wizard.rb (100%) rename {serializers => app/serializers}/custom_wizard/api/authorization_serializer.rb (100%) rename {serializers => app/serializers}/custom_wizard/api/basic_endpoint_serializer.rb (100%) rename {serializers => app/serializers}/custom_wizard/api/endpoint_serializer.rb (100%) rename {serializers => app/serializers}/custom_wizard/api/log_serializer.rb (100%) rename {serializers => app/serializers}/custom_wizard/api_serializer.rb (100%) rename {serializers => app/serializers}/custom_wizard/basic_api_serializer.rb (100%) rename {serializers => app/serializers}/custom_wizard/basic_wizard_serializer.rb (100%) rename {serializers => app/serializers}/custom_wizard/custom_field_serializer.rb (100%) rename {serializers => app/serializers}/custom_wizard/log_serializer.rb (100%) rename {serializers => app/serializers}/custom_wizard/realtime_validation/similar_topics_serializer.rb (100%) rename {serializers => app/serializers}/custom_wizard/submission_serializer.rb (100%) rename {serializers => app/serializers}/custom_wizard/wizard_field_serializer.rb (100%) rename {serializers => app/serializers}/custom_wizard/wizard_serializer.rb (100%) rename {serializers => app/serializers}/custom_wizard/wizard_step_serializer.rb (100%) rename {views => app/views}/layouts/wizard.html.erb (100%) rename {extensions => lib/custom_wizard/extensions}/custom_field/extension.rb (100%) rename {extensions => lib/custom_wizard/extensions}/custom_field/preloader.rb (100%) rename {extensions => lib/custom_wizard/extensions}/custom_field/serializer.rb (100%) rename {extensions => lib/custom_wizard/extensions}/discourse_tagging.rb (100%) rename {extensions => lib/custom_wizard/extensions}/extra_locales_controller.rb (100%) rename {extensions => lib/custom_wizard/extensions}/guardian.rb (100%) rename {extensions => lib/custom_wizard/extensions}/invites_controller.rb (100%) rename {extensions => lib/custom_wizard/extensions}/tags_controller.rb (100%) rename {extensions => lib/custom_wizard/extensions}/users_controller.rb (100%) delete mode 100644 spec/plugin_helper.rb diff --git a/.github/workflows/plugin-tests.yml b/.github/workflows/plugin-tests.yml index aec4fa6c..18f09d5d 100644 --- a/.github/workflows/plugin-tests.yml +++ b/.github/workflows/plugin-tests.yml @@ -141,7 +141,12 @@ jobs: - name: Plugin RSpec with Coverage if: matrix.build_type == 'backend' && steps.check_spec.outputs.files_exists == 'true' - run: SIMPLECOV=1 bin/rake plugin:spec[${{ steps.repo-name.outputs.value }}] + run: | + if [ -e plugins/${{ steps.repo-name.outputs.value }}/.simplecov ] + cp plugins/${{ steps.repo-name.outputs.value }}/.simplecov .simplecov + export COVERAGE=1 + fi + bin/rake plugin:spec[${{ steps.repo-name.outputs.value }}] - name: Plugin QUnit if: matrix.build_type == 'frontend' && steps.check_qunit.outputs.files_exists == 'true' diff --git a/.simplecov b/.simplecov new file mode 100644 index 00000000..18b59116 --- /dev/null +++ b/.simplecov @@ -0,0 +1,6 @@ +plugin = "discourse-custom-wizard" + +SimpleCov.configure do + track_files "plugins/#{plugin}/**/*.rb" + add_filter { |src| !(src.filename =~ /(\/#{plugin}\/app\/|\/#{plugin}\/lib\/)/) } +end diff --git a/controllers/custom_wizard/admin/admin.rb b/app/controllers/custom_wizard/admin/admin.rb similarity index 100% rename from controllers/custom_wizard/admin/admin.rb rename to app/controllers/custom_wizard/admin/admin.rb diff --git a/controllers/custom_wizard/admin/api.rb b/app/controllers/custom_wizard/admin/api.rb similarity index 100% rename from controllers/custom_wizard/admin/api.rb rename to app/controllers/custom_wizard/admin/api.rb diff --git a/controllers/custom_wizard/admin/custom_fields.rb b/app/controllers/custom_wizard/admin/custom_fields.rb similarity index 100% rename from controllers/custom_wizard/admin/custom_fields.rb rename to app/controllers/custom_wizard/admin/custom_fields.rb diff --git a/controllers/custom_wizard/admin/logs.rb b/app/controllers/custom_wizard/admin/logs.rb similarity index 100% rename from controllers/custom_wizard/admin/logs.rb rename to app/controllers/custom_wizard/admin/logs.rb diff --git a/controllers/custom_wizard/admin/manager.rb b/app/controllers/custom_wizard/admin/manager.rb similarity index 100% rename from controllers/custom_wizard/admin/manager.rb rename to app/controllers/custom_wizard/admin/manager.rb diff --git a/controllers/custom_wizard/admin/submissions.rb b/app/controllers/custom_wizard/admin/submissions.rb similarity index 100% rename from controllers/custom_wizard/admin/submissions.rb rename to app/controllers/custom_wizard/admin/submissions.rb diff --git a/controllers/custom_wizard/admin/wizard.rb b/app/controllers/custom_wizard/admin/wizard.rb similarity index 100% rename from controllers/custom_wizard/admin/wizard.rb rename to app/controllers/custom_wizard/admin/wizard.rb diff --git a/controllers/custom_wizard/realtime_validations.rb b/app/controllers/custom_wizard/realtime_validations.rb similarity index 100% rename from controllers/custom_wizard/realtime_validations.rb rename to app/controllers/custom_wizard/realtime_validations.rb diff --git a/controllers/custom_wizard/steps.rb b/app/controllers/custom_wizard/steps.rb similarity index 100% rename from controllers/custom_wizard/steps.rb rename to app/controllers/custom_wizard/steps.rb diff --git a/controllers/custom_wizard/wizard.rb b/app/controllers/custom_wizard/wizard.rb similarity index 98% rename from controllers/custom_wizard/wizard.rb rename to app/controllers/custom_wizard/wizard.rb index 854d1e39..12e6bdff 100644 --- a/controllers/custom_wizard/wizard.rb +++ b/app/controllers/custom_wizard/wizard.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class CustomWizard::WizardController < ::ApplicationController include ApplicationHelper - prepend_view_path(Rails.root.join('plugins', 'discourse-custom-wizard', 'views')) + prepend_view_path(Rails.root.join('plugins', 'discourse-custom-wizard', 'app', 'views')) layout 'wizard' before_action :ensure_plugin_enabled diff --git a/jobs/refresh_api_access_token.rb b/app/jobs/refresh_api_access_token.rb similarity index 100% rename from jobs/refresh_api_access_token.rb rename to app/jobs/refresh_api_access_token.rb diff --git a/jobs/set_after_time_wizard.rb b/app/jobs/set_after_time_wizard.rb similarity index 100% rename from jobs/set_after_time_wizard.rb rename to app/jobs/set_after_time_wizard.rb diff --git a/serializers/custom_wizard/api/authorization_serializer.rb b/app/serializers/custom_wizard/api/authorization_serializer.rb similarity index 100% rename from serializers/custom_wizard/api/authorization_serializer.rb rename to app/serializers/custom_wizard/api/authorization_serializer.rb diff --git a/serializers/custom_wizard/api/basic_endpoint_serializer.rb b/app/serializers/custom_wizard/api/basic_endpoint_serializer.rb similarity index 100% rename from serializers/custom_wizard/api/basic_endpoint_serializer.rb rename to app/serializers/custom_wizard/api/basic_endpoint_serializer.rb diff --git a/serializers/custom_wizard/api/endpoint_serializer.rb b/app/serializers/custom_wizard/api/endpoint_serializer.rb similarity index 100% rename from serializers/custom_wizard/api/endpoint_serializer.rb rename to app/serializers/custom_wizard/api/endpoint_serializer.rb diff --git a/serializers/custom_wizard/api/log_serializer.rb b/app/serializers/custom_wizard/api/log_serializer.rb similarity index 100% rename from serializers/custom_wizard/api/log_serializer.rb rename to app/serializers/custom_wizard/api/log_serializer.rb diff --git a/serializers/custom_wizard/api_serializer.rb b/app/serializers/custom_wizard/api_serializer.rb similarity index 100% rename from serializers/custom_wizard/api_serializer.rb rename to app/serializers/custom_wizard/api_serializer.rb diff --git a/serializers/custom_wizard/basic_api_serializer.rb b/app/serializers/custom_wizard/basic_api_serializer.rb similarity index 100% rename from serializers/custom_wizard/basic_api_serializer.rb rename to app/serializers/custom_wizard/basic_api_serializer.rb diff --git a/serializers/custom_wizard/basic_wizard_serializer.rb b/app/serializers/custom_wizard/basic_wizard_serializer.rb similarity index 100% rename from serializers/custom_wizard/basic_wizard_serializer.rb rename to app/serializers/custom_wizard/basic_wizard_serializer.rb diff --git a/serializers/custom_wizard/custom_field_serializer.rb b/app/serializers/custom_wizard/custom_field_serializer.rb similarity index 100% rename from serializers/custom_wizard/custom_field_serializer.rb rename to app/serializers/custom_wizard/custom_field_serializer.rb diff --git a/serializers/custom_wizard/log_serializer.rb b/app/serializers/custom_wizard/log_serializer.rb similarity index 100% rename from serializers/custom_wizard/log_serializer.rb rename to app/serializers/custom_wizard/log_serializer.rb diff --git a/serializers/custom_wizard/realtime_validation/similar_topics_serializer.rb b/app/serializers/custom_wizard/realtime_validation/similar_topics_serializer.rb similarity index 100% rename from serializers/custom_wizard/realtime_validation/similar_topics_serializer.rb rename to app/serializers/custom_wizard/realtime_validation/similar_topics_serializer.rb diff --git a/serializers/custom_wizard/submission_serializer.rb b/app/serializers/custom_wizard/submission_serializer.rb similarity index 100% rename from serializers/custom_wizard/submission_serializer.rb rename to app/serializers/custom_wizard/submission_serializer.rb diff --git a/serializers/custom_wizard/wizard_field_serializer.rb b/app/serializers/custom_wizard/wizard_field_serializer.rb similarity index 100% rename from serializers/custom_wizard/wizard_field_serializer.rb rename to app/serializers/custom_wizard/wizard_field_serializer.rb diff --git a/serializers/custom_wizard/wizard_serializer.rb b/app/serializers/custom_wizard/wizard_serializer.rb similarity index 100% rename from serializers/custom_wizard/wizard_serializer.rb rename to app/serializers/custom_wizard/wizard_serializer.rb diff --git a/serializers/custom_wizard/wizard_step_serializer.rb b/app/serializers/custom_wizard/wizard_step_serializer.rb similarity index 100% rename from serializers/custom_wizard/wizard_step_serializer.rb rename to app/serializers/custom_wizard/wizard_step_serializer.rb diff --git a/views/layouts/wizard.html.erb b/app/views/layouts/wizard.html.erb similarity index 100% rename from views/layouts/wizard.html.erb rename to app/views/layouts/wizard.html.erb diff --git a/coverage/.last_run.json b/coverage/.last_run.json index 4c7365e8..13a74541 100644 --- a/coverage/.last_run.json +++ b/coverage/.last_run.json @@ -1,5 +1,5 @@ { "result": { - "line": 92.87 + "line": 84.4 } } diff --git a/extensions/custom_field/extension.rb b/lib/custom_wizard/extensions/custom_field/extension.rb similarity index 100% rename from extensions/custom_field/extension.rb rename to lib/custom_wizard/extensions/custom_field/extension.rb diff --git a/extensions/custom_field/preloader.rb b/lib/custom_wizard/extensions/custom_field/preloader.rb similarity index 100% rename from extensions/custom_field/preloader.rb rename to lib/custom_wizard/extensions/custom_field/preloader.rb diff --git a/extensions/custom_field/serializer.rb b/lib/custom_wizard/extensions/custom_field/serializer.rb similarity index 100% rename from extensions/custom_field/serializer.rb rename to lib/custom_wizard/extensions/custom_field/serializer.rb diff --git a/extensions/discourse_tagging.rb b/lib/custom_wizard/extensions/discourse_tagging.rb similarity index 100% rename from extensions/discourse_tagging.rb rename to lib/custom_wizard/extensions/discourse_tagging.rb diff --git a/extensions/extra_locales_controller.rb b/lib/custom_wizard/extensions/extra_locales_controller.rb similarity index 100% rename from extensions/extra_locales_controller.rb rename to lib/custom_wizard/extensions/extra_locales_controller.rb diff --git a/extensions/guardian.rb b/lib/custom_wizard/extensions/guardian.rb similarity index 100% rename from extensions/guardian.rb rename to lib/custom_wizard/extensions/guardian.rb diff --git a/extensions/invites_controller.rb b/lib/custom_wizard/extensions/invites_controller.rb similarity index 100% rename from extensions/invites_controller.rb rename to lib/custom_wizard/extensions/invites_controller.rb diff --git a/extensions/tags_controller.rb b/lib/custom_wizard/extensions/tags_controller.rb similarity index 100% rename from extensions/tags_controller.rb rename to lib/custom_wizard/extensions/tags_controller.rb diff --git a/extensions/users_controller.rb b/lib/custom_wizard/extensions/users_controller.rb similarity index 100% rename from extensions/users_controller.rb rename to lib/custom_wizard/extensions/users_controller.rb diff --git a/plugin.rb b/plugin.rb index b5eb348d..d819e9c4 100644 --- a/plugin.rb +++ b/plugin.rb @@ -57,18 +57,18 @@ after_initialize do %w[ ../lib/custom_wizard/engine.rb ../config/routes.rb - ../controllers/custom_wizard/admin/admin.rb - ../controllers/custom_wizard/admin/wizard.rb - ../controllers/custom_wizard/admin/submissions.rb - ../controllers/custom_wizard/admin/api.rb - ../controllers/custom_wizard/admin/logs.rb - ../controllers/custom_wizard/admin/manager.rb - ../controllers/custom_wizard/admin/custom_fields.rb - ../controllers/custom_wizard/wizard.rb - ../controllers/custom_wizard/steps.rb - ../controllers/custom_wizard/realtime_validations.rb - ../jobs/refresh_api_access_token.rb - ../jobs/set_after_time_wizard.rb + ../app/controllers/custom_wizard/admin/admin.rb + ../app/controllers/custom_wizard/admin/wizard.rb + ../app/controllers/custom_wizard/admin/submissions.rb + ../app/controllers/custom_wizard/admin/api.rb + ../app/controllers/custom_wizard/admin/logs.rb + ../app/controllers/custom_wizard/admin/manager.rb + ../app/controllers/custom_wizard/admin/custom_fields.rb + ../app/controllers/custom_wizard/wizard.rb + ../app/controllers/custom_wizard/steps.rb + ../app/controllers/custom_wizard/realtime_validations.rb + ../app/jobs/refresh_api_access_token.rb + ../app/jobs/set_after_time_wizard.rb ../lib/custom_wizard/validators/template.rb ../lib/custom_wizard/validators/update.rb ../lib/custom_wizard/action_result.rb @@ -93,29 +93,29 @@ after_initialize do ../lib/custom_wizard/api/log_entry.rb ../lib/custom_wizard/liquid_extensions/first_non_empty.rb ../lib/custom_wizard/exceptions/exceptions.rb - ../serializers/custom_wizard/api/authorization_serializer.rb - ../serializers/custom_wizard/api/basic_endpoint_serializer.rb - ../serializers/custom_wizard/api/endpoint_serializer.rb - ../serializers/custom_wizard/api/log_serializer.rb - ../serializers/custom_wizard/api_serializer.rb - ../serializers/custom_wizard/basic_api_serializer.rb - ../serializers/custom_wizard/basic_wizard_serializer.rb - ../serializers/custom_wizard/custom_field_serializer.rb - ../serializers/custom_wizard/wizard_field_serializer.rb - ../serializers/custom_wizard/wizard_step_serializer.rb - ../serializers/custom_wizard/wizard_serializer.rb - ../serializers/custom_wizard/log_serializer.rb - ../serializers/custom_wizard/submission_serializer.rb - ../serializers/custom_wizard/realtime_validation/similar_topics_serializer.rb - ../extensions/extra_locales_controller.rb - ../extensions/invites_controller.rb - ../extensions/guardian.rb - ../extensions/users_controller.rb - ../extensions/tags_controller.rb - ../extensions/custom_field/preloader.rb - ../extensions/custom_field/serializer.rb - ../extensions/custom_field/extension.rb - ../extensions/discourse_tagging.rb + ../app/serializers/custom_wizard/api/authorization_serializer.rb + ../app/serializers/custom_wizard/api/basic_endpoint_serializer.rb + ../app/serializers/custom_wizard/api/endpoint_serializer.rb + ../app/serializers/custom_wizard/api/log_serializer.rb + ../app/serializers/custom_wizard/api_serializer.rb + ../app/serializers/custom_wizard/basic_api_serializer.rb + ../app/serializers/custom_wizard/basic_wizard_serializer.rb + ../app/serializers/custom_wizard/custom_field_serializer.rb + ../app/serializers/custom_wizard/wizard_field_serializer.rb + ../app/serializers/custom_wizard/wizard_step_serializer.rb + ../app/serializers/custom_wizard/wizard_serializer.rb + ../app/serializers/custom_wizard/log_serializer.rb + ../app/serializers/custom_wizard/submission_serializer.rb + ../app/serializers/custom_wizard/realtime_validation/similar_topics_serializer.rb + ../lib/custom_wizard/extensions/extra_locales_controller.rb + ../lib/custom_wizard/extensions/invites_controller.rb + ../lib/custom_wizard/extensions/guardian.rb + ../lib/custom_wizard/extensions/users_controller.rb + ../lib/custom_wizard/extensions/tags_controller.rb + ../lib/custom_wizard/extensions/custom_field/preloader.rb + ../lib/custom_wizard/extensions/custom_field/serializer.rb + ../lib/custom_wizard/extensions/custom_field/extension.rb + ../lib/custom_wizard/extensions/discourse_tagging.rb ].each do |path| load File.expand_path(path, __FILE__) end diff --git a/spec/components/custom_wizard/action_spec.rb b/spec/components/custom_wizard/action_spec.rb index 8b617c39..248c44a5 100644 --- a/spec/components/custom_wizard/action_spec.rb +++ b/spec/components/custom_wizard/action_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' describe CustomWizard::Action do fab!(:user) { Fabricate(:user, name: "Angus", username: 'angus', email: "angus@email.com", trust_level: TrustLevel[2]) } diff --git a/spec/components/custom_wizard/builder_spec.rb b/spec/components/custom_wizard/builder_spec.rb index 099d8681..e140931c 100644 --- a/spec/components/custom_wizard/builder_spec.rb +++ b/spec/components/custom_wizard/builder_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' describe CustomWizard::Builder do fab!(:trusted_user) { diff --git a/spec/components/custom_wizard/cache_spec.rb b/spec/components/custom_wizard/cache_spec.rb index 2cc3b81a..2d7dd832 100644 --- a/spec/components/custom_wizard/cache_spec.rb +++ b/spec/components/custom_wizard/cache_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../plugin_helper.rb' - describe CustomWizard::Cache do it "writes and reads values to the cache" do CustomWizard::Cache.new('list').write([1, 2, 3]) diff --git a/spec/components/custom_wizard/custom_field_spec.rb b/spec/components/custom_wizard/custom_field_spec.rb index b17e26c6..155a6526 100644 --- a/spec/components/custom_wizard/custom_field_spec.rb +++ b/spec/components/custom_wizard/custom_field_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' - describe CustomWizard::CustomField do let(:custom_field_json) { diff --git a/spec/components/custom_wizard/field_spec.rb b/spec/components/custom_wizard/field_spec.rb index 871c42cd..2386a004 100644 --- a/spec/components/custom_wizard/field_spec.rb +++ b/spec/components/custom_wizard/field_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' describe CustomWizard::Field do let(:field_hash) do diff --git a/spec/components/custom_wizard/log_spec.rb b/spec/components/custom_wizard/log_spec.rb index 30fd0173..d5c0de5d 100644 --- a/spec/components/custom_wizard/log_spec.rb +++ b/spec/components/custom_wizard/log_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' describe CustomWizard::Log do before do diff --git a/spec/components/custom_wizard/mapper_spec.rb b/spec/components/custom_wizard/mapper_spec.rb index ed66d7c1..422ffbf5 100644 --- a/spec/components/custom_wizard/mapper_spec.rb +++ b/spec/components/custom_wizard/mapper_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' describe CustomWizard::Mapper do fab!(:user1) { diff --git a/spec/components/custom_wizard/realtime_validation_spec.rb b/spec/components/custom_wizard/realtime_validation_spec.rb index 819ac2ae..22e36dd1 100644 --- a/spec/components/custom_wizard/realtime_validation_spec.rb +++ b/spec/components/custom_wizard/realtime_validation_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' - describe CustomWizard::RealtimeValidation do validation_names = CustomWizard::RealtimeValidation.types.keys diff --git a/spec/components/custom_wizard/realtime_validations/similar_topics_spec.rb b/spec/components/custom_wizard/realtime_validations/similar_topics_spec.rb index eb81509e..6ea07684 100644 --- a/spec/components/custom_wizard/realtime_validations/similar_topics_spec.rb +++ b/spec/components/custom_wizard/realtime_validations/similar_topics_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../../plugin_helper' - describe ::CustomWizard::RealtimeValidation::SimilarTopics do let(:post) { create_post(title: "matching similar topic") } let(:topic) { post.topic } diff --git a/spec/components/custom_wizard/step_spec.rb b/spec/components/custom_wizard/step_spec.rb index bf4613a4..ac0abbb7 100644 --- a/spec/components/custom_wizard/step_spec.rb +++ b/spec/components/custom_wizard/step_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' describe CustomWizard::Step do let(:step_hash) do diff --git a/spec/components/custom_wizard/submission_spec.rb b/spec/components/custom_wizard/submission_spec.rb index b85af243..5a86eca6 100644 --- a/spec/components/custom_wizard/submission_spec.rb +++ b/spec/components/custom_wizard/submission_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' describe CustomWizard::Submission do fab!(:user) { Fabricate(:user) } diff --git a/spec/components/custom_wizard/template_spec.rb b/spec/components/custom_wizard/template_spec.rb index 0e3dbdbe..06a7bcb7 100644 --- a/spec/components/custom_wizard/template_spec.rb +++ b/spec/components/custom_wizard/template_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' describe CustomWizard::Template do fab!(:user) { Fabricate(:user) } diff --git a/spec/components/custom_wizard/template_validator_spec.rb b/spec/components/custom_wizard/template_validator_spec.rb index 0ff0d1e7..8e730140 100644 --- a/spec/components/custom_wizard/template_validator_spec.rb +++ b/spec/components/custom_wizard/template_validator_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' describe CustomWizard::TemplateValidator do fab!(:user) { Fabricate(:user) } diff --git a/spec/components/custom_wizard/update_validator_spec.rb b/spec/components/custom_wizard/update_validator_spec.rb index e976e1ff..b8aea789 100644 --- a/spec/components/custom_wizard/update_validator_spec.rb +++ b/spec/components/custom_wizard/update_validator_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' describe CustomWizard::UpdateValidator do fab!(:user) { Fabricate(:user) } diff --git a/spec/components/custom_wizard/wizard_spec.rb b/spec/components/custom_wizard/wizard_spec.rb index 67905f5a..a3f86f3e 100644 --- a/spec/components/custom_wizard/wizard_spec.rb +++ b/spec/components/custom_wizard/wizard_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' - describe CustomWizard::Wizard do fab!(:user) { Fabricate(:user) } fab!(:trusted_user) { Fabricate(:user, trust_level: TrustLevel[3]) } diff --git a/spec/extensions/custom_field_extensions_spec.rb b/spec/extensions/custom_field_extensions_spec.rb index f0ce32f5..1b7ec6bf 100644 --- a/spec/extensions/custom_field_extensions_spec.rb +++ b/spec/extensions/custom_field_extensions_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../plugin_helper' - describe "custom field extensions" do fab!(:topic) { Fabricate(:topic) } fab!(:post) { Fabricate(:post) } diff --git a/spec/extensions/extra_locales_controller_spec.rb b/spec/extensions/extra_locales_controller_spec.rb index a71e39c4..32d3940c 100644 --- a/spec/extensions/extra_locales_controller_spec.rb +++ b/spec/extensions/extra_locales_controller_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../plugin_helper' describe ExtraLocalesControllerCustomWizard, type: :request do let(:new_user) { Fabricate(:user, trust_level: TrustLevel[0]) } diff --git a/spec/extensions/guardian_extension_spec.rb b/spec/extensions/guardian_extension_spec.rb index d779fe11..ddfeb9ef 100644 --- a/spec/extensions/guardian_extension_spec.rb +++ b/spec/extensions/guardian_extension_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../plugin_helper' - describe ::Guardian do fab!(:user) { Fabricate(:user, name: "Angus", username: 'angus', email: "angus@email.com") diff --git a/spec/extensions/invites_controller_spec.rb b/spec/extensions/invites_controller_spec.rb index 47c4ca84..42e0ece7 100644 --- a/spec/extensions/invites_controller_spec.rb +++ b/spec/extensions/invites_controller_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../plugin_helper' describe InvitesControllerCustomWizard, type: :request do fab!(:topic) { Fabricate(:topic) } diff --git a/spec/extensions/sprockets_directive_spec.rb b/spec/extensions/sprockets_directive_spec.rb index 5a074040..db54c5dc 100644 --- a/spec/extensions/sprockets_directive_spec.rb +++ b/spec/extensions/sprockets_directive_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../plugin_helper' - describe "Sprockets: require_tree_discourse directive" do let(:discourse_asset_path) { "#{Rails.root}/app/assets/javascripts/" diff --git a/spec/extensions/tags_controller_spec.rb b/spec/extensions/tags_controller_spec.rb index 6df00d9a..b3c1ccc8 100644 --- a/spec/extensions/tags_controller_spec.rb +++ b/spec/extensions/tags_controller_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../plugin_helper' - describe ::TagsController, type: :request do fab!(:tag_1) { Fabricate(:tag, name: "Angus") } fab!(:tag_2) { Fabricate(:tag, name: "Faizaan") } diff --git a/spec/extensions/users_controller_spec.rb b/spec/extensions/users_controller_spec.rb index f4ba8e51..0c220a62 100644 --- a/spec/extensions/users_controller_spec.rb +++ b/spec/extensions/users_controller_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../plugin_helper' describe CustomWizardUsersController, type: :request do let(:template) do diff --git a/spec/jobs/set_after_time_wizard_spec.rb b/spec/jobs/set_after_time_wizard_spec.rb index 35576f01..40418d13 100644 --- a/spec/jobs/set_after_time_wizard_spec.rb +++ b/spec/jobs/set_after_time_wizard_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../plugin_helper' - describe Jobs::SetAfterTimeWizard do fab!(:user1) { Fabricate(:user) } fab!(:user2) { Fabricate(:user) } diff --git a/spec/plugin_helper.rb b/spec/plugin_helper.rb deleted file mode 100644 index 9e4bbbbe..00000000 --- a/spec/plugin_helper.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -if ENV['SIMPLECOV'] - require 'simplecov' - - SimpleCov.start do - root "plugins/discourse-custom-wizard" - track_files "plugins/discourse-custom-wizard/**/*.rb" - add_filter { |src| src.filename =~ /(\/spec\/|\/db\/|plugin\.rb|api|gems)/ } - SimpleCov.minimum_coverage 80 - end -end - -require 'oj' -Oj.default_options = Oj.default_options.merge(cache_str: -1) - -require 'rails_helper' diff --git a/spec/requests/custom_wizard/admin/custom_fields_controller_spec.rb b/spec/requests/custom_wizard/admin/custom_fields_controller_spec.rb index 8c1a8550..6f1aea12 100644 --- a/spec/requests/custom_wizard/admin/custom_fields_controller_spec.rb +++ b/spec/requests/custom_wizard/admin/custom_fields_controller_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../../plugin_helper' describe CustomWizard::AdminCustomFieldsController do fab!(:admin_user) { Fabricate(:user, admin: true) } diff --git a/spec/requests/custom_wizard/admin/logs_controller_spec.rb b/spec/requests/custom_wizard/admin/logs_controller_spec.rb index 28b7d785..a2f619e4 100644 --- a/spec/requests/custom_wizard/admin/logs_controller_spec.rb +++ b/spec/requests/custom_wizard/admin/logs_controller_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../../plugin_helper' describe CustomWizard::AdminLogsController do fab!(:admin_user) { Fabricate(:user, admin: true) } diff --git a/spec/requests/custom_wizard/admin/manager_controller_spec.rb b/spec/requests/custom_wizard/admin/manager_controller_spec.rb index 7d087e3e..5c7b3ec3 100644 --- a/spec/requests/custom_wizard/admin/manager_controller_spec.rb +++ b/spec/requests/custom_wizard/admin/manager_controller_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../../plugin_helper' describe CustomWizard::AdminManagerController do fab!(:admin_user) { Fabricate(:user, admin: true) } diff --git a/spec/requests/custom_wizard/admin/submissions_controller_spec.rb b/spec/requests/custom_wizard/admin/submissions_controller_spec.rb index 36296e95..c35b5365 100644 --- a/spec/requests/custom_wizard/admin/submissions_controller_spec.rb +++ b/spec/requests/custom_wizard/admin/submissions_controller_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../../plugin_helper' describe CustomWizard::AdminSubmissionsController do fab!(:admin_user) { Fabricate(:user, admin: true) } diff --git a/spec/requests/custom_wizard/admin/wizard_controller_spec.rb b/spec/requests/custom_wizard/admin/wizard_controller_spec.rb index 82aa4fc5..de287374 100644 --- a/spec/requests/custom_wizard/admin/wizard_controller_spec.rb +++ b/spec/requests/custom_wizard/admin/wizard_controller_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../../plugin_helper' describe CustomWizard::AdminWizardController do fab!(:admin_user) { Fabricate(:user, admin: true) } diff --git a/spec/requests/custom_wizard/application_controller_spec.rb b/spec/requests/custom_wizard/application_controller_spec.rb index 0b5513aa..23679c39 100644 --- a/spec/requests/custom_wizard/application_controller_spec.rb +++ b/spec/requests/custom_wizard/application_controller_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' describe ApplicationController do fab!(:user) { diff --git a/spec/requests/custom_wizard/custom_field_extensions_spec.rb b/spec/requests/custom_wizard/custom_field_extensions_spec.rb index b991769a..5bb7ffd9 100644 --- a/spec/requests/custom_wizard/custom_field_extensions_spec.rb +++ b/spec/requests/custom_wizard/custom_field_extensions_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' - describe "custom field extensions" do let!(:topic) { Fabricate(:topic) } let!(:post) { Fabricate(:post) } diff --git a/spec/requests/custom_wizard/realtime_validations_spec.rb b/spec/requests/custom_wizard/realtime_validations_spec.rb index 0d59e885..a57333b8 100644 --- a/spec/requests/custom_wizard/realtime_validations_spec.rb +++ b/spec/requests/custom_wizard/realtime_validations_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' - describe CustomWizard::RealtimeValidationsController do fab!(:validation_type) { "test_stub" } diff --git a/spec/requests/custom_wizard/steps_controller_spec.rb b/spec/requests/custom_wizard/steps_controller_spec.rb index 5da75d8d..dc8d0130 100644 --- a/spec/requests/custom_wizard/steps_controller_spec.rb +++ b/spec/requests/custom_wizard/steps_controller_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' describe CustomWizard::StepsController do fab!(:user) { diff --git a/spec/requests/custom_wizard/wizard_controller_spec.rb b/spec/requests/custom_wizard/wizard_controller_spec.rb index f5bcd5ac..44e48ed7 100644 --- a/spec/requests/custom_wizard/wizard_controller_spec.rb +++ b/spec/requests/custom_wizard/wizard_controller_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' describe CustomWizard::WizardController do fab!(:user) { diff --git a/spec/serializers/custom_wizard/basic_wizard_serializer_spec.rb b/spec/serializers/custom_wizard/basic_wizard_serializer_spec.rb index bf575827..59647477 100644 --- a/spec/serializers/custom_wizard/basic_wizard_serializer_spec.rb +++ b/spec/serializers/custom_wizard/basic_wizard_serializer_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' - describe CustomWizard::BasicWizardSerializer do fab!(:user) { Fabricate(:user) } diff --git a/spec/serializers/custom_wizard/custom_field_serializer_spec.rb b/spec/serializers/custom_wizard/custom_field_serializer_spec.rb index 4f5ffd72..0f6f5564 100644 --- a/spec/serializers/custom_wizard/custom_field_serializer_spec.rb +++ b/spec/serializers/custom_wizard/custom_field_serializer_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' - describe CustomWizard::CustomFieldSerializer do fab!(:user) { Fabricate(:user) } diff --git a/spec/serializers/custom_wizard/log_serializer_spec.rb b/spec/serializers/custom_wizard/log_serializer_spec.rb index bde16199..895cab54 100644 --- a/spec/serializers/custom_wizard/log_serializer_spec.rb +++ b/spec/serializers/custom_wizard/log_serializer_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' - describe CustomWizard::LogSerializer do fab!(:user) { Fabricate(:user) } diff --git a/spec/serializers/custom_wizard/wizard_field_serializer_spec.rb b/spec/serializers/custom_wizard/wizard_field_serializer_spec.rb index a5a5e721..5f225f44 100644 --- a/spec/serializers/custom_wizard/wizard_field_serializer_spec.rb +++ b/spec/serializers/custom_wizard/wizard_field_serializer_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' - describe CustomWizard::FieldSerializer do fab!(:user) { Fabricate(:user) } diff --git a/spec/serializers/custom_wizard/wizard_serializer_spec.rb b/spec/serializers/custom_wizard/wizard_serializer_spec.rb index 2052639a..1b26ce24 100644 --- a/spec/serializers/custom_wizard/wizard_serializer_spec.rb +++ b/spec/serializers/custom_wizard/wizard_serializer_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' - describe CustomWizard::WizardSerializer do fab!(:user) { Fabricate(:user) } fab!(:category) { Fabricate(:category) } diff --git a/spec/serializers/custom_wizard/wizard_step_serializer_spec.rb b/spec/serializers/custom_wizard/wizard_step_serializer_spec.rb index 21345352..0df76baf 100644 --- a/spec/serializers/custom_wizard/wizard_step_serializer_spec.rb +++ b/spec/serializers/custom_wizard/wizard_step_serializer_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../plugin_helper' - describe CustomWizard::StepSerializer do fab!(:user) { Fabricate(:user) } From 8cac2a596003ee99f11e32e8a7a7fe3095aaa9e3 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Sat, 12 Mar 2022 14:01:39 +0100 Subject: [PATCH 2/4] Update plugin.rb --- plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index d819e9c4..a1b377ac 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # name: discourse-custom-wizard # about: Create custom wizards -# version: 1.18.3 +# version: 1.18.4 # authors: Angus McLeod # url: https://github.com/paviliondev/discourse-custom-wizard # contact emails: angus@thepavilion.io From 7a56b9d3902a7f2bbebb08652a28c523accc5a9c Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Sat, 12 Mar 2022 14:02:11 +0100 Subject: [PATCH 3/4] Rubocop --- .simplecov | 1 + 1 file changed, 1 insertion(+) diff --git a/.simplecov b/.simplecov index 18b59116..c7b6143b 100644 --- a/.simplecov +++ b/.simplecov @@ -1,3 +1,4 @@ +# frozen_string_literal: true plugin = "discourse-custom-wizard" SimpleCov.configure do From 684a2a3801fcbe7b213fa1de1a9810ddf2720a51 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Sat, 12 Mar 2022 14:26:27 +0100 Subject: [PATCH 4/4] Update plugin-tests.yml --- .github/workflows/plugin-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/plugin-tests.yml b/.github/workflows/plugin-tests.yml index 18f09d5d..782ebc4f 100644 --- a/.github/workflows/plugin-tests.yml +++ b/.github/workflows/plugin-tests.yml @@ -143,6 +143,7 @@ jobs: if: matrix.build_type == 'backend' && steps.check_spec.outputs.files_exists == 'true' run: | if [ -e plugins/${{ steps.repo-name.outputs.value }}/.simplecov ] + then cp plugins/${{ steps.repo-name.outputs.value }}/.simplecov .simplecov export COVERAGE=1 fi