From bbfc5abae19e2a55fac05a31dc75558e8f894372 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Wed, 4 Dec 2019 22:13:51 +1100 Subject: [PATCH] Add rspec folder structure --- spec/components/custom_wizard/api_spec.rb | 21 +++ spec/components/custom_wizard/builder_spec.rb | 159 ++++++++++++++++++ .../custom_wizard/admin_controller_spec.rb | 5 + .../application_controller_spec.rb | 5 + .../custom_wizard/wizard_controller_spec.rb | 31 ++++ 5 files changed, 221 insertions(+) create mode 100644 spec/components/custom_wizard/api_spec.rb create mode 100644 spec/components/custom_wizard/builder_spec.rb create mode 100644 spec/requests/custom_wizard/admin_controller_spec.rb create mode 100644 spec/requests/custom_wizard/application_controller_spec.rb create mode 100644 spec/requests/custom_wizard/wizard_controller_spec.rb diff --git a/spec/components/custom_wizard/api_spec.rb b/spec/components/custom_wizard/api_spec.rb new file mode 100644 index 00000000..a7a8ba1b --- /dev/null +++ b/spec/components/custom_wizard/api_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe CustomWizard::Api do + context 'authorization' do + it 'authorizes with an oauth2 api' do + + end + + it 'refreshes the api access token' do + + end + end + + context 'endpoint' do + it 'requests an api endpoint' do + + end + end +end diff --git a/spec/components/custom_wizard/builder_spec.rb b/spec/components/custom_wizard/builder_spec.rb new file mode 100644 index 00000000..ba781cb9 --- /dev/null +++ b/spec/components/custom_wizard/builder_spec.rb @@ -0,0 +1,159 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe CustomWizard::Builder do + it "returns a wizard when enabled" do + ## implement enabled site setting first + end + + it "returns nothing when disabled" do + ## implement enabled site setting first + end + + it 'returns a wizard with prefilled data if user has partially completed' do + + end + + it 'returns a wiard with no prefilled data if options include reset' do + + end + + it 'returns nothing if the multiple submissions are disabled and user has completed' do + + end + + it 'returns nothing if the user is not permitted to see it' do + + end + + context 'building steps' do + it 'returns step data correctly' do + + end + + it 'saves permitted params' do + + end + + it 'ensures required data is present' do + + end + end + + context 'building fields' do + it 'returns field data correctly' do + + end + + it 'returns checkbox fields correctly' do + + end + + it 'returns upload fields correctly' do + + end + + it 'returns category fields correctly' do + + end + + it 'returns tag fields correctly' do + + end + + it 'returns custom dropdown fields correctly' do + + end + + it 'returns translated dropdown fields correctly' do + + end + + it 'returns preset dropdown fields correctly' do + + end + + it 'applies preset dropdown filters correctly' do + + end + + it 'prefils profile data correctly' do + + end + end + + context 'on update' do + context 'validation' do + it 'applies min length correctly' do + + end + + it 'standardises boolean entries' do + + end + + it 'requires required fields' do + ## this may require additional work? + end + + context 'submisisons' do + it 'saves submissions' do + + end + + it "doesn't save submissions if disabled" do + + end + end + end + + context 'custom_step_handlers' do + it 'runs custom step handlers' do + + end + end + + context 'actions' do + it 'runs all actions attached to a step' do + + end + + it 'interpolates wizard and user data correctly' do + + end + + it 'creates a topic' do + + end + + it 'sends a message' do + + end + + it 'doesnt sent a message if the required data is not present' do + + end + + it 'updates a profile' do + + end + + it 'calls an api' do + + end + + it 'opens a composer' do + + end + + it 'adds a user to a group' do + + end + + it 're-routes a user' do + + end + end + end +end \ No newline at end of file diff --git a/spec/requests/custom_wizard/admin_controller_spec.rb b/spec/requests/custom_wizard/admin_controller_spec.rb new file mode 100644 index 00000000..731d0de5 --- /dev/null +++ b/spec/requests/custom_wizard/admin_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +describe CustomWizard::AdminController do + +end \ No newline at end of file diff --git a/spec/requests/custom_wizard/application_controller_spec.rb b/spec/requests/custom_wizard/application_controller_spec.rb new file mode 100644 index 00000000..1315748d --- /dev/null +++ b/spec/requests/custom_wizard/application_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +describe ApplicationController do + +end \ No newline at end of file diff --git a/spec/requests/custom_wizard/wizard_controller_spec.rb b/spec/requests/custom_wizard/wizard_controller_spec.rb new file mode 100644 index 00000000..b457eba7 --- /dev/null +++ b/spec/requests/custom_wizard/wizard_controller_spec.rb @@ -0,0 +1,31 @@ +require 'rails_helper' + +describe CustomWizard::WizardController do + it 'returns a wizard if enabled' do + + end + + it 'returns a disabled message if disabled' do + + end + + it 'returns a missing message if no wizard exists' do + + end + + it 'returns a custom wizard theme' do + + end + + it 'updates the page title' do + + end + + it 'skips a wizard if user is allowed to skip' do + + end + + it 'returns a no skip message if user is not allowed to skip' do + + end +end \ No newline at end of file