datashift_journey 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +391 -0
- data/Rakefile +26 -0
- data/app/assets/stylesheets/datashift_journey/partials/_state_jumper_toolbar.scss.erb +27 -0
- data/app/controllers/concerns/datashift_journey/error_renderer.rb +9 -0
- data/app/controllers/concerns/datashift_journey/review_renderer.rb +21 -0
- data/app/controllers/concerns/datashift_journey/token_based_access.rb +23 -0
- data/app/controllers/concerns/datashift_journey/validate_state.rb +59 -0
- data/app/controllers/datashift_journey/abandon_enrollments_controller.rb +14 -0
- data/app/controllers/datashift_journey/abandonments_controller.rb +17 -0
- data/app/controllers/datashift_journey/api/v1/states_controller.rb +49 -0
- data/app/controllers/datashift_journey/application_controller.rb +53 -0
- data/app/controllers/datashift_journey/errors_controller.rb +24 -0
- data/app/controllers/datashift_journey/journey_ends_controller.rb +19 -0
- data/app/controllers/datashift_journey/journey_plans_controller.rb +166 -0
- data/app/controllers/datashift_journey/page_states_controller.rb +49 -0
- data/app/controllers/datashift_journey/reviews_controller.rb +32 -0
- data/app/controllers/datashift_journey/state_jumper_controller.rb +51 -0
- data/app/factories/datashift_journey/form_object_factory.rb +68 -0
- data/app/forms/datashift_journey/collector/base_collector_form.rb +60 -0
- data/app/forms/datashift_journey/concerns/form_mixin.rb +64 -0
- data/app/forms/datashift_journey/null_form.rb +20 -0
- data/app/helpers/datashift_journey/application_helper.rb +50 -0
- data/app/helpers/datashift_journey/back_link_helper.rb +9 -0
- data/app/models/datashift_journey/collector/data_node.rb +18 -0
- data/app/models/datashift_journey/collector/form_definition.rb +35 -0
- data/app/models/datashift_journey/collector/form_field.rb +61 -0
- data/app/models/datashift_journey/journey_review.rb +65 -0
- data/app/models/datashift_journey/review_data_section.rb +32 -0
- data/app/serializers/datashift_journey/collector/page_state_serializer.rb +9 -0
- data/app/serializers/state_machines/state/state_serializer.rb +5 -0
- data/app/views/datashift_journey/collector/_generic_form.html.erb +14 -0
- data/app/views/datashift_journey/errors/401.html.erb +13 -0
- data/app/views/datashift_journey/errors/403.html.erb +13 -0
- data/app/views/datashift_journey/errors/404.html.erb +13 -0
- data/app/views/datashift_journey/errors/422.html.erb +11 -0
- data/app/views/datashift_journey/errors/500.html.erb +13 -0
- data/app/views/datashift_journey/errors/503.html.erb +11 -0
- data/app/views/datashift_journey/errors/invalid_authenticity_token.html.erb +14 -0
- data/app/views/datashift_journey/journey_ends/new.html.erb +5 -0
- data/app/views/datashift_journey/journey_ends/show.html.erb +5 -0
- data/app/views/datashift_journey/journey_plans/_form.html.erb +14 -0
- data/app/views/datashift_journey/journey_plans/_render_fields.html.erb +24 -0
- data/app/views/datashift_journey/journey_plans/edit.html.erb +6 -0
- data/app/views/datashift_journey/journey_plans/new.html.erb +6 -0
- data/app/views/datashift_journey/shared/_default_actions.html.erb +6 -0
- data/app/views/datashift_journey/shared/_errors.html.erb +19 -0
- data/app/views/datashift_journey/shared/_submit_action.html.erb +5 -0
- data/app/views/datashift_journey/state_jumper/_toolbar.html.erb +16 -0
- data/config/brakeman.ignore +42 -0
- data/config/i18n-tasks.yml +103 -0
- data/config/initializers/exceptions_app.rb +3 -0
- data/config/initializers/mime_types.rb +1 -0
- data/config/initializers/rswag-api.rb +14 -0
- data/config/initializers/rswag-ui.rb +9 -0
- data/config/locales/en.yml +39 -0
- data/config/routes.rb +44 -0
- data/lib/datashift_journey/collector/field_snippet.rb +12 -0
- data/lib/datashift_journey/collector/page_state_snippet.rb +12 -0
- data/lib/datashift_journey/collector/snippet.rb +14 -0
- data/lib/datashift_journey/configuration.rb +103 -0
- data/lib/datashift_journey/engine.rb +38 -0
- data/lib/datashift_journey/exceptions.rb +26 -0
- data/lib/datashift_journey/helpers/back_link.rb +58 -0
- data/lib/datashift_journey/journey/machine_builder.rb +59 -0
- data/lib/datashift_journey/prepare_data_for_review.rb +219 -0
- data/lib/datashift_journey/reference_generator.rb +51 -0
- data/lib/datashift_journey/state_machines/branch_sequence_map.rb +35 -0
- data/lib/datashift_journey/state_machines/extensions.rb +40 -0
- data/lib/datashift_journey/state_machines/planner.rb +206 -0
- data/lib/datashift_journey/state_machines/sequence.rb +86 -0
- data/lib/datashift_journey/state_machines/state_machine_core_ext.rb +72 -0
- data/lib/datashift_journey/version.rb +3 -0
- data/lib/datashift_journey.rb +57 -0
- data/lib/generators/datashift_journey/collector/collector_generator.rb +43 -0
- data/lib/generators/datashift_journey/collector/install_collector_generator.rb +61 -0
- data/lib/generators/datashift_journey/collector/install_mongo_collector_generator.rb +44 -0
- data/lib/generators/datashift_journey/collector/templates/collector_concern.rb.tt +34 -0
- data/lib/generators/datashift_journey/collector/templates/collector_migration.rb.tt +46 -0
- data/lib/generators/datashift_journey/forms_generator.rb +45 -0
- data/lib/generators/datashift_journey/generate_common.rb +33 -0
- data/lib/generators/datashift_journey/setup/USAGE +12 -0
- data/lib/generators/datashift_journey/setup/setup_generator.rb +44 -0
- data/lib/generators/datashift_journey/setup/templates/initializer.rb.tt +17 -0
- data/lib/generators/datashift_journey/setup/templates/model_concern.rb.tt +37 -0
- data/lib/generators/datashift_journey/templates/base_form.rb.tt +7 -0
- data/lib/generators/datashift_journey/templates/collector_form.rb.tt +18 -0
- data/lib/generators/datashift_journey/templates/collector_view.rb.tt +15 -0
- data/lib/generators/datashift_journey/templates/journey_plan_form.rb.tt +23 -0
- data/lib/generators/datashift_journey/templates/journey_plan_view.rb.tt +15 -0
- data/lib/generators/datashift_journey/views_generator.rb +35 -0
- data/lib/tasks/state_machine.thor +48 -0
- data/spec/datashift_journey/complex_journey_spec.rb +132 -0
- data/spec/datashift_journey/machine_builder_spec.rb +268 -0
- data/spec/datashift_journey/planner_spec.rb +129 -0
- data/spec/datashift_journey/sequence_spec.rb +20 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +16 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/forms/base_form.rb +8 -0
- data/spec/dummy/app/forms/business_details_form.rb +17 -0
- data/spec/dummy/app/forms/business_type_form.rb +17 -0
- data/spec/dummy/app/forms/contact_details_form.rb +17 -0
- data/spec/dummy/app/forms/enter_reg_number_form.rb +17 -0
- data/spec/dummy/app/forms/new_or_renew_form.rb +17 -0
- data/spec/dummy/app/forms/postal_address_form.rb +17 -0
- data/spec/dummy/app/forms/question1_form.rb +9 -0
- data/spec/dummy/app/forms/question2_form.rb +12 -0
- data/spec/dummy/app/forms/sole_trader_name_form.rb +17 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/payment.rb +5 -0
- data/spec/dummy/app/services/datashift_journey/models/collector_journey.rb +51 -0
- data/spec/dummy/app/views/_question1.html.erb +13 -0
- data/spec/dummy/app/views/_question2.html.erb +9 -0
- data/spec/dummy/app/views/layouts/alternative.html.erb +14 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/pages/home.html.erb +6 -0
- data/spec/dummy/app/views/pages/start.html.erb +5 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config/application.rb +39 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +22 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +47 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +47 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/datashift_journey.rb +6 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +27 -0
- data/spec/dummy/config/routes.rb +28 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/20160101091218_create_dummy_checkout.rb +43 -0
- data/spec/dummy/db/migrate/20161221100703_datashift_journey_create_collector.rb +56 -0
- data/spec/dummy/db/schema.rb +142 -0
- data/spec/dummy/lib/version.rb +1 -0
- data/spec/factories/collector_factory.rb +16 -0
- data/spec/factories/collector_snippet_factory.rb +9 -0
- data/spec/factories/collector_state_page_factory.rb +12 -0
- data/spec/factories/data_node_factory.rb +9 -0
- data/spec/factories/form_factory.rb +6 -0
- data/spec/features/basic_navigation_spec.rb +125 -0
- data/spec/helpers/application_helper_spec.rb +40 -0
- data/spec/integration/collector/page_state_spec.rb +45 -0
- data/spec/models/collector/collector_spec.rb +100 -0
- data/spec/models/collector/page_state_spec.rb +30 -0
- data/spec/rails_helper.rb +73 -0
- data/spec/requests/collector/api/v1/page_state_spec.rb +85 -0
- data/spec/requests/collector/api/v1/states_spec.rb +28 -0
- data/spec/spec_helper.rb +63 -0
- data/spec/support/asserts.rb +27 -0
- data/spec/support/mailer_macros.rb +25 -0
- data/spec/support/page_objects/base_page_object.rb +77 -0
- data/spec/swagger_helper.rb +25 -0
- metadata +425 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
DatashiftJourney::Journey::MachineBuilder.create_journey_plan(initial: :new_or_renew) do
|
|
2
|
+
|
|
3
|
+
# the parent state and the routing criteria to each sequence
|
|
4
|
+
|
|
5
|
+
split_on_equality( :new_or_renew,
|
|
6
|
+
"new_or_renew_value", # Helper method on Collector
|
|
7
|
+
new_sequence: 'new',
|
|
8
|
+
renew_sequence: 'renew'
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
branch_sequence :new_sequence, [:business_type]
|
|
12
|
+
|
|
13
|
+
branch_sequence :renew_sequence, [:enter_reg_number]
|
|
14
|
+
|
|
15
|
+
# Define the sequences for Business Type split
|
|
16
|
+
# Partnership Limited Company Public Body Charity Authority Other
|
|
17
|
+
|
|
18
|
+
split_on_equality( :business_type,
|
|
19
|
+
"business_type_value", # Helper method on Collector,
|
|
20
|
+
other_sequence: 'other',
|
|
21
|
+
sole_trader_sequence: 'sole_trader',
|
|
22
|
+
limited_company: 'limited_company',
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
branch_sequence :sole_trader_sequence, [:sole_trader_name, :business_details]
|
|
26
|
+
|
|
27
|
+
branch_sequence :other_sequence, [:business_details]
|
|
28
|
+
|
|
29
|
+
branch_sequence :limited_company, [:business_details]
|
|
30
|
+
|
|
31
|
+
# RESTART COMMON JOURNEY AFTER BUSINESS TYPES
|
|
32
|
+
|
|
33
|
+
sequence [
|
|
34
|
+
:contact_details,
|
|
35
|
+
:postal_address
|
|
36
|
+
]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
DatashiftJourney::Collector::Collector.class_eval do
|
|
40
|
+
def new_or_renew_value
|
|
41
|
+
'new'
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def business_type_value
|
|
45
|
+
'sole_trader'
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def service_provided_value
|
|
49
|
+
'no'
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%#= You can access the Reform form object via local : form %>
|
|
2
|
+
<%#= You can access the Reform form model object via : form.model %>
|
|
3
|
+
<%#= You have access to main DSJ jopurney object via local : journey_plan %>
|
|
4
|
+
|
|
5
|
+
<header class="text">
|
|
6
|
+
<h1 class="form-title heading-large" id="groupLabel"><%= t(".header") %></h1>
|
|
7
|
+
</header>
|
|
8
|
+
|
|
9
|
+
<fieldset>
|
|
10
|
+
<legend class="visuallyhidden"><%= t(".legend") %></legend>
|
|
11
|
+
<%= f.label :field_value, t(".field_value_label"), class: 'form-label' %>
|
|
12
|
+
<%= f.text_field :field_value, class: 'form-control form-control-char-50' %>
|
|
13
|
+
</fieldset>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<header class="text">
|
|
2
|
+
<h1 class="form-title heading-large" id="groupLabel">Question 2</h1>
|
|
3
|
+
</header>
|
|
4
|
+
|
|
5
|
+
<fieldset>
|
|
6
|
+
<%= f.label :field_value, "Please enter name", class: 'form-label' %>
|
|
7
|
+
<%= f.text_field :field_value, class: 'form-control form-control-char-50' %>
|
|
8
|
+
</fieldset>
|
|
9
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
data/spec/dummy/bin/rake
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'pathname'
|
|
3
|
+
|
|
4
|
+
# path to your application root.
|
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
|
6
|
+
|
|
7
|
+
Dir.chdir APP_ROOT do
|
|
8
|
+
# This script is a starting point to setup your application.
|
|
9
|
+
# Add necessary setup steps to this file:
|
|
10
|
+
|
|
11
|
+
puts "== Installing dependencies =="
|
|
12
|
+
system "gem install bundler --conservative"
|
|
13
|
+
system "bundle check || bundle install"
|
|
14
|
+
|
|
15
|
+
# puts "\n== Copying sample files =="
|
|
16
|
+
# unless File.exist?("config/database.yml")
|
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
|
18
|
+
# end
|
|
19
|
+
|
|
20
|
+
puts "\n== Preparing database =="
|
|
21
|
+
system "bin/rake db:setup"
|
|
22
|
+
|
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
|
24
|
+
system "rm -f log/*"
|
|
25
|
+
system "rm -rf tmp/cache"
|
|
26
|
+
|
|
27
|
+
puts "\n== Restarting application server =="
|
|
28
|
+
system "touch tmp/restart.txt"
|
|
29
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
# Pick the frameworks you want:
|
|
4
|
+
require "active_record/railtie"
|
|
5
|
+
require "action_controller/railtie"
|
|
6
|
+
require "action_mailer/railtie"
|
|
7
|
+
require "action_view/railtie"
|
|
8
|
+
require "sprockets/railtie"
|
|
9
|
+
# require "rails/test_unit/railtie"
|
|
10
|
+
|
|
11
|
+
Bundler.require(*Rails.groups)
|
|
12
|
+
|
|
13
|
+
require "datashift_journey"
|
|
14
|
+
require "has_secure_token"
|
|
15
|
+
|
|
16
|
+
module Dummy
|
|
17
|
+
class Application < Rails::Application
|
|
18
|
+
|
|
19
|
+
config.to_prepare do
|
|
20
|
+
Dir.glob(File.join(Rails.root, "app/services", "**/*.rb")).each do |c|
|
|
21
|
+
require_dependency(c)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
26
|
+
# Application configuration should go into files in config/initializers
|
|
27
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
28
|
+
|
|
29
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
30
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
31
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
32
|
+
|
|
33
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
34
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
35
|
+
# config.i18n.default_locale = :de
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
VERSION = "0.0.1"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# SQLite version 3.x
|
|
2
|
+
# gem install sqlite3
|
|
3
|
+
#
|
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
|
5
|
+
# gem 'sqlite3'
|
|
6
|
+
#
|
|
7
|
+
default: &default
|
|
8
|
+
adapter: sqlite3
|
|
9
|
+
pool: 5
|
|
10
|
+
timeout: 5000
|
|
11
|
+
|
|
12
|
+
development:
|
|
13
|
+
<<: *default
|
|
14
|
+
database: db/development.sqlite3
|
|
15
|
+
|
|
16
|
+
test:
|
|
17
|
+
<<: *default
|
|
18
|
+
database: db/test.sqlite3
|
|
19
|
+
|
|
20
|
+
production:
|
|
21
|
+
<<: *default
|
|
22
|
+
database: db/production.sqlite3
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Rails.application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
3
|
+
|
|
4
|
+
# In the development environment your application's code is reloaded on
|
|
5
|
+
# every request. This slows down response time but is perfect for development
|
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
|
7
|
+
config.cache_classes = false
|
|
8
|
+
|
|
9
|
+
# Do not eager load code on boot.
|
|
10
|
+
config.eager_load = false
|
|
11
|
+
|
|
12
|
+
# Show full error reports and disable caching.
|
|
13
|
+
config.consider_all_requests_local = true
|
|
14
|
+
config.action_controller.perform_caching = false
|
|
15
|
+
|
|
16
|
+
# Don't care if the mailer can't send.
|
|
17
|
+
config.action_mailer.raise_delivery_errors = true
|
|
18
|
+
|
|
19
|
+
# Use mailcatcher in development ,,, http://mailcatcher.me/
|
|
20
|
+
# Run 'mailcatcher &' and then visit to see the emails
|
|
21
|
+
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
|
22
|
+
config.action_mailer.delivery_method = :smtp
|
|
23
|
+
config.action_mailer.smtp_settings = {:address => "localhost", :port => 1025}
|
|
24
|
+
|
|
25
|
+
# Print deprecation notices to the Rails logger.
|
|
26
|
+
config.active_support.deprecation = :log
|
|
27
|
+
|
|
28
|
+
# Raise an error on page load if there are pending migrations.
|
|
29
|
+
config.active_record.migration_error = :page_load
|
|
30
|
+
|
|
31
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
|
32
|
+
# This option may cause significant delays in view rendering with a large
|
|
33
|
+
# number of complex assets.
|
|
34
|
+
config.assets.debug = true
|
|
35
|
+
|
|
36
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
|
37
|
+
# yet still be able to expire them through the digest params.
|
|
38
|
+
config.assets.digest = true
|
|
39
|
+
|
|
40
|
+
# Adds additional error checking when serving assets at runtime.
|
|
41
|
+
# Checks for improperly declared sprockets dependencies.
|
|
42
|
+
# Raises helpful error messages.
|
|
43
|
+
config.assets.raise_runtime_errors = true
|
|
44
|
+
|
|
45
|
+
# Raises error for missing translations
|
|
46
|
+
# config.action_view.raise_on_missing_translations = true
|
|
47
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Rails.application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
3
|
+
|
|
4
|
+
# Code is not reloaded between requests.
|
|
5
|
+
config.cache_classes = true
|
|
6
|
+
|
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
|
8
|
+
# your application in memory, allowing both threaded web servers
|
|
9
|
+
# and those relying on copy on write to perform better.
|
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
|
11
|
+
config.eager_load = true
|
|
12
|
+
|
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
|
14
|
+
config.consider_all_requests_local = false
|
|
15
|
+
config.action_controller.perform_caching = true
|
|
16
|
+
|
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like
|
|
20
|
+
# NGINX, varnish or squid.
|
|
21
|
+
# config.action_dispatch.rack_cache = true
|
|
22
|
+
|
|
23
|
+
# Disable serving static files from the `/public` folder by default since
|
|
24
|
+
# Apache or NGINX already handles this.
|
|
25
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
|
26
|
+
|
|
27
|
+
# Compress JavaScripts and CSS.
|
|
28
|
+
config.assets.js_compressor = :uglifier
|
|
29
|
+
# config.assets.css_compressor = :sass
|
|
30
|
+
|
|
31
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
|
32
|
+
config.assets.compile = false
|
|
33
|
+
|
|
34
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
|
35
|
+
# yet still be able to expire them through the digest params.
|
|
36
|
+
config.assets.digest = true
|
|
37
|
+
|
|
38
|
+
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
|
39
|
+
|
|
40
|
+
# Specifies the header that your server uses for sending files.
|
|
41
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
|
42
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
|
43
|
+
|
|
44
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
45
|
+
# config.force_ssl = true
|
|
46
|
+
|
|
47
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
|
48
|
+
# when problems arise.
|
|
49
|
+
config.log_level = :debug
|
|
50
|
+
|
|
51
|
+
# Prepend all log lines with the following tags.
|
|
52
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
|
53
|
+
|
|
54
|
+
# Use a different logger for distributed setups.
|
|
55
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
|
56
|
+
|
|
57
|
+
# Use a different cache store in production.
|
|
58
|
+
# config.cache_store = :mem_cache_store
|
|
59
|
+
|
|
60
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
|
61
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
|
62
|
+
|
|
63
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
|
64
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
|
65
|
+
# config.action_mailer.raise_delivery_errors = false
|
|
66
|
+
|
|
67
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
68
|
+
# the I18n.default_locale when a translation cannot be found).
|
|
69
|
+
config.i18n.fallbacks = true
|
|
70
|
+
|
|
71
|
+
# Send deprecation notices to registered listeners.
|
|
72
|
+
config.active_support.deprecation = :notify
|
|
73
|
+
|
|
74
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
|
75
|
+
config.log_formatter = ::Logger::Formatter.new
|
|
76
|
+
|
|
77
|
+
# Do not dump schema after migrations.
|
|
78
|
+
config.active_record.dump_schema_after_migration = false
|
|
79
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Rails.application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
3
|
+
|
|
4
|
+
Rails.application.routes.default_url_options = {
|
|
5
|
+
host: 'localhost',
|
|
6
|
+
port: 3000
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
# The test environment is used exclusively to run your application's
|
|
10
|
+
# test suite. You never need to work with it otherwise. Remember that
|
|
11
|
+
# your test database is "scratch space" for the test suite and is wiped
|
|
12
|
+
# and recreated between test runs. Don't rely on the data there!
|
|
13
|
+
config.cache_classes = true
|
|
14
|
+
|
|
15
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
|
16
|
+
# just for the purpose of running a single test. If you are using a tool that
|
|
17
|
+
# preloads Rails for running tests, you may have to set it to true.
|
|
18
|
+
config.eager_load = false
|
|
19
|
+
|
|
20
|
+
# Configure static file server for tests with Cache-Control for performance.
|
|
21
|
+
config.public_file_server.enabled = true
|
|
22
|
+
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
|
23
|
+
|
|
24
|
+
# Show full error reports and disable caching.
|
|
25
|
+
config.consider_all_requests_local = true
|
|
26
|
+
config.action_controller.perform_caching = false
|
|
27
|
+
|
|
28
|
+
# Raise exceptions instead of rendering exception templates.
|
|
29
|
+
config.action_dispatch.show_exceptions = false
|
|
30
|
+
|
|
31
|
+
# Disable request forgery protection in test environment.
|
|
32
|
+
config.action_controller.allow_forgery_protection = false
|
|
33
|
+
|
|
34
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
|
35
|
+
# The :test delivery method accumulates sent emails in the
|
|
36
|
+
# ActionMailer::Base.deliveries array.
|
|
37
|
+
config.action_mailer.delivery_method = :test
|
|
38
|
+
|
|
39
|
+
# Randomize the order test cases are executed.
|
|
40
|
+
config.active_support.test_order = :random
|
|
41
|
+
|
|
42
|
+
# Print deprecation notices to the stderr.
|
|
43
|
+
config.active_support.deprecation = :stderr
|
|
44
|
+
|
|
45
|
+
# Raises error for missing translations
|
|
46
|
+
# config.action_view.raise_on_missing_translations = true
|
|
47
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Version of your assets, change this if you want to expire all your assets.
|
|
4
|
+
Rails.application.config.assets.version = '1.0'
|
|
5
|
+
|
|
6
|
+
# Add additional assets to the asset load path
|
|
7
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
|
8
|
+
|
|
9
|
+
# Precompile additional assets.
|
|
10
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
|
11
|
+
# Rails.application.config.assets.precompile += %w( search.js )
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
|
5
|
+
|
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
|
4
|
+
# are locale specific, and you may define rules for as many different
|
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
|
9
|
+
# inflect.irregular 'person', 'people'
|
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
|
11
|
+
# end
|
|
12
|
+
|
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
15
|
+
# inflect.acronym 'RESTful'
|
|
16
|
+
# end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
|
4
|
+
# is enabled by default.
|
|
5
|
+
|
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
|
13
|
+
# self.include_root_in_json = true
|
|
14
|
+
# end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
|
3
|
+
# than English, add the necessary files in this directory.
|
|
4
|
+
#
|
|
5
|
+
# To use the locales, use `I18n.t`:
|
|
6
|
+
#
|
|
7
|
+
# I18n.t 'hello'
|
|
8
|
+
#
|
|
9
|
+
# In views, this is aliased to just `t`:
|
|
10
|
+
#
|
|
11
|
+
# <%= t('hello') %>
|
|
12
|
+
#
|
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
|
14
|
+
#
|
|
15
|
+
# I18n.locale = :es
|
|
16
|
+
#
|
|
17
|
+
# This would use the information in config/locales/es.yml.
|
|
18
|
+
#
|
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
|
21
|
+
|
|
22
|
+
en:
|
|
23
|
+
hello: "Hello world"
|
|
24
|
+
back: "back"
|
|
25
|
+
backto_start_link: "http://www.dummyapp.uk"
|
|
26
|
+
rspec_snippet_text: "test sentance for I18n snippets"
|
|
27
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Rails.application.routes.draw do
|
|
2
|
+
|
|
3
|
+
mount Rswag::Api::Engine => '/api-docs'
|
|
4
|
+
mount Rswag::Ui::Engine => '/api-docs'
|
|
5
|
+
|
|
6
|
+
# This line mounts Datashift Journey's routes at the root of your application.
|
|
7
|
+
# If you would like to change where this engine is mounted, simply change the :at option to something different.
|
|
8
|
+
#
|
|
9
|
+
mount DatashiftJourney::Engine => "/"
|
|
10
|
+
|
|
11
|
+
root to: "datashift_journey/journey_plans#new"
|
|
12
|
+
|
|
13
|
+
get '/shift_state/journey_plans/:state/:id', :to => 'datashift_journey/journey_plans#update'
|
|
14
|
+
get '/shift_state/journey_plans/:id', :to => 'datashift_journey/journey_plans#update'
|
|
15
|
+
|
|
16
|
+
match '(errors)/:status', to: 'datashift_journey/errors#show', via: :all, constraints: { status: /\d{3}/ }
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# This line mounts Datashift Journey's Collector routes
|
|
20
|
+
#
|
|
21
|
+
scope :api, constraints: { format: 'json' } do
|
|
22
|
+
scope :v1 do
|
|
23
|
+
resources :states, only: [:index], controller: 'datashift_journey/api/v1/states'
|
|
24
|
+
|
|
25
|
+
resources :page_states, only: [:index, :create, :show], controller: 'datashift_journey/page_states'
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
|
5
|
+
|
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
|
9
|
+
|
|
10
|
+
# Make sure the secrets in this file are kept private
|
|
11
|
+
# if you're sharing your code publicly.
|
|
12
|
+
|
|
13
|
+
development:
|
|
14
|
+
secret_key_base: e358acd635c4f779ec6689f017c4d5c22897762708984e9fa4a4c0003fde53164e5a62577a8c886387df4f0c996b7e016f182e9280cc63aab60cc6ca7fca40da
|
|
15
|
+
|
|
16
|
+
test:
|
|
17
|
+
secret_key_base: 86bc23bb075d49f7de9e4168c20fd7cfd49d47cb9e40573abe63d1ccfeae559e92c9db02773607d932e586b5b1f14b978f2912269316157d8f0cb328588b4d9e
|
|
18
|
+
|
|
19
|
+
# Do not keep production secrets in the repository,
|
|
20
|
+
# instead read values from the environment.
|
|
21
|
+
production:
|
|
22
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
class CreateDummyCheckout < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
|
|
4
|
+
mod = "datashift_journey"
|
|
5
|
+
|
|
6
|
+
create_table :addresses do |t|
|
|
7
|
+
t.string :premises, limit: 200
|
|
8
|
+
t.string :street_address, limit: 160
|
|
9
|
+
t.string :locality, limit: 70
|
|
10
|
+
t.string :city, limit: 30
|
|
11
|
+
t.string :postcode, limit: 8
|
|
12
|
+
t.string :country_iso, limit: 3
|
|
13
|
+
t.timestamps null: false
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
create_table "#{mod}_payments" do |t|
|
|
17
|
+
t.string :name
|
|
18
|
+
t.string :card
|
|
19
|
+
t.timestamps null: false
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
create_table "#{mod}_checkouts" do |t|
|
|
23
|
+
t.string :state # The standard format when working with a Single state machine/class
|
|
24
|
+
t.timestamps null: false
|
|
25
|
+
t.string :token
|
|
26
|
+
t.references :bill_address,index: true
|
|
27
|
+
t.references :ship_address, index: true
|
|
28
|
+
t.references :payment, index: true
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# For Rspec - Lots of different state machine classes required
|
|
33
|
+
# - because the state machine Name must be reflected in the Column
|
|
34
|
+
|
|
35
|
+
["checkout_empties", "checkout_as","checkout_bs","checkout_cs","checkout_ds","checkout_es","checkout_fs", ].each do |c|
|
|
36
|
+
create_table "#{mod}_#{c}" do |t|
|
|
37
|
+
t.string c.singularize
|
|
38
|
+
t.timestamps null: false
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
end
|