1
0
Fork 0

Move to new coverage approach

Dieser Commit ist enthalten in:
Angus McLeod 2022-03-12 14:00:07 +01:00
Ursprung f9b35a2541
Commit 46c86cda58
80 geänderte Dateien mit 49 neuen und 112 gelöschten Zeilen

Datei anzeigen

@ -141,7 +141,12 @@ jobs:
- name: Plugin RSpec with Coverage - name: Plugin RSpec with Coverage
if: matrix.build_type == 'backend' && steps.check_spec.outputs.files_exists == 'true' 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 - name: Plugin QUnit
if: matrix.build_type == 'frontend' && steps.check_qunit.outputs.files_exists == 'true' if: matrix.build_type == 'frontend' && steps.check_qunit.outputs.files_exists == 'true'

6
.simplecov Normale Datei
Datei anzeigen

@ -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

Datei anzeigen

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
class CustomWizard::WizardController < ::ApplicationController class CustomWizard::WizardController < ::ApplicationController
include ApplicationHelper 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' layout 'wizard'
before_action :ensure_plugin_enabled before_action :ensure_plugin_enabled

Datei anzeigen

@ -1,5 +1,5 @@
{ {
"result": { "result": {
"line": 92.87 "line": 84.4
} }
} }

Datei anzeigen

