Apply rubcop and get tests pass (#76)
Dieser Commit ist enthalten in:
Ursprung
065bc17929
Commit
4edb40e526
91 geänderte Dateien mit 1070 neuen und 1006 gelöschten Zeilen
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
CustomWizard::Engine.routes.draw do
|
CustomWizard::Engine.routes.draw do
|
||||||
get ':wizard_id' => 'wizard#index'
|
get ':wizard_id' => 'wizard#index'
|
||||||
put ':wizard_id/skip' => 'wizard#skip'
|
put ':wizard_id/skip' => 'wizard#skip'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::AdminController < ::Admin::AdminController
|
class CustomWizard::AdminController < ::Admin::AdminController
|
||||||
before_action :ensure_admin
|
before_action :ensure_admin
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::AdminApiController < CustomWizard::AdminController
|
class CustomWizard::AdminApiController < CustomWizard::AdminController
|
||||||
skip_before_action :check_xhr, only: [:redirect]
|
skip_before_action :check_xhr, only: [:redirect]
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ class CustomWizard::AdminApiController < CustomWizard::AdminController
|
||||||
CustomWizard::Api::Authorization.set(params[:name], code: params[:code])
|
CustomWizard::Api::Authorization.set(params[:name], code: params[:code])
|
||||||
CustomWizard::Api::Authorization.get_token(params[:name])
|
CustomWizard::Api::Authorization.get_token(params[:name])
|
||||||
|
|
||||||
return redirect_to path('/admin/wizards/apis/' + params[:name])
|
redirect_to path('/admin/wizards/apis/' + params[:name])
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::AdminCustomFieldsController < CustomWizard::AdminController
|
class CustomWizard::AdminCustomFieldsController < CustomWizard::AdminController
|
||||||
def index
|
def index
|
||||||
render_json_dump(custom_field_list)
|
render_json_dump(custom_field_list)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::AdminLogsController < CustomWizard::AdminController
|
class CustomWizard::AdminLogsController < CustomWizard::AdminController
|
||||||
def index
|
def index
|
||||||
render_serialized(
|
render_serialized(
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::AdminManagerController < CustomWizard::AdminController
|
class CustomWizard::AdminManagerController < CustomWizard::AdminController
|
||||||
skip_before_action :check_xhr, only: [:export]
|
skip_before_action :check_xhr, only: [:export]
|
||||||
before_action :get_wizard_ids, except: [:import]
|
before_action :get_wizard_ids, except: [:import]
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::AdminSubmissionsController < CustomWizard::AdminController
|
class CustomWizard::AdminSubmissionsController < CustomWizard::AdminController
|
||||||
skip_before_action :preload_json, :check_xhr, only: [:download]
|
skip_before_action :preload_json, :check_xhr, only: [:download]
|
||||||
before_action :find_wizard, except: [:index]
|
before_action :find_wizard, except: [:index]
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::AdminWizardController < CustomWizard::AdminController
|
class CustomWizard::AdminWizardController < CustomWizard::AdminController
|
||||||
before_action :find_wizard, only: [:show, :remove]
|
before_action :find_wizard, only: [:show, :remove]
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::StepsController < ::ApplicationController
|
class CustomWizard::StepsController < ::ApplicationController
|
||||||
before_action :ensure_logged_in
|
before_action :ensure_logged_in
|
||||||
before_action :ensure_can_update
|
before_action :ensure_can_update
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::WizardController < ::ApplicationController
|
class CustomWizard::WizardController < ::ApplicationController
|
||||||
prepend_view_path(Rails.root.join('plugins', 'discourse-custom-wizard', 'views'))
|
prepend_view_path(Rails.root.join('plugins', 'discourse-custom-wizard', 'views'))
|
||||||
layout 'wizard'
|
layout 'wizard'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class UpdateWatchCategoriesAction < ActiveRecord::Migration[6.0]
|
class UpdateWatchCategoriesAction < ActiveRecord::Migration[6.0]
|
||||||
def change
|
def change
|
||||||
watch_category_wizards = PluginStoreRow.where("
|
watch_category_wizards = PluginStoreRow.where("
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module CustomWizardCustomFieldPreloader
|
module CustomWizardCustomFieldPreloader
|
||||||
def preload_custom_fields(objects, fields)
|
def preload_custom_fields(objects, fields)
|
||||||
if objects.present? && cw_fields_enabled?
|
if objects.present? && cw_fields_enabled?
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module CustomWizardCustomFieldSerializer
|
module CustomWizardCustomFieldSerializer
|
||||||
def attributes(*args)
|
def attributes(*args)
|
||||||
hash = super
|
hash = super
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module ExtraLocalesControllerCustomWizard
|
module ExtraLocalesControllerCustomWizard
|
||||||
private def valid_bundle?(bundle)
|
private def valid_bundle?(bundle)
|
||||||
super || begin
|
super || begin
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module InvitesControllerCustomWizard
|
module InvitesControllerCustomWizard
|
||||||
def path(url)
|
def path(url)
|
||||||
if ::Wizard.user_requires_completion?(@user)
|
if ::Wizard.user_requires_completion?(@user)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module CustomWizardUsersController
|
module CustomWizardUsersController
|
||||||
def account_created
|
def account_created
|
||||||
if current_user.present? &&
|
if current_user.present? &&
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module CustomWizardFieldExtension
|
module CustomWizardFieldExtension
|
||||||
attr_reader :raw,
|
attr_reader :raw,
|
||||||
:label,
|
:label,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module CustomWizardStepExtension
|
module CustomWizardStepExtension
|
||||||
attr_accessor :title, :description, :key, :permitted, :permitted_message
|
attr_accessor :title, :description, :key, :permitted, :permitted_message
|
||||||
end
|
end
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module Jobs
|
module Jobs
|
||||||
class ClearAfterTimeWizard < ::Jobs::Base
|
class ClearAfterTimeWizard < ::Jobs::Base
|
||||||
sidekiq_options queue: 'critical'
|
sidekiq_options queue: 'critical'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module Jobs
|
module Jobs
|
||||||
class RefreshApiAccessToken < ::Jobs::Base
|
class RefreshApiAccessToken < ::Jobs::Base
|
||||||
def execute(args)
|
def execute(args)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
module Jobs
|
module Jobs
|
||||||
class SetAfterTimeWizard < ::Jobs::Base
|
class SetAfterTimeWizard < ::Jobs::Base
|
||||||
def execute(args)
|
def execute(args)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::Action
|
class CustomWizard::Action
|
||||||
attr_accessor :data,
|
attr_accessor :data,
|
||||||
:action,
|
:action,
|
||||||
|
@ -465,7 +466,6 @@ class CustomWizard::Action
|
||||||
name = keyArr.first
|
name = keyArr.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
registered = registered_fields.select { |f| f[:name] == name }
|
registered = registered_fields.select { |f| f[:name] == name }
|
||||||
if registered.first.present?
|
if registered.first.present?
|
||||||
klass = registered.first[:klass]
|
klass = registered.first[:klass]
|
||||||
|
@ -712,7 +712,7 @@ class CustomWizard::Action
|
||||||
|
|
||||||
if @log.any?
|
if @log.any?
|
||||||
@log.each do |item|
|
@log.each do |item|
|
||||||
log << "; #{item.to_s}"
|
log += "; #{item.to_s}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::ActionResult
|
class CustomWizard::ActionResult
|
||||||
attr_accessor :success, :handler, :output
|
attr_accessor :success, :handler, :output
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::Api
|
class CustomWizard::Api
|
||||||
include ActiveModel::SerializerSupport
|
include ActiveModel::SerializerSupport
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'excon'
|
require 'excon'
|
||||||
|
|
||||||
class CustomWizard::Api::Authorization
|
class CustomWizard::Api::Authorization
|
||||||
|
@ -106,11 +107,11 @@ class CustomWizard::Api::Authorization
|
||||||
|
|
||||||
connection = Excon.new(
|
connection = Excon.new(
|
||||||
authorization.token_url,
|
authorization.token_url,
|
||||||
:headers => {
|
headers: {
|
||||||
"Content-Type" => "application/x-www-form-urlencoded"
|
"Content-Type" => "application/x-www-form-urlencoded"
|
||||||
},
|
},
|
||||||
:method => 'GET',
|
method: 'GET',
|
||||||
:query => URI.encode_www_form(body)
|
query: URI.encode_www_form(body)
|
||||||
)
|
)
|
||||||
begin
|
begin
|
||||||
result = connection.request()
|
result = connection.request()
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::Api::Endpoint
|
class CustomWizard::Api::Endpoint
|
||||||
include ActiveModel::SerializerSupport
|
include ActiveModel::SerializerSupport
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::Api::LogEntry
|
class CustomWizard::Api::LogEntry
|
||||||
include ActiveModel::SerializerSupport
|
include ActiveModel::SerializerSupport
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::Builder
|
class CustomWizard::Builder
|
||||||
attr_accessor :wizard, :updater, :submissions
|
attr_accessor :wizard, :updater, :submissions
|
||||||
|
|
||||||
|
@ -125,7 +126,7 @@ class CustomWizard::Builder
|
||||||
|
|
||||||
if final_step
|
if final_step
|
||||||
if @wizard.id == @wizard.user.custom_fields['redirect_to_wizard']
|
if @wizard.id == @wizard.user.custom_fields['redirect_to_wizard']
|
||||||
@wizard.user.custom_fields.delete('redirect_to_wizard');
|
@wizard.user.custom_fields.delete('redirect_to_wizard')
|
||||||
@wizard.user.save_custom_fields(true)
|
@wizard.user.save_custom_fields(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,6 @@ class ::CustomWizard::CustomField
|
||||||
add_error(I18n.t("#{i18n_key}.unsupported_type", type: value))
|
add_error(I18n.t("#{i18n_key}.unsupported_type", type: value))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if attr == 'name'
|
if attr == 'name'
|
||||||
unless value.is_a?(String)
|
unless value.is_a?(String)
|
||||||
add_error(I18n.t("#{i18n_key}.name_invalid", name: value))
|
add_error(I18n.t("#{i18n_key}.name_invalid", name: value))
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::Field
|
class CustomWizard::Field
|
||||||
def self.types
|
def self.types
|
||||||
@types ||= {
|
@types ||= {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::Log
|
class CustomWizard::Log
|
||||||
include ActiveModel::Serialization
|
include ActiveModel::Serialization
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::Mapper
|
class CustomWizard::Mapper
|
||||||
attr_accessor :inputs, :data, :user
|
attr_accessor :inputs, :data, :user
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::RealtimeValidation::Result
|
class CustomWizard::RealtimeValidation::Result
|
||||||
attr_accessor :type,
|
attr_accessor :type,
|
||||||
:items,
|
:items,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::RealtimeValidation::SimilarTopics
|
class CustomWizard::RealtimeValidation::SimilarTopics
|
||||||
attr_accessor :user
|
attr_accessor :user
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::StepUpdater
|
class CustomWizard::StepUpdater
|
||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::TemplateValidator
|
class CustomWizard::TemplateValidator
|
||||||
include HasErrors
|
include HasErrors
|
||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'addressable/uri'
|
require 'addressable/uri'
|
||||||
|
|
||||||
class ::CustomWizard::UpdateValidator
|
class ::CustomWizard::UpdateValidator
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_dependency 'wizard/step'
|
require_dependency 'wizard/step'
|
||||||
require_dependency 'wizard/field'
|
require_dependency 'wizard/field'
|
||||||
require_dependency 'wizard/step_updater'
|
require_dependency 'wizard/step_updater'
|
||||||
|
@ -177,7 +178,7 @@ class CustomWizard::Wizard
|
||||||
def can_access?
|
def can_access?
|
||||||
return false unless user
|
return false unless user
|
||||||
return true if user.admin
|
return true if user.admin
|
||||||
return permitted? && (multiple_submissions || !completed?)
|
permitted? && (multiple_submissions || !completed?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset
|
def reset
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
# name: discourse-custom-wizard
|
# name: discourse-custom-wizard
|
||||||
# about: Create custom wizards
|
# about: Create custom wizards
|
||||||
# version: 0.7.0
|
# version: 0.7.0
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::Api::AuthorizationSerializer < ::ApplicationSerializer
|
class CustomWizard::Api::AuthorizationSerializer < ::ApplicationSerializer
|
||||||
attributes :auth_type,
|
attributes :auth_type,
|
||||||
:auth_url,
|
:auth_url,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::Api::BasicEndpointSerializer < ::ApplicationSerializer
|
class CustomWizard::Api::BasicEndpointSerializer < ::ApplicationSerializer
|
||||||
attributes :id,
|
attributes :id,
|
||||||
:name
|
:name
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::Api::EndpointSerializer < ::ApplicationSerializer
|
class CustomWizard::Api::EndpointSerializer < ::ApplicationSerializer
|
||||||
attributes :id,
|
attributes :id,
|
||||||
:name,
|
:name,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::Api::LogSerializer < ::ApplicationSerializer
|
class CustomWizard::Api::LogSerializer < ::ApplicationSerializer
|
||||||
attributes :log_id,
|
attributes :log_id,
|
||||||
:time,
|
:time,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::ApiSerializer < ::ApplicationSerializer
|
class CustomWizard::ApiSerializer < ::ApplicationSerializer
|
||||||
attributes :name,
|
attributes :name,
|
||||||
:title,
|
:title,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::BasicApiSerializer < ::ApplicationSerializer
|
class CustomWizard::BasicApiSerializer < ::ApplicationSerializer
|
||||||
attributes :name,
|
attributes :name,
|
||||||
:title,
|
:title,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::BasicWizardSerializer < ::ApplicationSerializer
|
class CustomWizard::BasicWizardSerializer < ::ApplicationSerializer
|
||||||
attributes :id, :name
|
attributes :id, :name
|
||||||
end
|
end
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::CustomFieldSerializer < ApplicationSerializer
|
class CustomWizard::CustomFieldSerializer < ApplicationSerializer
|
||||||
attributes :id, :klass, :name, :type, :serializers
|
attributes :id, :klass, :name, :type, :serializers
|
||||||
end
|
end
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class CustomWizard::LogSerializer < ApplicationSerializer
|
class CustomWizard::LogSerializer < ApplicationSerializer
|
||||||
attributes :message, :date
|
attributes :message, :date
|
||||||
end
|
end
|
|
@ -1,2 +1,3 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
class ::CustomWizard::RealtimeValidation::SimilarTopicsSerializer < ::SimilarTopicSerializer
|
class ::CustomWizard::RealtimeValidation::SimilarTopicsSerializer < ::SimilarTopicSerializer
|
||||||
end
|
end
|
|
@ -1,5 +1,3 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require_relative '../../plugin_helper'
|
require_relative '../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::Builder do
|
describe CustomWizard::Builder do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../plugin_helper'
|
require_relative '../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::Field do
|
describe CustomWizard::Field do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../plugin_helper'
|
require_relative '../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::Log do
|
describe CustomWizard::Log do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../plugin_helper'
|
require_relative '../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::Mapper do
|
describe CustomWizard::Mapper do
|
||||||
|
@ -86,6 +87,8 @@ describe CustomWizard::Mapper do
|
||||||
|
|
||||||
it "does not map when one of multiple conditions are not met" do
|
it "does not map when one of multiple conditions are not met" do
|
||||||
user1.email = "angus@other-email.com"
|
user1.email = "angus@other-email.com"
|
||||||
|
user1.save
|
||||||
|
|
||||||
expect(CustomWizard::Mapper.new(
|
expect(CustomWizard::Mapper.new(
|
||||||
inputs: inputs['conditional_multiple_pairs'],
|
inputs: inputs['conditional_multiple_pairs'],
|
||||||
data: data,
|
data: data,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../plugin_helper'
|
require_relative '../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::Template do
|
describe CustomWizard::Template do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../plugin_helper'
|
require_relative '../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::TemplateValidator do
|
describe CustomWizard::TemplateValidator do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../plugin_helper'
|
require_relative '../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::UpdateValidator do
|
describe CustomWizard::UpdateValidator do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../plugin_helper'
|
require_relative '../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::Wizard do
|
describe CustomWizard::Wizard do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../plugin_helper'
|
require_relative '../plugin_helper'
|
||||||
|
|
||||||
describe ExtraLocalesControllerCustomWizard, type: :request do
|
describe ExtraLocalesControllerCustomWizard, type: :request do
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../plugin_helper'
|
require_relative '../plugin_helper'
|
||||||
|
|
||||||
describe InvitesControllerCustomWizard, type: :request do
|
describe InvitesControllerCustomWizard, type: :request do
|
||||||
fab!(:topic) { Fabricate(:topic) }
|
fab!(:topic) { Fabricate(:topic) }
|
||||||
let(:invite) do
|
let(:invite) { Invite.generate(topic.user, email: "angus@mcleod.org", topic: topic) }
|
||||||
Invite.invite_by_email("angus@email.com", topic.user, topic)
|
|
||||||
end
|
|
||||||
let(:template) do
|
let(:template) do
|
||||||
JSON.parse(File.open(
|
JSON.parse(File.open(
|
||||||
"#{Rails.root}/plugins/discourse-custom-wizard/spec/fixtures/wizard.json"
|
"#{Rails.root}/plugins/discourse-custom-wizard/spec/fixtures/wizard.json"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../plugin_helper'
|
require_relative '../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizardUsersController, type: :request do
|
describe CustomWizardUsersController, type: :request do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../plugin_helper'
|
require_relative '../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizardFieldExtension do
|
describe CustomWizardFieldExtension do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../plugin_helper'
|
require_relative '../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizardStepExtension do
|
describe CustomWizardStepExtension do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../../plugin_helper'
|
require_relative '../../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::AdminCustomFieldsController do
|
describe CustomWizard::AdminCustomFieldsController do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../../plugin_helper'
|
require_relative '../../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::AdminLogsController do
|
describe CustomWizard::AdminLogsController do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../../plugin_helper'
|
require_relative '../../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::AdminManagerController do
|
describe CustomWizard::AdminManagerController do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../../plugin_helper'
|
require_relative '../../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::AdminSubmissionsController do
|
describe CustomWizard::AdminSubmissionsController do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../../plugin_helper'
|
require_relative '../../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::AdminWizardController do
|
describe CustomWizard::AdminWizardController do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../plugin_helper'
|
require_relative '../../plugin_helper'
|
||||||
|
|
||||||
describe ApplicationController do
|
describe ApplicationController do
|
||||||
|
|
|
@ -92,4 +92,3 @@ describe "custom field extensions" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../plugin_helper'
|
require_relative '../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::StepsController do
|
describe CustomWizard::StepsController do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require_relative '../../plugin_helper'
|
require_relative '../../plugin_helper'
|
||||||
|
|
||||||
describe CustomWizard::WizardController do
|
describe CustomWizard::WizardController do
|
||||||
|
|
|
@ -32,7 +32,7 @@ describe CustomWizard::FieldSerializer do
|
||||||
scope: Guardian.new(user)
|
scope: Guardian.new(user)
|
||||||
).as_json
|
).as_json
|
||||||
expect(json_array[0][:format]).to eq("YYYY-MM-DD")
|
expect(json_array[0][:format]).to eq("YYYY-MM-DD")
|
||||||
expect(json_array[5][:file_types]).to eq(".jpg,.png")
|
expect(json_array[3][:number]).to eq(4)
|
||||||
expect(json_array[4][:number]).to eq(5)
|
expect(json_array[6][:file_types]).to eq(".jpg,.png")
|
||||||
end
|
end
|
||||||
end
|
end
|
Laden …
In neuem Issue referenzieren