dm_event 4.2.1.5
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/MIT-LICENSE +23 -0
- data/README.md +33 -0
- data/Rakefile +36 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/icon-64x44.png +0 -0
- data/app/assets/javascripts/dm_event/admin.js +94 -0
- data/app/assets/stylesheets/dm_event/admin.css +152 -0
- data/app/assets/stylesheets/dm_event/application.css +65 -0
- data/app/controllers/dm_event/admin/admin_controller.rb +13 -0
- data/app/controllers/dm_event/admin/registrations_controller.rb +411 -0
- data/app/controllers/dm_event/admin/workshop_prices_controller.rb +73 -0
- data/app/controllers/dm_event/admin/workshops_controller.rb +147 -0
- data/app/controllers/dm_event/application_controller.rb +23 -0
- data/app/controllers/dm_event/payments_controller.rb +83 -0
- data/app/controllers/dm_event/registrations_controller.rb +368 -0
- data/app/datatables/registration_datatable.rb +117 -0
- data/app/helpers/dm_event/application_helper.rb +4 -0
- data/app/helpers/dm_event/registrations_helper.rb +14 -0
- data/app/helpers/dm_event/workshops_helper.rb +41 -0
- data/app/mailers/payment_reminder_mailer.rb +25 -0
- data/app/mailers/registration_notify_mailer.rb +31 -0
- data/app/models/dm_event/concerns/ability.rb +38 -0
- data/app/models/dm_event/concerns/registration_state_email.rb +80 -0
- data/app/models/dm_event/concerns/registration_state_machine.rb +218 -0
- data/app/models/dm_event/concerns/user_profile.rb +20 -0
- data/app/models/dm_event/model_decorators.rb +6 -0
- data/app/models/dm_event/permitted_params.rb +35 -0
- data/app/models/payment.rb +48 -0
- data/app/models/registration.rb +297 -0
- data/app/models/workshop.rb +247 -0
- data/app/models/workshop_price.rb +118 -0
- data/app/presenters/event_common_presenter.rb +31 -0
- data/app/presenters/registration_presenter.rb +34 -0
- data/app/presenters/workshop_presenter.rb +22 -0
- data/app/views/dm_event/admin/registrations/_form.html.erb +297 -0
- data/app/views/dm_event/admin/registrations/action_state.js.erb +1 -0
- data/app/views/dm_event/admin/registrations/edit.html.erb +1 -0
- data/app/views/dm_event/admin/registrations/index.html.erb +0 -0
- data/app/views/dm_event/admin/workshop_prices/_form.html.erb +62 -0
- data/app/views/dm_event/admin/workshop_prices/edit.html.erb +2 -0
- data/app/views/dm_event/admin/workshop_prices/index.html.erb +31 -0
- data/app/views/dm_event/admin/workshop_prices/new.html.erb +2 -0
- data/app/views/dm_event/admin/workshops/_form.html.erb +61 -0
- data/app/views/dm_event/admin/workshops/_header_menu.html.erb +21 -0
- data/app/views/dm_event/admin/workshops/_registration_stats.html.erb +58 -0
- data/app/views/dm_event/admin/workshops/additional_configuration.html.erb +47 -0
- data/app/views/dm_event/admin/workshops/edit.html.erb +2 -0
- data/app/views/dm_event/admin/workshops/edit_system_email.html.erb +75 -0
- data/app/views/dm_event/admin/workshops/financials.html.erb +179 -0
- data/app/views/dm_event/admin/workshops/index.html.erb +100 -0
- data/app/views/dm_event/admin/workshops/lost_users.html.erb +44 -0
- data/app/views/dm_event/admin/workshops/new.html.erb +2 -0
- data/app/views/dm_event/admin/workshops/show.html.erb +47 -0
- data/app/views/dm_event/admin/workshops/user_outstanding_balances.html.erb +29 -0
- data/app/views/dm_event/liquid_tags/_funding_project_status.html.erb +27 -0
- data/app/views/dm_event/payments/_registrations_paypal_standard.html.erb +23 -0
- data/app/views/dm_event/payments/_registrations_sofort.html.erb +18 -0
- data/app/views/dm_event/registrations/_section_address.html.erb +30 -0
- data/app/views/dm_event/registrations/_section_custom_fields.html.erb +7 -0
- data/app/views/dm_event/registrations/_section_prices.html.erb +33 -0
- data/app/views/dm_event/registrations/_workshop_price.html.erb +18 -0
- data/app/views/dm_event/registrations/choose_payment.html.erb +5 -0
- data/app/views/dm_event/registrations/closed.html.erb +14 -0
- data/app/views/dm_event/registrations/new.html.erb +30 -0
- data/app/views/dm_event/registrations/success.html.erb +15 -0
- data/app/views/layouts/email_templates/dm_event_email_layout.html.erb +318 -0
- data/app/views/layouts/email_templates/dm_event_email_layout.text.erb +1 -0
- data/app/views/layouts/email_templates/dm_event_payment_reminder.html.erb +22 -0
- data/app/views/layouts/email_templates/dm_event_payment_reminder.text.erb +19 -0
- data/app/views/layouts/email_templates/dm_event_registration_notify.html.erb +21 -0
- data/app/views/layouts/email_templates/dm_event_registration_notify.text.erb +13 -0
- data/config/initializers/dm_event.rb +1 -0
- data/config/initializers/liquid_init.rb +2 -0
- data/config/locales/ems.cs.yml +51 -0
- data/config/locales/ems.de.yml +51 -0
- data/config/locales/ems.en.yml +51 -0
- data/config/locales/ems.fi.yml +51 -0
- data/config/locales/ems.ja.yml +51 -0
- data/config/routes.rb +40 -0
- data/db/migrate/20130510155617_create_events.rb +98 -0
- data/db/migrate/20130516124327_add_locale_to_registration.rb +5 -0
- data/db/migrate/20130516204454_add_user_profile_to_registration.rb +11 -0
- data/db/migrate/20130518092324_add_require_address.rb +7 -0
- data/db/migrate/20130609145812_add_workshop_published.rb +5 -0
- data/db/migrate/20130624134506_add_amount_currency.rb +16 -0
- data/db/migrate/20130703131515_add_workshop_currency.rb +5 -0
- data/db/migrate/20130913083529_add_event_funding_type.rb +6 -0
- data/db/migrate/20130914105736_add_enable_payments.rb +5 -0
- data/db/migrate/20130916160033_add_sidebar_to_workshop.rb +5 -0
- data/db/migrate/20130917161700_add_show_address.rb +5 -0
- data/db/migrate/20131116180719_add_default_funding_goal.rb +8 -0
- data/db/migrate/20131127165445_add_payment_reminder.rb +5 -0
- data/db/migrate/20140122204702_add_event_image.rb +5 -0
- data/db/migrate/20140523165342_add_workshop_summary.rb +5 -0
- data/db/migrate/20140605052208_add_uuid_to_registration.rb +10 -0
- data/db/migrate/20140707152124_add_registration_comment_count.rb +5 -0
- data/db/migrate/20140708142312_add_payment_comment.rb +20 -0
- data/db/migrate/20150709125105_add_payment_reminder_history.rb +16 -0
- data/db/migrate/20160810081542_add_bcc_contact_email.rb +5 -0
- data/db/migrate/20160821150120_index_foreign_keys_in_ems_registrations.rb +9 -0
- data/db/migrate/20160821150121_index_foreign_keys_in_ems_workshop_price_translations.rb +5 -0
- data/db/migrate/20160821150122_index_foreign_keys_in_ems_workshop_prices.rb +6 -0
- data/db/migrate/20160821150123_index_foreign_keys_in_ems_workshop_translations.rb +5 -0
- data/db/migrate/20160821150124_index_foreign_keys_in_ems_workshops.rb +6 -0
- data/lib/dm_event/engine.rb +20 -0
- data/lib/dm_event/liquid/tags/funding_project_status.rb +55 -0
- data/lib/dm_event.rb +4 -0
- data/lib/tasks/dm_event_tasks.rake +4 -0
- data/spec/controllers/registrations_controller_spec.rb +152 -0
- data/spec/dummy/README.rdoc +28 -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 +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/ability.rb +10 -0
- data/spec/dummy/app/models/user.rb +6 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -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/config/application.rb +26 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +82 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +8 -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/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 +23 -0
- data/spec/dummy/config/routes.rb +11 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20141114170927_add_globalize_countries.dm_core.rb +50 -0
- data/spec/dummy/db/migrate/20141114170928_devise_create_users.dm_core.rb +46 -0
- data/spec/dummy/db/migrate/20141114170929_add_user_fields.dm_core.rb +14 -0
- data/spec/dummy/db/migrate/20141114170930_rolify_create_roles.dm_core.rb +20 -0
- data/spec/dummy/db/migrate/20141114170931_add_last_access.dm_core.rb +10 -0
- data/spec/dummy/db/migrate/20141114170932_create_versions.dm_core.rb +19 -0
- data/spec/dummy/db/migrate/20141114170933_add_object_changes_column_to_versions.dm_core.rb +12 -0
- data/spec/dummy/db/migrate/20141114170934_create_dm_core_accounts.dm_core.rb +13 -0
- data/spec/dummy/db/migrate/20141114170935_add_account_to_users.dm_core.rb +9 -0
- data/spec/dummy/db/migrate/20141114170936_create_preferences.dm_core.rb +13 -0
- data/spec/dummy/db/migrate/20141114170937_create_comments.dm_core.rb +22 -0
- data/spec/dummy/db/migrate/20141114170938_add_activity.dm_core.rb +21 -0
- data/spec/dummy/db/migrate/20141114170939_add_type_to_comments.dm_core.rb +9 -0
- data/spec/dummy/db/migrate/20141114170940_add_category.dm_core.rb +28 -0
- data/spec/dummy/db/migrate/20141114170941_create_email_table.dm_core.rb +26 -0
- data/spec/dummy/db/migrate/20141114170942_add_user_profile.dm_core.rb +46 -0
- data/spec/dummy/db/migrate/20141114170943_add_profile_email.dm_core.rb +14 -0
- data/spec/dummy/db/migrate/20141114170944_create_payment_history.dm_core.rb +37 -0
- data/spec/dummy/db/migrate/20141114170945_change_anchor_field.dm_core.rb +10 -0
- data/spec/dummy/db/migrate/20141114170946_create_user_site_profile.dm_core.rb +27 -0
- data/spec/dummy/db/migrate/20141114170947_add_avatar.dm_core.rb +12 -0
- data/spec/dummy/db/migrate/20141114170948_add_notify_to_payment_history.dm_core.rb +8 -0
- data/spec/dummy/db/migrate/20141114170949_acts_as_votable_migration.dm_core.rb +28 -0
- data/spec/dummy/db/migrate/20141114170950_add_user_site_profile_uuid.dm_core.rb +19 -0
- data/spec/dummy/db/migrate/20141114170951_add_invoice_id.dm_core.rb +7 -0
- data/spec/dummy/db/migrate/20141114170952_acts_as_follower_migration.dm_core.rb +18 -0
- data/spec/dummy/db/migrate/20141114170953_rename_invoice_id.dm_core.rb +12 -0
- data/spec/dummy/db/migrate/20141114170954_add_core_addresses.dm_core.rb +18 -0
- data/spec/dummy/db/migrate/20141114170955_papertrail_increase_column.dm_core.rb +9 -0
- data/spec/dummy/db/migrate/20141114170956_acts_as_taggable_on_migration.dm_core.rb +32 -0
- data/spec/dummy/db/migrate/20141114170957_add_missing_unique_indices.dm_core.rb +23 -0
- data/spec/dummy/db/migrate/20141114170958_add_taggings_counter_cache_to_tags.dm_core.rb +16 -0
- data/spec/dummy/db/migrate/20141114170959_create_custom_fields.dm_core.rb +40 -0
- data/spec/dummy/db/migrate/20141114170960_add_missing_taggable_index.dm_core.rb +11 -0
- data/spec/dummy/db/migrate/20141119103740_create_cms.dm_cms.rb +92 -0
- data/spec/dummy/db/migrate/20141119103741_add_account_to_cms.dm_cms.rb +11 -0
- data/spec/dummy/db/migrate/20141119103742_create_blog.dm_cms.rb +62 -0
- data/spec/dummy/db/migrate/20141119103743_add_notification_sent.dm_cms.rb +6 -0
- data/spec/dummy/db/migrate/20141119103744_add_blog_comment.dm_cms.rb +8 -0
- data/spec/dummy/db/migrate/20141119103745_add_blog_image.dm_cms.rb +6 -0
- data/spec/dummy/db/migrate/20141119103746_rename_snippet_slug.dm_cms.rb +14 -0
- data/spec/dummy/db/migrate/20141119103747_add_requires_subscription_blog.dm_cms.rb +8 -0
- data/spec/dummy/db/migrate/20141119103748_add_pages_ranked_model.dm_cms.rb +23 -0
- data/spec/dummy/db/migrate/20141119103749_add_blog_owner.dm_cms.rb +7 -0
- data/spec/dummy/db/migrate/20141119103750_create_media_files.dm_cms.rb +30 -0
- data/spec/dummy/db/migrate/20141119103751_add_cmspage_summary.dm_cms.rb +7 -0
- data/spec/dummy/db/migrate/20141119103752_add_blog_image_email_header.dm_cms.rb +6 -0
- data/spec/dummy/db/migrate/20141119103753_add_header_image.dm_cms.rb +10 -0
- data/spec/dummy/db/migrate/20160128154135_add_favored_locale.dm_core.rb +17 -0
- data/spec/dummy/db/migrate/20160128154136_update_papertrail_v4.dm_core.rb +41 -0
- data/spec/dummy/db/schema.rb +677 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/account_factory.rb +7 -0
- data/spec/factories/registration_factory.rb +13 -0
- data/spec/factories/workshop_factory.rb +25 -0
- data/spec/factories/workshop_price_factory.rb +19 -0
- data/spec/models/registration_spec.rb +83 -0
- data/spec/models/workshop_spec.rb +26 -0
- data/spec/rails_helper.rb +70 -0
- data/spec/spec_helper.rb +85 -0
- data/spec/support/accounts.rb +17 -0
- data/spec/support/devise.rb +44 -0
- data/spec/support/fix_locale.rb +57 -0
- metadata +520 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body>
|
|
58
|
+
<!-- This file lives in public/404.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
|
63
|
+
</div>
|
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
65
|
+
</div>
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body>
|
|
58
|
+
<!-- This file lives in public/422.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
63
|
+
</div>
|
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
65
|
+
</div>
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body>
|
|
58
|
+
<!-- This file lives in public/500.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
|
62
|
+
</div>
|
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
64
|
+
</div>
|
|
65
|
+
</body>
|
|
66
|
+
</html>
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
FactoryGirl.define do
|
|
3
|
+
factory :registration do
|
|
4
|
+
amount_paid_cents 0
|
|
5
|
+
amount_paid_currency 'EUR'
|
|
6
|
+
discount_value nil
|
|
7
|
+
discount_use_percent nil
|
|
8
|
+
|
|
9
|
+
workshop
|
|
10
|
+
workshop_price { workshop.workshop_prices.first }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
FactoryGirl.define do
|
|
2
|
+
factory :workshop do
|
|
3
|
+
title_en 'Test Workshop'
|
|
4
|
+
description_en 'This is a test workshop'
|
|
5
|
+
slug 'test-workshop'
|
|
6
|
+
country_id 55
|
|
7
|
+
base_currency 'EUR'
|
|
8
|
+
event_style 'workshop'
|
|
9
|
+
starting_on '2014-12-01'
|
|
10
|
+
ending_on '2014-12-02'
|
|
11
|
+
contact_email 'email@example.com'
|
|
12
|
+
|
|
13
|
+
factory :workshop_with_price do
|
|
14
|
+
after(:create) do |workshop, evaluator|
|
|
15
|
+
create_list(:workshop_price, 1, workshop: workshop)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
factory :workshop_with_recurring_price do
|
|
20
|
+
after(:create) do |workshop, evaluator|
|
|
21
|
+
create_list(:workshop_price, 1, :with_recurring, workshop: workshop)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
FactoryGirl.define do
|
|
3
|
+
factory :workshop_price do
|
|
4
|
+
price_description "Sample Price"
|
|
5
|
+
price_cents 50000
|
|
6
|
+
price_currency 'EUR'
|
|
7
|
+
|
|
8
|
+
trait :with_workshop do
|
|
9
|
+
association :workshop
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
trait :with_recurring do
|
|
13
|
+
recurring_amount 10000
|
|
14
|
+
recurring_period 30 # days
|
|
15
|
+
recurring_number 5
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
DmCore.config.locales = [:en, :de]
|
|
3
|
+
|
|
4
|
+
describe Registration, :type => :model do
|
|
5
|
+
setup_account
|
|
6
|
+
|
|
7
|
+
describe '#payment_owed' do
|
|
8
|
+
|
|
9
|
+
let(:workshop) { create(:workshop) }
|
|
10
|
+
|
|
11
|
+
#------------------------------------------------------------------------------
|
|
12
|
+
it "full payment" do
|
|
13
|
+
workshop = create :workshop_with_price
|
|
14
|
+
registration = create :registration, workshop: workshop
|
|
15
|
+
expect(registration.payment_owed).to eq Money.new(50000, 'EUR')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
#------------------------------------------------------------------------------
|
|
19
|
+
it "full payment with discount" do
|
|
20
|
+
workshop = create :workshop_with_price
|
|
21
|
+
registration = create :registration, workshop: workshop, discount_value: 50, discount_use_percent: true
|
|
22
|
+
expect(registration.payment_owed).to eq Money.new(25000, 'EUR')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
#------------------------------------------------------------------------------
|
|
26
|
+
it "with partial payment" do
|
|
27
|
+
workshop = create :workshop_with_price
|
|
28
|
+
registration = create :registration, workshop: workshop, amount_paid_cents: 20000
|
|
29
|
+
expect(registration.payment_owed).to eq Money.new(30000, 'EUR')
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
#------------------------------------------------------------------------------
|
|
33
|
+
it "with partial payment with discount" do
|
|
34
|
+
workshop = create :workshop_with_price
|
|
35
|
+
registration = create :registration, workshop: workshop, amount_paid_cents: 20000, discount_value: 50, discount_use_percent: true
|
|
36
|
+
expect(registration.payment_owed).to eq Money.new(5000, 'EUR')
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
#------------------------------------------------------------------------------
|
|
40
|
+
it "first recurring payment" do
|
|
41
|
+
workshop = create :workshop_with_recurring_price
|
|
42
|
+
registration = create :registration, workshop: workshop
|
|
43
|
+
expect(registration.payment_owed).to eq Money.new(10000, 'EUR')
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
#------------------------------------------------------------------------------
|
|
47
|
+
it "recurring payment with partial payment" do
|
|
48
|
+
workshop = create :workshop_with_recurring_price
|
|
49
|
+
registration = create :registration, workshop: workshop, amount_paid_cents: 20000
|
|
50
|
+
expect(registration.payment_owed).to eq Money.new(10000, 'EUR')
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
#------------------------------------------------------------------------------
|
|
54
|
+
it "recurring payment with mostly paid" do
|
|
55
|
+
workshop = create :workshop_with_recurring_price
|
|
56
|
+
registration = create :registration, workshop: workshop, amount_paid_cents: 45000
|
|
57
|
+
expect(registration.payment_owed).to eq Money.new(5000, 'EUR')
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
#------------------------------------------------------------------------------
|
|
61
|
+
it "discounted recurring payment with partial payment" do
|
|
62
|
+
workshop = create :workshop_with_recurring_price
|
|
63
|
+
registration = create :registration, workshop: workshop, discount_value: 50, discount_use_percent: true
|
|
64
|
+
expect(registration.payment_owed).to eq Money.new(10000, 'EUR')
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
#------------------------------------------------------------------------------
|
|
68
|
+
it "pay remaining amount if within 20 EUR" do
|
|
69
|
+
workshop = create :workshop_with_recurring_price
|
|
70
|
+
registration = create :registration, workshop: workshop, amount_paid_cents: 39000
|
|
71
|
+
expect(registration.payment_owed).to eq Money.new(11000, 'EUR')
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
#------------------------------------------------------------------------------
|
|
75
|
+
it "pay 0 if no workshop prices" do
|
|
76
|
+
workshop = create :workshop
|
|
77
|
+
registration = create :registration, workshop: workshop
|
|
78
|
+
expect(workshop.workshop_prices.empty?).to be true
|
|
79
|
+
expect(registration.payment_owed).to eq Money.new(0, 'EUR')
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
DmCore.config.locales = [:en, :de]
|
|
3
|
+
|
|
4
|
+
describe Workshop, :type => :model do
|
|
5
|
+
setup_account
|
|
6
|
+
|
|
7
|
+
describe "workshop_prices" do
|
|
8
|
+
|
|
9
|
+
let(:workshop) { create(:workshop) }
|
|
10
|
+
|
|
11
|
+
#------------------------------------------------------------------------------
|
|
12
|
+
it "sets price correctly" do
|
|
13
|
+
# demonstrate that WorkshopPrice initializes with incorrect currency by default
|
|
14
|
+
workshop_price = workshop.workshop_prices.new('price' => '11000', 'price_currency' => 'JPY')
|
|
15
|
+
expect(workshop_price.price).not_to eq(Money.new(11000, 'JPY'))
|
|
16
|
+
|
|
17
|
+
attributes = WorkshopPrice.prepare_prices('price' => '11000', 'price_currency' => 'JPY',
|
|
18
|
+
'alt1_price' => '500', 'alt1_price_currency' => 'EUR',
|
|
19
|
+
'alt2_price' => '30000', 'alt2_price_currency' => 'USD')
|
|
20
|
+
workshop_price = workshop.workshop_prices.new(attributes)
|
|
21
|
+
expect(workshop_price.price).to eq(Money.new(11000, 'JPY'))
|
|
22
|
+
expect(workshop_price.alt1_price).to eq(Money.new(50000, 'EUR'))
|
|
23
|
+
expect(workshop_price.alt2_price).to eq(Money.new(3000000, 'USD'))
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Useful links for testing Engines
|
|
2
|
+
# http://viget.com/extend/rails-engine-testing-with-rspec-capybara-and-factorygirl
|
|
3
|
+
# http://www.andrewhavens.com/posts/27/how-to-create-a-new-rails-engine-which-uses-rspec-and-factorygirl-for-testing/
|
|
4
|
+
# https://www.honeybadger.io/blog/2014/01/28/rails4-engine-controller-specs
|
|
5
|
+
#------------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
|
8
|
+
ENV["RAILS_ENV"] ||= 'test'
|
|
9
|
+
|
|
10
|
+
# Zeus does not preload RSpec
|
|
11
|
+
require 'rspec/core' unless defined? RSpec.configure
|
|
12
|
+
|
|
13
|
+
require 'spec_helper'
|
|
14
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
|
15
|
+
require 'rspec/rails'
|
|
16
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
|
17
|
+
|
|
18
|
+
# Factories were not being initialized for the engine. This fixed it
|
|
19
|
+
# http://stackoverflow.com/questions/16064872/rails-3-factory-girl-factory-not-registered
|
|
20
|
+
FactoryGirl.definition_file_paths = [File.expand_path('../factories', __FILE__)]
|
|
21
|
+
FactoryGirl.find_definitions
|
|
22
|
+
|
|
23
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
|
24
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
|
25
|
+
# run as spec files by default. This means that files in spec/support that end
|
|
26
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
|
27
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
|
28
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
|
29
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
|
30
|
+
#
|
|
31
|
+
# The following line is provided for convenience purposes. It has the downside
|
|
32
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
|
33
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
|
34
|
+
# require only the support files necessary.
|
|
35
|
+
#
|
|
36
|
+
# Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
|
37
|
+
ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')
|
|
38
|
+
Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
|
|
39
|
+
|
|
40
|
+
# Checks for pending migrations before tests are run.
|
|
41
|
+
# If you are not using ActiveRecord, you can remove this line.
|
|
42
|
+
ActiveRecord::Migration.maintain_test_schema!
|
|
43
|
+
|
|
44
|
+
RSpec.configure do |config|
|
|
45
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
46
|
+
# config.fixture_path = "#{ENGINE_RAILS_ROOT}/spec/fixtures"
|
|
47
|
+
|
|
48
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
49
|
+
# examples within a transaction, remove the following line or assign false
|
|
50
|
+
# instead of true.
|
|
51
|
+
config.use_transactional_fixtures = true
|
|
52
|
+
|
|
53
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
|
54
|
+
# based on their file location, for example enabling you to call `get` and
|
|
55
|
+
# `post` in specs under `spec/controllers`.
|
|
56
|
+
#
|
|
57
|
+
# You can disable this behaviour by removing the line below, and instead
|
|
58
|
+
# explicitly tag your specs with their type, e.g.:
|
|
59
|
+
#
|
|
60
|
+
# RSpec.describe UsersController, :type => :controller do
|
|
61
|
+
# # ...
|
|
62
|
+
# end
|
|
63
|
+
#
|
|
64
|
+
# The different available types are documented in the features, such as in
|
|
65
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
|
66
|
+
config.infer_spec_type_from_file_location!
|
|
67
|
+
|
|
68
|
+
# Include Factory Girl syntax to simplify calls to factories
|
|
69
|
+
config.include FactoryGirl::Syntax::Methods
|
|
70
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
|
5
|
+
#
|
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
|
9
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
|
10
|
+
# a separate helper file that requires the additional dependencies and performs
|
|
11
|
+
# the additional setup, and require it from the spec files that actually need it.
|
|
12
|
+
#
|
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
|
14
|
+
# users commonly want.
|
|
15
|
+
#
|
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
17
|
+
RSpec.configure do |config|
|
|
18
|
+
# rspec-expectations config goes here. You can use an alternate
|
|
19
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
20
|
+
# assertions if you prefer.
|
|
21
|
+
config.expect_with :rspec do |expectations|
|
|
22
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
|
23
|
+
# and `failure_message` of custom matchers include text for helper methods
|
|
24
|
+
# defined using `chain`, e.g.:
|
|
25
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
|
26
|
+
# # => "be bigger than 2 and smaller than 4"
|
|
27
|
+
# ...rather than:
|
|
28
|
+
# # => "be bigger than 2"
|
|
29
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
|
33
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
34
|
+
config.mock_with :rspec do |mocks|
|
|
35
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
|
36
|
+
# a real object. This is generally recommended, and will default to
|
|
37
|
+
# `true` in RSpec 4.
|
|
38
|
+
mocks.verify_partial_doubles = true
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# The settings below are suggested to provide a good initial experience
|
|
42
|
+
# with RSpec, but feel free to customize to your heart's content.
|
|
43
|
+
=begin
|
|
44
|
+
# These two settings work together to allow you to limit a spec run
|
|
45
|
+
# to individual examples or groups you care about by tagging them with
|
|
46
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
|
47
|
+
# get run.
|
|
48
|
+
config.filter_run :focus
|
|
49
|
+
config.run_all_when_everything_filtered = true
|
|
50
|
+
|
|
51
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
|
52
|
+
# For more details, see:
|
|
53
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
|
54
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
|
55
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
|
56
|
+
config.disable_monkey_patching!
|
|
57
|
+
|
|
58
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
|
59
|
+
# file, and it's useful to allow more verbose output when running an
|
|
60
|
+
# individual spec file.
|
|
61
|
+
if config.files_to_run.one?
|
|
62
|
+
# Use the documentation formatter for detailed output,
|
|
63
|
+
# unless a formatter has already been configured
|
|
64
|
+
# (e.g. via a command-line flag).
|
|
65
|
+
config.default_formatter = 'doc'
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Print the 10 slowest examples and example groups at the
|
|
69
|
+
# end of the spec run, to help surface which specs are running
|
|
70
|
+
# particularly slow.
|
|
71
|
+
config.profile_examples = 10
|
|
72
|
+
|
|
73
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
74
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
75
|
+
# the seed, which is printed after each run.
|
|
76
|
+
# --seed 1234
|
|
77
|
+
config.order = :random
|
|
78
|
+
|
|
79
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
|
80
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
81
|
+
# test failures related to randomization by passing the same `--seed` value
|
|
82
|
+
# as the one that triggered the failure.
|
|
83
|
+
Kernel.srand config.seed
|
|
84
|
+
=end
|
|
85
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module AccountMacros
|
|
2
|
+
|
|
3
|
+
# Setup the current account. Used for model specs. Need to use :each, otherwise
|
|
4
|
+
# the created Account does not get cleared between runs
|
|
5
|
+
#------------------------------------------------------------------------------
|
|
6
|
+
def setup_account
|
|
7
|
+
before :each do
|
|
8
|
+
Account.current = FactoryGirl.create(:account)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
#------------------------------------------------------------------------------
|
|
15
|
+
RSpec.configure do |config|
|
|
16
|
+
config.extend AccountMacros, type: :model
|
|
17
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require 'devise'
|
|
2
|
+
|
|
3
|
+
# from https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-3-and-4-(and-RSpec)
|
|
4
|
+
#------------------------------------------------------------------------------
|
|
5
|
+
module LoginMacros
|
|
6
|
+
|
|
7
|
+
#------------------------------------------------------------------------------
|
|
8
|
+
def login_admin
|
|
9
|
+
before :each do
|
|
10
|
+
@request.env["devise.mapping"] = Devise.mappings[:user]
|
|
11
|
+
@request.host = "test.example.com" # domain must match the account being used
|
|
12
|
+
Account.current = FactoryGirl.create(:account)
|
|
13
|
+
@current_user = FactoryGirl.create(:admin_user)
|
|
14
|
+
sign_in @current_user
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
#------------------------------------------------------------------------------
|
|
19
|
+
def login_user
|
|
20
|
+
before :each do
|
|
21
|
+
@request.env["devise.mapping"] = Devise.mappings[:user]
|
|
22
|
+
@request.host = "test.example.com" # domain must match the account being used
|
|
23
|
+
Account.current = FactoryGirl.create(:account)
|
|
24
|
+
@current_user = FactoryGirl.create(:user)
|
|
25
|
+
sign_in @current_user
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
#------------------------------------------------------------------------------
|
|
30
|
+
def sign_in(user)
|
|
31
|
+
visit main_app.new_user_session_path
|
|
32
|
+
# click_link 'Log In'
|
|
33
|
+
fill_in 'Email', with: user.email
|
|
34
|
+
fill_in 'Password', with: user.password
|
|
35
|
+
click_button 'Sign in'
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
#------------------------------------------------------------------------------
|
|
40
|
+
RSpec.configure do |config|
|
|
41
|
+
config.include Devise::TestHelpers, type: :controller
|
|
42
|
+
config.extend LoginMacros, type: :controller
|
|
43
|
+
config.include LoginMacros, type: :feature
|
|
44
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# In general, the default_url_options method of our controller never
|
|
2
|
+
# gets called, so the default locale parameter for our url's is never
|
|
3
|
+
# set.
|
|
4
|
+
#
|
|
5
|
+
# There are two issues with the locale value on urls:
|
|
6
|
+
# 1. for routes in the code (redirects, url_for, etc), we need the monkey
|
|
7
|
+
# patch for ActionView and ActionDispatch
|
|
8
|
+
# Ref: https://github.com/rspec/rspec-rails/issues/255#issuecomment-24796864
|
|
9
|
+
#
|
|
10
|
+
# 2. for the 'get', 'post', etc, methods in our specs, use the DefaultParams
|
|
11
|
+
# below, which will set the locale for the get/post automatically, so we don't
|
|
12
|
+
# have to specify it on each invocation
|
|
13
|
+
# Ref: https://gist.github.com/PikachuEXE/8110084
|
|
14
|
+
#
|
|
15
|
+
# Ref: https://github.com/rspec/rspec-rails/issues/255
|
|
16
|
+
#------------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
# 1. (no longer needed in Rails 4.2)
|
|
19
|
+
#------------------------------------------------------------------------------
|
|
20
|
+
# class ActionView::TestCase::TestController
|
|
21
|
+
# def default_url_options(options={})
|
|
22
|
+
# { locale: I18n.default_locale }
|
|
23
|
+
# end
|
|
24
|
+
# end
|
|
25
|
+
#
|
|
26
|
+
# class ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper
|
|
27
|
+
# def call(t, args)
|
|
28
|
+
# t.url_for(handle_positional_args(t, args, { locale: I18n.default_locale }.merge( @options ), @segment_keys))
|
|
29
|
+
# end
|
|
30
|
+
# end
|
|
31
|
+
|
|
32
|
+
# 2.
|
|
33
|
+
#------------------------------------------------------------------------------
|
|
34
|
+
require 'active_support/concern'
|
|
35
|
+
|
|
36
|
+
module DefaultParams
|
|
37
|
+
extend ActiveSupport::Concern
|
|
38
|
+
|
|
39
|
+
included do
|
|
40
|
+
let(:default_params) { {locale: I18n.locale} }
|
|
41
|
+
|
|
42
|
+
def process_with_default_params(action, http_method = 'GET', *args)
|
|
43
|
+
parameters = args.shift
|
|
44
|
+
|
|
45
|
+
parameters = default_params.merge(parameters || {})
|
|
46
|
+
args.unshift(parameters)
|
|
47
|
+
|
|
48
|
+
process_without_default_params(action, http_method, *args)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
alias_method_chain :process, :default_params
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
RSpec.configure do |config|
|
|
56
|
+
config.include(DefaultParams, :type => :controller)
|
|
57
|
+
end
|