cucumber-rails 1.6.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Appraisals +18 -88
- data/CHANGELOG.md +208 -14
- data/CONTRIBUTING.md +27 -24
- data/Gemfile +2 -4
- data/LICENSE +1 -1
- data/README.md +45 -31
- data/Rakefile +17 -13
- data/bin/install_geckodriver.sh +19 -0
- data/bin/install_webpacker.sh +9 -0
- data/config/cucumber.yml +0 -3
- data/cucumber-rails.gemspec +40 -33
- data/dev_tasks/cucumber.rake +2 -0
- data/dev_tasks/rspec.rake +2 -0
- data/dev_tasks/yard.rake +7 -14
- data/dev_tasks/yard/default/layout/html/setup.rb +6 -1
- data/features/allow_rescue.feature +16 -11
- data/features/annotations.feature +8 -11
- data/features/capybara_javascript_drivers.feature +90 -31
- data/features/choose_javascript_database_strategy.feature +36 -56
- data/features/configuration.feature +48 -0
- data/features/database_cleaner.feature +103 -16
- data/features/disable_automatic_database_cleaning.feature +10 -16
- data/features/emulate_javascript.feature +59 -44
- data/features/install_cucumber_rails.feature +4 -4
- data/features/no_database.feature +6 -6
- data/features/raising_errors.feature +9 -3
- data/features/rerun_profile.feature +5 -4
- data/features/rest_api.feature +11 -11
- data/features/step_definitions/cucumber_rails_steps.rb +43 -100
- data/features/support/aruba.rb +3 -1
- data/features/support/cucumber_rails_helper.rb +86 -0
- data/features/support/env.rb +4 -38
- data/features/support/hooks.rb +8 -0
- data/gemfiles/rails_5_0.gemfile +4 -12
- data/gemfiles/rails_5_1.gemfile +3 -10
- data/gemfiles/rails_5_2.gemfile +2 -10
- data/gemfiles/rails_6_0.gemfile +8 -0
- data/lib/cucumber/rails.rb +23 -17
- data/lib/cucumber/rails/action_dispatch.rb +21 -0
- data/lib/cucumber/rails/application.rb +16 -7
- data/lib/cucumber/rails/capybara.rb +2 -0
- data/lib/cucumber/rails/capybara/javascript_emulation.rb +43 -35
- data/lib/cucumber/rails/capybara/select_dates_and_times.rb +3 -1
- data/lib/cucumber/rails/database.rb +24 -56
- data/lib/cucumber/rails/database/deletion_strategy.rb +11 -0
- data/lib/cucumber/rails/database/shared_connection_strategy.rb +25 -0
- data/lib/cucumber/rails/database/strategy.rb +31 -0
- data/lib/cucumber/rails/database/truncation_strategy.rb +11 -0
- data/lib/cucumber/rails/hooks.rb +2 -0
- data/lib/cucumber/rails/hooks/active_record.rb +8 -4
- data/lib/cucumber/rails/hooks/allow_rescue.rb +2 -0
- data/lib/cucumber/rails/hooks/database_cleaner.rb +11 -3
- data/lib/cucumber/rails/hooks/mail.rb +3 -1
- data/lib/cucumber/rails/rspec.rb +3 -1
- data/lib/cucumber/rails/world.rb +24 -7
- data/lib/generators/cucumber/{install/USAGE → USAGE} +0 -0
- data/lib/generators/cucumber/{install/install_generator.rb → install_generator.rb} +23 -10
- data/lib/generators/cucumber/{install/templates → templates}/config/cucumber.yml.erb +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/script/cucumber +1 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/_rails_each_run.rb.erb +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/_rails_prefork.rb.erb +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/capybara.rb +2 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/edit_warning.txt +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/rails.rb.erb +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/rails_spork.rb.erb +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/tasks/cucumber.rake.erb +0 -0
- data/spec/cucumber/rails/database_spec.rb +50 -33
- data/spec/examples.txt +19 -0
- data/spec/generators/cucumber/{install/install_generator_spec.rb → install_generator_spec.rb} +16 -8
- data/spec/spec_helper.rb +4 -2
- data/tmp/aruba/test_app/Gemfile +62 -0
- data/tmp/aruba/test_app/Gemfile.lock +249 -0
- data/tmp/aruba/test_app/README.md +24 -0
- data/tmp/aruba/test_app/Rakefile +6 -0
- data/tmp/aruba/test_app/app/assets/config/manifest.js +3 -0
- data/tmp/aruba/test_app/app/assets/javascripts/application.js +16 -0
- data/tmp/aruba/test_app/app/assets/javascripts/appointments.coffee +3 -0
- data/tmp/aruba/test_app/app/assets/javascripts/cable.js +13 -0
- data/tmp/aruba/test_app/app/assets/stylesheets/application.css +15 -0
- data/tmp/aruba/test_app/app/assets/stylesheets/appointments.scss +3 -0
- data/tmp/aruba/test_app/app/assets/stylesheets/scaffolds.scss +84 -0
- data/tmp/aruba/test_app/app/channels/application_cable/channel.rb +4 -0
- data/tmp/aruba/test_app/app/channels/application_cable/connection.rb +4 -0
- data/tmp/aruba/test_app/app/controllers/application_controller.rb +2 -0
- data/tmp/aruba/test_app/app/controllers/appointments_controller.rb +74 -0
- data/tmp/aruba/test_app/app/helpers/application_helper.rb +2 -0
- data/tmp/aruba/test_app/app/helpers/appointments_helper.rb +2 -0
- data/tmp/aruba/test_app/app/jobs/application_job.rb +2 -0
- data/tmp/aruba/test_app/app/mailers/application_mailer.rb +4 -0
- data/tmp/aruba/test_app/app/models/application_record.rb +3 -0
- data/tmp/aruba/test_app/app/models/appointment.rb +2 -0
- data/tmp/aruba/test_app/app/views/appointments/_appointment.json.jbuilder +2 -0
- data/tmp/aruba/test_app/app/views/appointments/_form.html.erb +27 -0
- data/tmp/aruba/test_app/app/views/appointments/edit.html.erb +6 -0
- data/tmp/aruba/test_app/app/views/appointments/index.html.erb +29 -0
- data/tmp/aruba/test_app/app/views/appointments/index.json.jbuilder +1 -0
- data/tmp/aruba/test_app/app/views/appointments/new.html.erb +5 -0
- data/tmp/aruba/test_app/app/views/appointments/show.html.erb +14 -0
- data/tmp/aruba/test_app/app/views/appointments/show.json.jbuilder +1 -0
- data/tmp/aruba/test_app/app/views/layouts/application.html.erb +15 -0
- data/tmp/aruba/test_app/app/views/layouts/mailer.html.erb +13 -0
- data/tmp/aruba/test_app/app/views/layouts/mailer.text.erb +1 -0
- data/tmp/aruba/test_app/bin/bundle +3 -0
- data/tmp/aruba/test_app/bin/rails +4 -0
- data/tmp/aruba/test_app/bin/rake +4 -0
- data/tmp/aruba/test_app/bin/setup +36 -0
- data/tmp/aruba/test_app/bin/update +31 -0
- data/tmp/aruba/test_app/bin/yarn +11 -0
- data/tmp/aruba/test_app/config.ru +5 -0
- data/tmp/aruba/test_app/config/application.rb +19 -0
- data/tmp/aruba/test_app/config/boot.rb +3 -0
- data/tmp/aruba/test_app/config/cable.yml +10 -0
- data/tmp/aruba/test_app/config/credentials.yml.enc +1 -0
- data/tmp/aruba/test_app/config/cucumber.yml +9 -0
- data/tmp/aruba/test_app/config/database.yml +25 -0
- data/tmp/aruba/test_app/config/environment.rb +5 -0
- data/tmp/aruba/test_app/config/environments/development.rb +61 -0
- data/tmp/aruba/test_app/config/environments/production.rb +94 -0
- data/tmp/aruba/test_app/config/environments/test.rb +46 -0
- data/tmp/aruba/test_app/config/initializers/application_controller_renderer.rb +8 -0
- data/tmp/aruba/test_app/config/initializers/assets.rb +14 -0
- data/tmp/aruba/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/tmp/aruba/test_app/config/initializers/content_security_policy.rb +25 -0
- data/tmp/aruba/test_app/config/initializers/cookies_serializer.rb +5 -0
- data/tmp/aruba/test_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/tmp/aruba/test_app/config/initializers/inflections.rb +16 -0
- data/tmp/aruba/test_app/config/initializers/mime_types.rb +4 -0
- data/tmp/aruba/test_app/config/initializers/wrap_parameters.rb +14 -0
- data/tmp/aruba/test_app/config/locales/en.yml +33 -0
- data/tmp/aruba/test_app/config/master.key +1 -0
- data/tmp/aruba/test_app/config/puma.rb +37 -0
- data/tmp/aruba/test_app/config/routes.rb +4 -0
- data/tmp/aruba/test_app/config/storage.yml +34 -0
- data/tmp/aruba/test_app/db/development.sqlite3 +0 -0
- data/tmp/aruba/test_app/db/migrate/20200821080656_create_appointments.rb +10 -0
- data/tmp/aruba/test_app/db/schema.rb +22 -0
- data/tmp/aruba/test_app/db/seeds.rb +7 -0
- data/tmp/aruba/test_app/db/test.sqlite3 +0 -0
- data/tmp/aruba/test_app/features/create_appointment.feature +9 -0
- data/tmp/aruba/test_app/features/create_appointment_steps.rb +19 -0
- data/tmp/aruba/test_app/features/support/env.rb +18 -0
- data/tmp/aruba/test_app/lib/tasks/cucumber.rake +76 -0
- data/tmp/aruba/test_app/log/development.log +27 -0
- data/tmp/aruba/test_app/log/test.log +38 -0
- data/tmp/aruba/test_app/package.json +5 -0
- data/tmp/aruba/test_app/public/404.html +67 -0
- data/tmp/aruba/test_app/public/422.html +67 -0
- data/tmp/aruba/test_app/public/500.html +66 -0
- data/tmp/aruba/test_app/public/apple-touch-icon-precomposed.png +0 -0
- data/tmp/aruba/test_app/public/apple-touch-icon.png +0 -0
- data/tmp/aruba/test_app/public/favicon.ico +0 -0
- data/tmp/aruba/test_app/public/robots.txt +1 -0
- data/tmp/aruba/test_app/script/cucumber +11 -0
- data/tmp/aruba/test_app/test/application_system_test_case.rb +5 -0
- data/tmp/aruba/test_app/test/controllers/appointments_controller_test.rb +48 -0
- data/tmp/aruba/test_app/test/fixtures/appointments.yml +9 -0
- data/tmp/aruba/test_app/test/models/appointment_test.rb +7 -0
- data/tmp/aruba/test_app/test/system/appointments_test.rb +45 -0
- data/tmp/aruba/test_app/test/test_helper.rb +10 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/0I/0I0oT83oN3NKiEi9XIhexiT3XgkA8mKyCbs25v3l20g.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/0W/0WnFNEwHN4bhDiFTvyMWURx02L4yP3gkP7vtjzKQFVo.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/2B/2Bg65dpvTdePrXa_wG6RsHpQzbqVSiHK0FVa0WdOJ4k.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/2r/2r_85kVmIcWzvJH72GapWtLDhaMP2HEziNxykyYpAUg.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/72/72jdZDzrM3-D_zYkIiPdAWQNeaFsqah154_QvcqWqTQ.cache +3 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/99/99m8UCKl4j8IpsVOK8ltLHyNh8Ae0nHw3GBkC34V_co.cache +2 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/9O/9OOXnKHBQnaCeE5HDe5csQsItouzWM6rTl8sESvkGTE.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/AF/AFloQwm_M7GZudPY87xx4TA0xEeuX9Psl0SJ94i5EyU.cache +3 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/AP/APDAc8aUg_16wNWrVhCJcKeqbxyOScYGVhiDVgbrV7U.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/B4/B43LeT9Wba4fLvXw-C_kKq-x9HwYZxnBBiltbIufzzQ.cache +2 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/EO/EOut5kyDPr7aKrHdvDsNJuYarA8XGnpAlDvBimlaC08.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/GJ/GJzxuc2i_d4Uhxs4IMnbQXhxBc9CTLrnQyzxwTqKOBw.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/Ge/Ge2oyaUStbQszLfXjgTi6LkncyS5SKfV8RJwbRA3HbI.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/HC/HCDOUd7-S45aJ_PjVAC_Vmjyud3i1aQv4cE3t9_Z3Dw.cache +2 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/Hv/HvPd_vK17QbhWq8QnCuyhqm0cPaGnHyO9lSzN-icQdg.cache +2 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/II/IIhUO-5-DcfCyD_rVJeHjRMNVJxLmAmXP8i2XEjFpns.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/Ka/KaLHRsUYc4EUxUr4q_UhArFJUTF_EaBklpeU4TsE9SY.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/MZ/MZcwDENEs93Wd9q7A_7UWdfJrWsBXa0pGp03P9mqG2I.cache +3 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/Nw/NwHea3ImBECnlmojPb9X9ZDfvRRuX_dX9sxISdtp9-A.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/PP/PPKuKT7m2PMDHVzBcYjePvXU6CbCW63Iqe3Q2a-Jdh8.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/RE/REtgGrS74n4Y7OKRcGvZsA2EUClg_RM66mVgGpySI20.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/Rk/RkQLRXSz5LhJQnH7BT-ZDkVK0Rx8N9KhcVwR2A1HY4M.cache +2 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/Sx/SxtNEQ-KKVBCTtsDD-xf4oJEIdBPIHkGktnLXvG-GRk.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/TL/TLxLzqEAxKzTHH9EwSg5Lvcp3zgGuhjTjed121DSu9U.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/U1/U1D7nCXYBD3VlPnXGs_6mRtlhs-Gvv_vvCUYlTf4Grw.cache +3 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/U6/U6pXyI-5haNcHRdsB-SoztzlXb98-256hFReXsL31J4.cache +2 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/UE/UEKUaC9O_XBO5acP8HnxcJ1dtNM_1C7MTofkTQvPgRA.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/UV/UVcnI5bo-eQvULfmzeQUFVTDYEMF2cbAXpsOsh01XNY.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/WK/WK8RpMP5qb9GRQTsTHAzlfo8t2nsTLU6B8CQAc4UfOU.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/Xk/Xk8p9O39-syzKbpnoMRChld0TpoZFWlNIzeT5XKw2fQ.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/Zv/ZvCEW2ZyS-k4cHH7Gd8P2nKFE9Uh1VOrfR-1PYY2yz8.cache +5 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/ac/acWu1-1ZAW1jRVKlHYlzlEg28lk-SdHfTq-P-viJMS0.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/b3/b3NiYrQOlN2zxiJYqbl4gmvK6it3Md9gSzAYgsIMhnY.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/c1/c1Pm-rFPEB3LXIjOtswD6x8SEAgI9y2BR16jc8ifcsc.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/em/emTQG2a9zF8NuvElLOnEpNJp0wq3_gVSDAM60vyXAzE.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/fX/fXH3Db_88TmJFhRydoFTx8tZbHAkLzK2ZZ0lsBEg8xA.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/gI/gIHntmCf7DbObPL_KZJYSgduAmqX18ZZPOtq85pn8vo.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/kP/kPwbLAUCLjv0x6fe5lvZpmUkgmvQSDHSdEOSdbMyDgY.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/kT/kT98Z_slHI6SgdEmoAtKAHyJQjTHdbe6GAbB27RP2uI.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/mt/mtT4Rwi7H_vHQXdxxPvvzhL4ziA7X9WK-JXzacxWlEA.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/mz/mzgD6X_N-fO95dP8Q1Q1sApCrbSmgPgsuEKv65KYcdo.cache +3 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/oi/oiPhXw8pYdWv5T4qRFzePHaXZLI50xMvvTyfry-ILSo.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/r-/r--YB1ugrZ4F-ogbLLYNwIH3j9pQ2u_ZBjTJxoS7TrM.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/s6/s68UIyg0lNko7IA42JXv_wwy9Ea3WH-zc9h0GYPg88Y.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/si/siT97rfEKbIWcCj6KUBChX7kpRBKI2fAeGGwpsz0tTU.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/st/stqDgDfAemfEq7ZxlEj6YThpn8_1Nfw2bRVA0N03YTw.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/t9/t93lpjyly3MvgKs51_OlLXneJXGyYFGmshXsk4Wr69M.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/tE/tEy2QePsDnmFyyAQEric23sSBnfHBst3SEM7p-J7el8.cache +2 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/tR/tRV7SyAY9c71G0o-8bElvNI76KcWhc5NVm48xflMPpM.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/tg/tggwa2O6A41xeZTK4SR0qcX0X55aOGg6q8ZWfqma1vM.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/uB/uBKOYcdzL_6Amevsu-uKAMTg7QGW5kgC0t5sAZINrcI.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/uE/uEyPXY2m04nerJV0pn3p-B-BlkJ08oufpQH1G2QXPw4.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/up/upyndqsU9bU6WV8qyMy7MLpcQoybRqgj-qA3C3pjzXY.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/ux/uxx-W2TOCdnAEGX0ZLThb_QIEbLYutX8qCwD0glYCKE.cache +3 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/vC/vCsc-q2WmT8vWM2d2pb6_5hFav8mGlylwEKVWQvsumo.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/vc/vcgiILg1wO98x-a4kX678ASAFWA1cL0iVx07VkHLPqA.cache +0 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/vu/vu6xNIGT6zorPmcKfd7edgxBltTmIRXU281uyK51kkU.cache +1 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/w4/w4y_Lms54hD2Nivh5PHeccAmh2DX53sc_HDTQYNyNXw.cache +3 -0
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/yZ/yZpoD5Zf4RAQoOwi5kMVksuta_0KhYSK_Yy_6Ykyt7E.cache +1 -0
- data/tmp/aruba/test_app/tmp/development_secret.txt +1 -0
- metadata +262 -158
- data/.github/ISSUE_TEMPLATE.md +0 -52
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -42
- data/.gitignore +0 -12
- data/.rspec +0 -1
- data/.travis.yml +0 -43
- data/Gemfile.appraisal +0 -3
- data/config/.gitignore +0 -1
- data/features/support/bundler_pre_support.rb +0 -28
- data/features/support/fixtures/bundler-1.0.21.gem +0 -0
- data/features/support/fixtures/bundler-1.1.rc.gem +0 -0
- data/features/support/legacy_web_steps_support.rb +0 -289
- data/gemfiles/rails_4_0.gemfile +0 -22
- data/gemfiles/rails_4_1.gemfile +0 -20
- data/gemfiles/rails_4_2.gemfile +0 -19
- data/lib/cucumber/rails/action_controller.rb +0 -12
data/lib/cucumber/rails.rb
CHANGED
@@ -1,31 +1,37 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
called_from_env_rb = caller.detect { |f| f.include? '/env.rb:' }
|
4
|
+
|
5
|
+
if called_from_env_rb
|
6
|
+
env_caller = File.dirname(called_from_env_rb)
|
7
|
+
|
3
8
|
require 'rails'
|
4
9
|
require 'cucumber/rails/application'
|
5
10
|
ENV['RAILS_ENV'] ||= 'test'
|
6
|
-
ENV['RAILS_ROOT'] ||= File.expand_path(env_caller
|
7
|
-
require File.expand_path(ENV['RAILS_ROOT']
|
8
|
-
require 'cucumber/rails/
|
9
|
-
|
10
|
-
if defined?(ActiveRecord::Base)
|
11
|
-
require 'rails/test_help'
|
12
|
-
else
|
13
|
-
require 'action_dispatch/testing/test_process'
|
14
|
-
require 'action_dispatch/testing/integration'
|
15
|
-
end
|
11
|
+
ENV['RAILS_ROOT'] ||= File.expand_path("#{env_caller}/../..")
|
12
|
+
require File.expand_path("#{ENV['RAILS_ROOT']}/config/environment")
|
13
|
+
require 'cucumber/rails/action_dispatch'
|
14
|
+
require 'rails/test_help'
|
16
15
|
|
17
|
-
unless Rails.application.config.cache_classes
|
18
|
-
warn "WARNING: You have set Rails' config.cache_classes to false
|
16
|
+
unless Rails.application.config.cache_classes || defined?(Spring)
|
17
|
+
warn "WARNING: You have set Rails' config.cache_classes to false
|
18
|
+
(Spring needs cache_classes set to false). This is known to cause problems
|
19
|
+
with database transactions. Set config.cache_classes to true if you want to use transactions."
|
19
20
|
end
|
20
21
|
|
21
22
|
require 'cucumber/rails/world'
|
22
23
|
require 'cucumber/rails/hooks'
|
23
24
|
require 'cucumber/rails/capybara'
|
25
|
+
require 'cucumber/rails/database/strategy'
|
26
|
+
require 'cucumber/rails/database/deletion_strategy'
|
27
|
+
require 'cucumber/rails/database/shared_connection_strategy'
|
28
|
+
require 'cucumber/rails/database/truncation_strategy'
|
24
29
|
require 'cucumber/rails/database'
|
25
30
|
|
26
31
|
MultiTest.disable_autorun
|
27
32
|
else
|
28
|
-
warn "WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being deferred
|
29
|
-
To avoid this warning, move 'gem \'cucumber-rails\', require: false'
|
30
|
-
If already in the :test group, be sure you are
|
33
|
+
warn "WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being deferred
|
34
|
+
until env.rb is called. To avoid this warning, move 'gem \'cucumber-rails\', require: false'
|
35
|
+
under only group :test in your Gemfile. If already in the :test group, be sure you are
|
36
|
+
specifying 'require: false'."
|
31
37
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
ActionController::Base.class_eval do
|
4
|
+
cattr_accessor :allow_rescue
|
5
|
+
end
|
6
|
+
|
7
|
+
module Cucumber
|
8
|
+
module Rails
|
9
|
+
module ActionDispatch
|
10
|
+
module ShowExceptions
|
11
|
+
def call(env)
|
12
|
+
env['action_dispatch.show_detailed_exceptions'] = !ActionController::Base.allow_rescue
|
13
|
+
env['action_dispatch.show_exceptions'] = !env['action_dispatch.show_detailed_exceptions']
|
14
|
+
super(env)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
ActionDispatch::ShowExceptions.prepend(Cucumber::Rails::ActionDispatch::ShowExceptions)
|
@@ -1,17 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rails/application'
|
2
4
|
|
3
5
|
# Make sure the ActionDispatch::ShowExceptions middleware is always enabled,
|
4
6
|
# regardless of what is in config/environments/test.rb
|
5
7
|
# Instead we are overriding ActionDispatch::ShowExceptions to be able to
|
6
8
|
# toggle whether or not exceptions are raised.
|
7
|
-
class Rails::Application
|
8
|
-
alias __cucumber_orig_initialize__ initialize!
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
module Cucumber
|
11
|
+
module Rails
|
12
|
+
module Application
|
13
|
+
def initialize!
|
14
|
+
ad = config.action_dispatch
|
15
|
+
|
16
|
+
def ad.show_exceptions
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
super
|
21
|
+
end
|
14
22
|
end
|
15
|
-
__cucumber_orig_initialize__
|
16
23
|
end
|
17
24
|
end
|
25
|
+
|
26
|
+
Rails::Application.prepend(Cucumber::Rails::Application)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module Rails
|
3
5
|
module Capybara
|
@@ -11,7 +13,9 @@ module Cucumber
|
|
11
13
|
|
12
14
|
def click_with_javascript_emulation(*)
|
13
15
|
if link_with_non_get_http_method?
|
14
|
-
::Capybara::RackTest::Form.new(
|
16
|
+
::Capybara::RackTest::Form.new(
|
17
|
+
driver, js_form(element_node.document, self[:href], emulated_method)
|
18
|
+
).submit(self)
|
15
19
|
else
|
16
20
|
click_without_javascript_emulation
|
17
21
|
end
|
@@ -44,58 +48,62 @@ module Cucumber
|
|
44
48
|
js_form['action'] = action
|
45
49
|
js_form['method'] = method
|
46
50
|
|
47
|
-
|
48
|
-
input = document.create_element('input')
|
49
|
-
input['type'] = 'hidden'
|
50
|
-
input['name'] = '_method'
|
51
|
-
input['value'] = emulated_method
|
52
|
-
js_form.add_child(input)
|
53
|
-
end
|
51
|
+
add_hidden_method_input(document, js_form) unless same?(emulated_method, method)
|
54
52
|
|
55
|
-
# rails will wipe the session if the CSRF token is not sent
|
56
|
-
|
57
|
-
if csrf? && emulated_method.downcase != 'get'
|
58
|
-
input = document.create_element('input')
|
59
|
-
input['type'] = 'hidden'
|
60
|
-
input['name'] = csrf_param
|
61
|
-
input['value'] = csrf_token
|
62
|
-
js_form.add_child(input)
|
63
|
-
end
|
53
|
+
# rails will wipe the session if the CSRF token is not sent with non-GET requests
|
54
|
+
add_hidden_csrf_input(document, js_form) if csrf? && !get?(emulated_method)
|
64
55
|
|
65
56
|
js_form
|
66
57
|
end
|
67
58
|
|
59
|
+
def same?(emulated_method, method)
|
60
|
+
emulated_method.casecmp(method).zero?
|
61
|
+
end
|
62
|
+
|
63
|
+
def add_hidden_method_input(document, js_form)
|
64
|
+
input = document.create_element('input')
|
65
|
+
input['type'] = 'hidden'
|
66
|
+
input['name'] = '_method'
|
67
|
+
input['value'] = emulated_method
|
68
|
+
js_form.add_child(input)
|
69
|
+
end
|
70
|
+
|
71
|
+
def get?(emulated_method)
|
72
|
+
same?(emulated_method, 'get')
|
73
|
+
end
|
74
|
+
|
75
|
+
def add_hidden_csrf_input(document, js_form)
|
76
|
+
input = document.create_element('input')
|
77
|
+
input['type'] = 'hidden'
|
78
|
+
input['name'] = csrf_param
|
79
|
+
input['value'] = csrf_token
|
80
|
+
js_form.add_child(input)
|
81
|
+
end
|
82
|
+
|
68
83
|
def link_with_non_get_http_method?
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
tag_name == 'a' && element_node['onclick'] && element_node['onclick'] =~ /var f = document\.createElement\('form'\); f\.style\.display = 'none';/
|
73
|
-
end
|
84
|
+
tag_name == 'a' &&
|
85
|
+
element_node['data-method'] &&
|
86
|
+
element_node['data-method'] =~ /(?:delete|put|post)/
|
74
87
|
end
|
75
88
|
|
76
89
|
def emulated_method
|
77
|
-
|
78
|
-
element_node['data-method']
|
79
|
-
else
|
80
|
-
element_node['onclick'][/m\.setAttribute\('value', '([^']*)'\)/, 1]
|
81
|
-
end
|
90
|
+
element_node['data-method']
|
82
91
|
end
|
83
92
|
|
84
93
|
def element_node
|
85
|
-
|
86
|
-
self.native
|
87
|
-
else
|
88
|
-
warn 'DEPRECATED: cucumber-rails loves you, just not your version of Capybara. Please update Capybara to >= 0.4.0'
|
89
|
-
self.node
|
90
|
-
end
|
94
|
+
native
|
91
95
|
end
|
92
96
|
end
|
93
97
|
end
|
94
98
|
end
|
95
99
|
end
|
96
100
|
|
97
|
-
|
98
|
-
|
101
|
+
module Capybara
|
102
|
+
module RackTest
|
103
|
+
class Node
|
104
|
+
include ::Cucumber::Rails::Capybara::JavascriptEmulation
|
105
|
+
end
|
106
|
+
end
|
99
107
|
end
|
100
108
|
|
101
109
|
Before('not @no-js-emulation') do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module Rails
|
3
5
|
module Capybara
|
@@ -9,7 +11,7 @@ module Cucumber
|
|
9
11
|
base_dom_id = get_base_dom_id_from_label_tag(options[:from])
|
10
12
|
|
11
13
|
find(:xpath, ".//select[@id='#{base_dom_id}_1i']").select(date.year.to_s)
|
12
|
-
find(:xpath, ".//select[@id='#{base_dom_id}_2i']").select(I18n.l
|
14
|
+
find(:xpath, ".//select[@id='#{base_dom_id}_2i']").select(I18n.l(date, format: '%B'))
|
13
15
|
find(:xpath, ".//select[@id='#{base_dom_id}_3i']").select(date.day.to_s)
|
14
16
|
end
|
15
17
|
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module Rails
|
3
5
|
module Database
|
4
|
-
CUSTOM_STRATEGY_INTERFACE = %w
|
6
|
+
CUSTOM_STRATEGY_INTERFACE = %w[before_js before_non_js].freeze
|
5
7
|
|
6
8
|
class InvalidStrategy < ArgumentError; end
|
7
9
|
|
@@ -13,16 +15,21 @@ module Cucumber
|
|
13
15
|
strategy_type =
|
14
16
|
case strategy
|
15
17
|
when Symbol
|
16
|
-
map[strategy] ||
|
18
|
+
map[strategy] || throw_invalid_strategy_error(strategy)
|
17
19
|
when Class
|
18
20
|
strategy
|
19
21
|
end
|
20
22
|
|
21
|
-
@strategy =
|
23
|
+
@strategy = strategy_type.new(*strategy_opts)
|
22
24
|
|
23
25
|
validate_interface!
|
24
26
|
end
|
25
27
|
|
28
|
+
def default_strategy!
|
29
|
+
self.javascript_strategy = :truncation
|
30
|
+
self.autorun_database_cleaner = true
|
31
|
+
end
|
32
|
+
|
26
33
|
def before_js
|
27
34
|
@strategy.before_js
|
28
35
|
end
|
@@ -35,7 +42,7 @@ module Cucumber
|
|
35
42
|
@strategy.after
|
36
43
|
end
|
37
44
|
|
38
|
-
|
45
|
+
private
|
39
46
|
|
40
47
|
def map
|
41
48
|
{
|
@@ -46,68 +53,29 @@ module Cucumber
|
|
46
53
|
}
|
47
54
|
end
|
48
55
|
|
49
|
-
def
|
50
|
-
|
51
|
-
raise(ArgumentError, "Strategy must respond to all of: #{CUSTOM_STRATEGY_INTERFACE.map{ |method| "##{method}" } * ' ' } !")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
class Strategy
|
57
|
-
def initialize(options = {})
|
58
|
-
@options = options
|
59
|
-
end
|
60
|
-
|
61
|
-
def before_js(strategy)
|
62
|
-
@original_strategy = DatabaseCleaner.connections.first.strategy # that feels like a nasty hack
|
63
|
-
DatabaseCleaner.strategy = strategy, @options
|
64
|
-
end
|
65
|
-
|
66
|
-
def before_non_js
|
67
|
-
# no-op
|
68
|
-
end
|
69
|
-
|
70
|
-
def after
|
71
|
-
return unless @original_strategy
|
72
|
-
DatabaseCleaner.strategy = @original_strategy
|
73
|
-
@original_strategy = nil
|
56
|
+
def throw_invalid_strategy_error(strategy)
|
57
|
+
raise(InvalidStrategy, "The strategy '#{strategy}' is not understood. Please use one of #{mapped_keys}")
|
74
58
|
end
|
75
|
-
end
|
76
59
|
|
77
|
-
|
78
|
-
|
79
|
-
super :truncation
|
60
|
+
def mapped_keys
|
61
|
+
map.keys.join(', ')
|
80
62
|
end
|
81
|
-
end
|
82
63
|
|
83
|
-
|
84
|
-
|
85
|
-
super :deletion
|
86
|
-
end
|
87
|
-
end
|
64
|
+
def validate_interface!
|
65
|
+
return if CUSTOM_STRATEGY_INTERFACE.all? { |m| @strategy.respond_to?(m) }
|
88
66
|
|
89
|
-
|
90
|
-
def before_js
|
91
|
-
# Forces all threads to share a connection on a per-model basis,
|
92
|
-
# as connections may vary per model as per establish_connection. This works
|
93
|
-
# on Capybara because it starts the web server in a thread.
|
94
|
-
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
|
95
|
-
ActiveRecord::Base.descendants.each do |model|
|
96
|
-
model.shared_connection = model.connection
|
97
|
-
end
|
67
|
+
throw_invalid_strategy_interface_error
|
98
68
|
end
|
99
69
|
|
100
|
-
def
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
end
|
70
|
+
def throw_invalid_strategy_interface_error
|
71
|
+
raise(
|
72
|
+
ArgumentError,
|
73
|
+
"Strategy must respond to all of: #{CUSTOM_STRATEGY_INTERFACE.map { |method| "##{method}" } * ' '} !"
|
74
|
+
)
|
106
75
|
end
|
107
76
|
end
|
108
77
|
|
109
|
-
|
110
|
-
Database.autorun_database_cleaner = true
|
78
|
+
default_strategy!
|
111
79
|
end
|
112
80
|
end
|
113
81
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Rails
|
3
|
+
module Database
|
4
|
+
class SharedConnectionStrategy < Strategy
|
5
|
+
def before_js
|
6
|
+
# Forces all threads to share a connection on a per-model basis,
|
7
|
+
# as connections may vary per model as per establish_connection. This works
|
8
|
+
# on Capybara because it starts the web server in a thread.
|
9
|
+
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
|
10
|
+
ActiveRecord::Base.descendants.each do |model|
|
11
|
+
model.shared_connection = model.connection
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def before_non_js
|
16
|
+
# Do not use a shared connection unless we're in a @javascript scenario
|
17
|
+
ActiveRecord::Base.shared_connection = nil
|
18
|
+
ActiveRecord::Base.descendants.each do |model|
|
19
|
+
model.shared_connection = nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Rails
|
3
|
+
module Database
|
4
|
+
class Strategy
|
5
|
+
def initialize(options = {})
|
6
|
+
@options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def before_js(strategy)
|
10
|
+
@original_strategy = if defined?(DatabaseCleaner::VERSION) && Gem::Version.new(DatabaseCleaner::VERSION) >= Gem::Version.new('1.8.0.beta')
|
11
|
+
DatabaseCleaner.cleaners.values.first.strategy # that feels like a nasty hack
|
12
|
+
else
|
13
|
+
DatabaseCleaner.connections.first.strategy # that feels like a nasty hack
|
14
|
+
end
|
15
|
+
DatabaseCleaner.strategy = strategy, @options
|
16
|
+
end
|
17
|
+
|
18
|
+
def before_non_js
|
19
|
+
# no-op
|
20
|
+
end
|
21
|
+
|
22
|
+
def after
|
23
|
+
return unless @original_strategy
|
24
|
+
|
25
|
+
DatabaseCleaner.strategy = @original_strategy
|
26
|
+
@original_strategy = nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|