Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-10 04:12:53 +01:00
Merge pull request #190 from paviliondev/update_simplecov
Move to new coverage approach
Dieser Commit ist enthalten in:
Commit
72e16ad9c3
80 geänderte Dateien mit 52 neuen und 113 gelöschten Zeilen
8
.github/workflows/plugin-tests.yml
gevendort
8
.github/workflows/plugin-tests.yml
gevendort
|
@ -141,7 +141,13 @@ 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 ]
|
||||
then
|
||||
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'
|
||||
|
|
7
.simplecov
Normale Datei
7
.simplecov
Normale Datei
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
plugin = "discourse-custom-wizard"
|
||||
|
||||
SimpleCov.configure do
|
||||
track_files "plugins/#{plugin}/**/*.rb"
|
||||
add_filter { |src| !(src.filename =~ /(\/#{plugin}\/app\/|\/#{plugin}\/lib\/)/) }
|
||||
end
|
|
@ -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
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"result": {
|
||||
"line": 92.87
|
||||
"line": 84.4
|
||||
}
|
||||
}
|
||||
|
|
72
plugin.rb
72
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
|
||||
|
@ -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
|
||||
|
|
|
@ -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]) }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::Builder do
|
||||
fab!(:trusted_user) {
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::CustomField do
|
||||
|
||||
let(:custom_field_json) {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::Field do
|
||||
let(:field_hash) do
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::Log do
|
||||
before do
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::Mapper do
|
||||
fab!(:user1) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::RealtimeValidation do
|
||||
validation_names = CustomWizard::RealtimeValidation.types.keys
|
||||
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::Step do
|
||||
let(:step_hash) do
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::Submission do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::Template do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::TemplateValidator do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::UpdateValidator do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
|
|
|
@ -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]) }
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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]) }
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../plugin_helper'
|
||||
|
||||
describe InvitesControllerCustomWizard, type: :request do
|
||||
fab!(:topic) { Fabricate(:topic) }
|
||||
|
|
|
@ -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/"
|
||||
|
|
|
@ -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") }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../plugin_helper'
|
||||
|
||||
describe CustomWizardUsersController, type: :request do
|
||||
let(:template) do
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../plugin_helper'
|
||||
|
||||
describe Jobs::SetAfterTimeWizard do
|
||||
fab!(:user1) { Fabricate(:user) }
|
||||
fab!(:user2) { Fabricate(:user) }
|
||||
|
|
|
@ -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'
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../../plugin_helper'
|
||||
|
||||
describe CustomWizard::AdminCustomFieldsController do
|
||||
fab!(:admin_user) { Fabricate(:user, admin: true) }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../../plugin_helper'
|
||||
|
||||
describe CustomWizard::AdminLogsController do
|
||||
fab!(:admin_user) { Fabricate(:user, admin: true) }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../../plugin_helper'
|
||||
|
||||
describe CustomWizard::AdminManagerController do
|
||||
fab!(:admin_user) { Fabricate(:user, admin: true) }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../../plugin_helper'
|
||||
|
||||
describe CustomWizard::AdminSubmissionsController do
|
||||
fab!(:admin_user) { Fabricate(:user, admin: true) }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../../plugin_helper'
|
||||
|
||||
describe CustomWizard::AdminWizardController do
|
||||
fab!(:admin_user) { Fabricate(:user, admin: true) }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe ApplicationController do
|
||||
fab!(:user) {
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::RealtimeValidationsController do
|
||||
|
||||
fab!(:validation_type) { "test_stub" }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::StepsController do
|
||||
fab!(:user) {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::WizardController do
|
||||
fab!(:user) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::BasicWizardSerializer do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::CustomFieldSerializer do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::LogSerializer do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::FieldSerializer do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::WizardSerializer do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:category) { Fabricate(:category) }
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../plugin_helper'
|
||||
|
||||
describe CustomWizard::StepSerializer do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
|
||||
|
|
Laden …
In neuem Issue referenzieren