@ -57,18 +57,18 @@ after_initialize do
%w[ %w[
../lib/custom_wizard/engine.rb ../lib/custom_wizard/engine.rb
../config/routes.rb ../config/routes.rb
../controllers/custom_wizard/admin/admin.rb ../app/controllers/custom_wizard/admin/admin.rb
../controllers/custom_wizard/admin/wizard.rb ../app/controllers/custom_wizard/admin/wizard.rb
../controllers/custom_wizard/admin/submissions.rb ../app/controllers/custom_wizard/admin/submissions.rb
../controllers/custom_wizard/admin/api.rb ../app/controllers/custom_wizard/admin/api.rb
../controllers/custom_wizard/admin/logs.rb ../app/controllers/custom_wizard/admin/logs.rb
../controllers/custom_wizard/admin/manager.rb ../app/controllers/custom_wizard/admin/manager.rb
../controllers/custom_wizard/admin/custom_fields.rb ../app/controllers/custom_wizard/admin/custom_fields.rb
../controllers/custom_wizard/wizard.rb ../app/controllers/custom_wizard/wizard.rb
../controllers/custom_wizard/steps.rb ../app/controllers/custom_wizard/steps.rb
../controllers/custom_wizard/realtime_validations.rb ../app/controllers/custom_wizard/realtime_validations.rb
../jobs/refresh_api_access_token.rb ../app/jobs/refresh_api_access_token.rb
../jobs/set_after_time_wizard.rb ../app/jobs/set_after_time_wizard.rb
../lib/custom_wizard/validators/template.rb ../lib/custom_wizard/validators/template.rb
../lib/custom_wizard/validators/update.rb ../lib/custom_wizard/validators/update.rb
../lib/custom_wizard/action_result.rb ../lib/custom_wizard/action_result.rb
@ -93,29 +93,29 @@ after_initialize do
../lib/custom_wizard/api/log_entry.rb ../lib/custom_wizard/api/log_entry.rb
../lib/custom_wizard/liquid_extensions/first_non_empty.rb ../lib/custom_wizard/liquid_extensions/first_non_empty.rb
../lib/custom_wizard/exceptions/exceptions.rb ../lib/custom_wizard/exceptions/exceptions.rb
../serializers/custom_wizard/api/authorization_serializer.rb ../app/serializers/custom_wizard/api/authorization_serializer.rb
../serializers/custom_wizard/api/basic_endpoint_serializer.rb ../app/serializers/custom_wizard/api/basic_endpoint_serializer.rb
../serializers/custom_wizard/api/endpoint_serializer.rb ../app/serializers/custom_wizard/api/endpoint_serializer.rb
../serializers/custom_wizard/api/log_serializer.rb ../app/serializers/custom_wizard/api/log_serializer.rb
../serializers/custom_wizard/api_serializer.rb ../app/serializers/custom_wizard/api_serializer.rb
../serializers/custom_wizard/basic_api_serializer.rb ../app/serializers/custom_wizard/basic_api_serializer.rb
../serializers/custom_wizard/basic_wizard_serializer.rb ../app/serializers/custom_wizard/basic_wizard_serializer.rb
../serializers/custom_wizard/custom_field_serializer.rb ../app/serializers/custom_wizard/custom_field_serializer.rb
../serializers/custom_wizard/wizard_field_serializer.rb ../app/serializers/custom_wizard/wizard_field_serializer.rb
../serializers/custom_wizard/wizard_step_serializer.rb ../app/serializers/custom_wizard/wizard_step_serializer.rb
../serializers/custom_wizard/wizard_serializer.rb ../app/serializers/custom_wizard/wizard_serializer.rb
../serializers/custom_wizard/log_serializer.rb ../app/serializers/custom_wizard/log_serializer.rb
../serializers/custom_wizard/submission_serializer.rb ../app/serializers/custom_wizard/submission_serializer.rb
../serializers/custom_wizard/realtime_validation/similar_topics_serializer.rb ../app/serializers/custom_wizard/realtime_validation/similar_topics_serializer.rb
../extensions/extra_locales_controller.rb ../lib/custom_wizard/extensions/extra_locales_controller.rb
../extensions/invites_controller.rb ../lib/custom_wizard/extensions/invites_controller.rb
../extensions/guardian.rb ../lib/custom_wizard/extensions/guardian.rb
../extensions/users_controller.rb ../lib/custom_wizard/extensions/users_controller.rb
../extensions/tags_controller.rb ../lib/custom_wizard/extensions/tags_controller.rb
../extensions/custom_field/preloader.rb ../lib/custom_wizard/extensions/custom_field/preloader.rb
../extensions/custom_field/serializer.rb ../lib/custom_wizard/extensions/custom_field/serializer.rb
../extensions/custom_field/extension.rb ../lib/custom_wizard/extensions/custom_field/extension.rb
../extensions/discourse_tagging.rb ../lib/custom_wizard/extensions/discourse_tagging.rb
].each do |path| ].each do |path|
load File.expand_path(path, __FILE__) load File.expand_path(path, __FILE__)
end end

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::Action do describe CustomWizard::Action do
fab!(:user) { Fabricate(:user, name: "Angus", username: 'angus', email: "angus@email.com", trust_level: TrustLevel[2]) } fab!(:user) { Fabricate(:user, name: "Angus", username: 'angus', email: "angus@email.com", trust_level: TrustLevel[2]) }

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::Builder do describe CustomWizard::Builder do
fab!(:trusted_user) { fab!(:trusted_user) {

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper.rb'
describe CustomWizard::Cache do describe CustomWizard::Cache do
it "writes and reads values to the cache" do it "writes and reads values to the cache" do
CustomWizard::Cache.new('list').write([1, 2, 3]) CustomWizard::Cache.new('list').write([1, 2, 3])

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::CustomField do describe CustomWizard::CustomField do
let(:custom_field_json) { let(:custom_field_json) {

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::Field do describe CustomWizard::Field do
let(:field_hash) do let(:field_hash) do

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::Log do describe CustomWizard::Log do
before do before do

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::Mapper do describe CustomWizard::Mapper do
fab!(:user1) { fab!(:user1) {

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::RealtimeValidation do describe CustomWizard::RealtimeValidation do
validation_names = CustomWizard::RealtimeValidation.types.keys validation_names = CustomWizard::RealtimeValidation.types.keys

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../../plugin_helper'
describe ::CustomWizard::RealtimeValidation::SimilarTopics do describe ::CustomWizard::RealtimeValidation::SimilarTopics do
let(:post) { create_post(title: "matching similar topic") } let(:post) { create_post(title: "matching similar topic") }
let(:topic) { post.topic } let(:topic) { post.topic }

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::Step do describe CustomWizard::Step do
let(:step_hash) do let(:step_hash) do

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::Submission do describe CustomWizard::Submission do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::Template do describe CustomWizard::Template do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::TemplateValidator do describe CustomWizard::TemplateValidator do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::UpdateValidator do describe CustomWizard::UpdateValidator do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::Wizard do describe CustomWizard::Wizard do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }
fab!(:trusted_user) { Fabricate(:user, trust_level: TrustLevel[3]) } fab!(:trusted_user) { Fabricate(:user, trust_level: TrustLevel[3]) }

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../plugin_helper'
describe "custom field extensions" do describe "custom field extensions" do
fab!(:topic) { Fabricate(:topic) } fab!(:topic) { Fabricate(:topic) }
fab!(:post) { Fabricate(:post) } fab!(:post) { Fabricate(:post) }

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../plugin_helper'
describe ExtraLocalesControllerCustomWizard, type: :request do describe ExtraLocalesControllerCustomWizard, type: :request do
let(:new_user) { Fabricate(:user, trust_level: TrustLevel[0]) } let(:new_user) { Fabricate(:user, trust_level: TrustLevel[0]) }

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../plugin_helper'
describe ::Guardian do describe ::Guardian do
fab!(:user) { fab!(:user) {
Fabricate(:user, name: "Angus", username: 'angus', email: "angus@email.com") Fabricate(:user, name: "Angus", username: 'angus', email: "angus@email.com")

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../plugin_helper'
describe InvitesControllerCustomWizard, type: :request do describe InvitesControllerCustomWizard, type: :request do
fab!(:topic) { Fabricate(:topic) } fab!(:topic) { Fabricate(:topic) }

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../plugin_helper'
describe "Sprockets: require_tree_discourse directive" do describe "Sprockets: require_tree_discourse directive" do
let(:discourse_asset_path) { let(:discourse_asset_path) {
"#{Rails.root}/app/assets/javascripts/" "#{Rails.root}/app/assets/javascripts/"

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../plugin_helper'
describe ::TagsController, type: :request do describe ::TagsController, type: :request do
fab!(:tag_1) { Fabricate(:tag, name: "Angus") } fab!(:tag_1) { Fabricate(:tag, name: "Angus") }
fab!(:tag_2) { Fabricate(:tag, name: "Faizaan") } fab!(:tag_2) { Fabricate(:tag, name: "Faizaan") }

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../plugin_helper'
describe CustomWizardUsersController, type: :request do describe CustomWizardUsersController, type: :request do
let(:template) do let(:template) do

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../plugin_helper'
describe Jobs::SetAfterTimeWizard do describe Jobs::SetAfterTimeWizard do
fab!(:user1) { Fabricate(:user) } fab!(:user1) { Fabricate(:user) }
fab!(:user2) { Fabricate(:user) } fab!(:user2) { Fabricate(:user) }

Datei anzeigen

@ -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'

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../../plugin_helper'
describe CustomWizard::AdminCustomFieldsController do describe CustomWizard::AdminCustomFieldsController do
fab!(:admin_user) { Fabricate(:user, admin: true) } fab!(:admin_user) { Fabricate(:user, admin: true) }

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../../plugin_helper'
describe CustomWizard::AdminLogsController do describe CustomWizard::AdminLogsController do
fab!(:admin_user) { Fabricate(:user, admin: true) } fab!(:admin_user) { Fabricate(:user, admin: true) }

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../../plugin_helper'
describe CustomWizard::AdminManagerController do describe CustomWizard::AdminManagerController do
fab!(:admin_user) { Fabricate(:user, admin: true) } fab!(:admin_user) { Fabricate(:user, admin: true) }

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../../plugin_helper'
describe CustomWizard::AdminSubmissionsController do describe CustomWizard::AdminSubmissionsController do
fab!(:admin_user) { Fabricate(:user, admin: true) } fab!(:admin_user) { Fabricate(:user, admin: true) }

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../../plugin_helper'
describe CustomWizard::AdminWizardController do describe CustomWizard::AdminWizardController do
fab!(:admin_user) { Fabricate(:user, admin: true) } fab!(:admin_user) { Fabricate(:user, admin: true) }

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe ApplicationController do describe ApplicationController do
fab!(:user) { fab!(:user) {

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe "custom field extensions" do describe "custom field extensions" do
let!(:topic) { Fabricate(:topic) } let!(:topic) { Fabricate(:topic) }
let!(:post) { Fabricate(:post) } let!(:post) { Fabricate(:post) }

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::RealtimeValidationsController do describe CustomWizard::RealtimeValidationsController do
fab!(:validation_type) { "test_stub" } fab!(:validation_type) { "test_stub" }

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::StepsController do describe CustomWizard::StepsController do
fab!(:user) { fab!(:user) {

Datei anzeigen

@ -1,5 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::WizardController do describe CustomWizard::WizardController do
fab!(:user) { fab!(:user) {

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::BasicWizardSerializer do describe CustomWizard::BasicWizardSerializer do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::CustomFieldSerializer do describe CustomWizard::CustomFieldSerializer do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::LogSerializer do describe CustomWizard::LogSerializer do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::FieldSerializer do describe CustomWizard::FieldSerializer do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::WizardSerializer do describe CustomWizard::WizardSerializer do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }
fab!(:category) { Fabricate(:category) } fab!(:category) { Fabricate(:category) }

Datei anzeigen

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../../plugin_helper'
describe CustomWizard::StepSerializer do describe CustomWizard::StepSerializer do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }