cucumber-rails 2.1.0 → 2.2.0
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 +4 -4
- data/Appraisals +9 -18
- data/CHANGELOG.md +14 -4
- data/CONTRIBUTING.md +14 -2
- data/LICENSE +1 -1
- data/README.md +2 -12
- data/Rakefile +4 -4
- data/bin/install_geckodriver.sh +1 -1
- data/cucumber-rails.gemspec +13 -11
- data/dev_tasks/yard.rake +1 -1
- data/dev_tasks/yard/default/layout/html/setup.rb +1 -1
- data/features/capybara_javascript_drivers.feature +56 -6
- data/features/database_cleaner.feature +88 -1
- data/features/step_definitions/cucumber_rails_steps.rb +11 -0
- data/features/support/cucumber_rails_helper.rb +1 -0
- data/features/support/env.rb +1 -1
- data/gemfiles/rails_5_0.gemfile +3 -3
- data/gemfiles/rails_5_1.gemfile +3 -3
- data/gemfiles/rails_5_2.gemfile +2 -3
- data/gemfiles/rails_6_0.gemfile +1 -2
- data/lib/cucumber/rails.rb +7 -3
- data/lib/cucumber/rails/database.rb +6 -60
- 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/active_record.rb +16 -14
- data/lib/cucumber/rails/hooks/database_cleaner.rb +9 -3
- data/lib/cucumber/rails/hooks/mail.rb +4 -2
- data/spec/cucumber/rails/database_spec.rb +4 -0
- data/spec/examples.txt +19 -0
- 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 +212 -36
- data/.github/ISSUE_TEMPLATE.md +0 -52
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -42
- data/.gitignore +0 -14
- data/.rspec +0 -4
- data/.rubocop.yml +0 -68
- data/.travis.yml +0 -62
- data/config/.gitignore +0 -1
- data/gemfiles/rails_4_2.gemfile +0 -10
@@ -10,6 +10,17 @@ Given('I have created a new Rails app and installed cucumber-rails') do
|
|
10
10
|
install_cucumber_rails
|
11
11
|
end
|
12
12
|
|
13
|
+
Given('I have created a new Rails app and installed cucumber-rails with database_cleaner-active_record') do
|
14
|
+
rails_new
|
15
|
+
install_cucumber_rails :no_database_cleaner, :database_cleaner_active_record
|
16
|
+
end
|
17
|
+
|
18
|
+
Given('I have created a new Rails app and installed cucumber-rails without database_cleaner') do
|
19
|
+
rails_new
|
20
|
+
install_cucumber_rails :no_database_cleaner
|
21
|
+
overwrite_file('features/support/env.rb', "require 'cucumber/rails'\n")
|
22
|
+
end
|
23
|
+
|
13
24
|
Given('I have created a new Rails app with no database and installed cucumber-rails') do
|
14
25
|
rails_new args: '--skip-active-record'
|
15
26
|
install_cucumber_rails :no_database_cleaner, :no_factory_bot
|
@@ -13,6 +13,7 @@ module CucumberRailsHelper
|
|
13
13
|
add_gem 'selenium-webdriver', '~> 3.11', group: :test
|
14
14
|
add_gem 'rspec-expectations', '~> 3.7', group: :test
|
15
15
|
add_gem 'database_cleaner', '>= 1.8.0', group: :test unless options.include?(:no_database_cleaner)
|
16
|
+
add_gem 'database_cleaner-active_record', '>= 2.0.0.beta2', group: :test if options.include?(:database_cleaner_active_record)
|
16
17
|
add_gem 'factory_bot', '>= 3.2', group: :test unless options.include?(:no_factory_bot)
|
17
18
|
|
18
19
|
run_command_and_stop 'bundle install'
|
data/features/support/env.rb
CHANGED
data/gemfiles/rails_5_0.gemfile
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "capybara", "< 3
|
6
|
-
gem "
|
7
|
-
gem "
|
5
|
+
gem "capybara", "< 3"
|
6
|
+
gem "cucumber", "< 4"
|
7
|
+
gem "rails", "~> 5.0.7"
|
8
8
|
gem "sqlite3", "~> 1.3.13"
|
9
9
|
|
10
10
|
gemspec path: "../"
|
data/gemfiles/rails_5_1.gemfile
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "capybara", "< 3.
|
6
|
-
gem "
|
7
|
-
gem "
|
5
|
+
gem "capybara", "< 3.15"
|
6
|
+
gem "cucumber", "< 5"
|
7
|
+
gem "rails", "~> 5.1.7"
|
8
8
|
gem "sqlite3", "~> 1.3.13"
|
9
9
|
|
10
10
|
gemspec path: "../"
|
data/gemfiles/rails_5_2.gemfile
CHANGED
@@ -2,9 +2,8 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "capybara", "< 3.
|
6
|
-
gem "
|
7
|
-
gem "railties", "~> 5.2.0"
|
5
|
+
gem "capybara", "< 3.33"
|
6
|
+
gem "rails", "~> 5.2.4"
|
8
7
|
gem "sqlite3", "~> 1.3.13"
|
9
8
|
|
10
9
|
gemspec path: "../"
|
data/gemfiles/rails_6_0.gemfile
CHANGED
data/lib/cucumber/rails.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
called_from_env_rb = caller.detect { |f| f
|
3
|
+
called_from_env_rb = caller.detect { |f| f.include? '/env.rb:' }
|
4
4
|
|
5
5
|
if called_from_env_rb
|
6
6
|
env_caller = File.dirname(called_from_env_rb)
|
@@ -8,8 +8,8 @@ if called_from_env_rb
|
|
8
8
|
require 'rails'
|
9
9
|
require 'cucumber/rails/application'
|
10
10
|
ENV['RAILS_ENV'] ||= 'test'
|
11
|
-
ENV['RAILS_ROOT'] ||= File.expand_path(env_caller
|
12
|
-
require File.expand_path(ENV['RAILS_ROOT']
|
11
|
+
ENV['RAILS_ROOT'] ||= File.expand_path("#{env_caller}/../..")
|
12
|
+
require File.expand_path("#{ENV['RAILS_ROOT']}/config/environment")
|
13
13
|
require 'cucumber/rails/action_dispatch'
|
14
14
|
require 'rails/test_help'
|
15
15
|
|
@@ -22,6 +22,10 @@ if called_from_env_rb
|
|
22
22
|
require 'cucumber/rails/world'
|
23
23
|
require 'cucumber/rails/hooks'
|
24
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'
|
25
29
|
require 'cucumber/rails/database'
|
26
30
|
|
27
31
|
MultiTest.disable_autorun
|
@@ -25,6 +25,11 @@ module Cucumber
|
|
25
25
|
validate_interface!
|
26
26
|
end
|
27
27
|
|
28
|
+
def default_strategy!
|
29
|
+
self.javascript_strategy = :truncation
|
30
|
+
self.autorun_database_cleaner = true
|
31
|
+
end
|
32
|
+
|
28
33
|
def before_js
|
29
34
|
@strategy.before_js
|
30
35
|
end
|
@@ -70,66 +75,7 @@ module Cucumber
|
|
70
75
|
end
|
71
76
|
end
|
72
77
|
|
73
|
-
|
74
|
-
def initialize(options = {})
|
75
|
-
@options = options
|
76
|
-
end
|
77
|
-
|
78
|
-
def before_js(strategy)
|
79
|
-
@original_strategy = if Gem::Version.new(DatabaseCleaner::VERSION) >= Gem::Version.new('1.8.0.beta')
|
80
|
-
DatabaseCleaner.cleaners.values.first.strategy # that feels like a nasty hack
|
81
|
-
else
|
82
|
-
DatabaseCleaner.connections.first.strategy # that feels like a nasty hack
|
83
|
-
end
|
84
|
-
DatabaseCleaner.strategy = strategy, @options
|
85
|
-
end
|
86
|
-
|
87
|
-
def before_non_js
|
88
|
-
# no-op
|
89
|
-
end
|
90
|
-
|
91
|
-
def after
|
92
|
-
return unless @original_strategy
|
93
|
-
|
94
|
-
DatabaseCleaner.strategy = @original_strategy
|
95
|
-
@original_strategy = nil
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
class TruncationStrategy < Strategy
|
100
|
-
def before_js
|
101
|
-
super :truncation
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
class DeletionStrategy < Strategy
|
106
|
-
def before_js
|
107
|
-
super :deletion
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
class SharedConnectionStrategy < Strategy
|
112
|
-
def before_js
|
113
|
-
# Forces all threads to share a connection on a per-model basis,
|
114
|
-
# as connections may vary per model as per establish_connection. This works
|
115
|
-
# on Capybara because it starts the web server in a thread.
|
116
|
-
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
|
117
|
-
ActiveRecord::Base.descendants.each do |model|
|
118
|
-
model.shared_connection = model.connection
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
def before_non_js
|
123
|
-
# Do not use a shared connection unless we're in a @javascript scenario
|
124
|
-
ActiveRecord::Base.shared_connection = nil
|
125
|
-
ActiveRecord::Base.descendants.each do |model|
|
126
|
-
model.shared_connection = nil
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
Database.javascript_strategy = :truncation
|
132
|
-
Database.autorun_database_cleaner = true
|
78
|
+
default_strategy!
|
133
79
|
end
|
134
80
|
end
|
135
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
|
@@ -1,23 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
if defined?(ActiveRecord::Base)
|
4
|
+
module ActiveRecord
|
5
|
+
class Base
|
6
|
+
class_attribute :shared_connection
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
def self.connection
|
9
|
+
shared_connection || retrieve_connection
|
10
|
+
end
|
9
11
|
end
|
10
12
|
end
|
11
|
-
end
|
12
13
|
|
13
|
-
Before('@javascript') do
|
14
|
-
|
15
|
-
end
|
14
|
+
Before('@javascript') do
|
15
|
+
Cucumber::Rails::Database.before_js if Cucumber::Rails::Database.autorun_database_cleaner
|
16
|
+
end
|
16
17
|
|
17
|
-
Before('not @javascript') do
|
18
|
-
|
19
|
-
end
|
18
|
+
Before('not @javascript') do
|
19
|
+
Cucumber::Rails::Database.before_non_js if Cucumber::Rails::Database.autorun_database_cleaner
|
20
|
+
end
|
20
21
|
|
21
|
-
After do
|
22
|
-
|
22
|
+
After do
|
23
|
+
Cucumber::Rails::Database.after if Cucumber::Rails::Database.autorun_database_cleaner
|
24
|
+
end
|
23
25
|
end
|
@@ -1,8 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
begin
|
4
|
-
require 'database_cleaner'
|
4
|
+
require 'database_cleaner/core'
|
5
|
+
rescue LoadError
|
6
|
+
begin
|
7
|
+
require 'database_cleaner'
|
8
|
+
rescue LoadError
|
9
|
+
Cucumber.logger.debug('neither database_cleaner v1 or v2 present')
|
10
|
+
end
|
11
|
+
end
|
5
12
|
|
13
|
+
if defined?(DatabaseCleaner)
|
6
14
|
Before('not @no-database-cleaner') do
|
7
15
|
DatabaseCleaner.start if Cucumber::Rails::Database.autorun_database_cleaner
|
8
16
|
end
|
@@ -10,6 +18,4 @@ begin
|
|
10
18
|
After('not @no-database-cleaner') do
|
11
19
|
DatabaseCleaner.clean if Cucumber::Rails::Database.autorun_database_cleaner
|
12
20
|
end
|
13
|
-
rescue LoadError
|
14
|
-
Cucumber.logger.debug('database_cleaner gem not present.')
|
15
21
|
end
|
@@ -1,5 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'cucumber/rails/database/strategy'
|
4
|
+
require 'cucumber/rails/database/deletion_strategy'
|
5
|
+
require 'cucumber/rails/database/shared_connection_strategy'
|
6
|
+
require 'cucumber/rails/database/truncation_strategy'
|
3
7
|
require 'cucumber/rails/database'
|
4
8
|
|
5
9
|
describe Cucumber::Rails::Database do
|
data/spec/examples.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
------------------------------------------------------------- | ------ | --------------- |
|
3
|
+
./spec/cucumber/rails/database_spec.rb[1:1:1] | passed | 0.00057 seconds |
|
4
|
+
./spec/cucumber/rails/database_spec.rb[1:1:2] | passed | 0.00845 seconds |
|
5
|
+
./spec/cucumber/rails/database_spec.rb[1:2:1] | passed | 0.00046 seconds |
|
6
|
+
./spec/cucumber/rails/database_spec.rb[1:3:1] | passed | 0.00683 seconds |
|
7
|
+
./spec/cucumber/rails/database_spec.rb[1:3:2] | passed | 0.00494 seconds |
|
8
|
+
./spec/cucumber/rails/database_spec.rb[1:4:1] | passed | 0.69664 seconds |
|
9
|
+
./spec/generators/cucumber/install_generator_spec.rb[1:1:1:1] | passed | 0.0271 seconds |
|
10
|
+
./spec/generators/cucumber/install_generator_spec.rb[1:1:1:2] | passed | 0.0285 seconds |
|
11
|
+
./spec/generators/cucumber/install_generator_spec.rb[1:1:2:1] | passed | 0.05333 seconds |
|
12
|
+
./spec/generators/cucumber/install_generator_spec.rb[1:1:3:1] | passed | 0.02378 seconds |
|
13
|
+
./spec/generators/cucumber/install_generator_spec.rb[1:1:3:2] | passed | 0.04247 seconds |
|
14
|
+
./spec/generators/cucumber/install_generator_spec.rb[1:1:3:3] | passed | 0.05091 seconds |
|
15
|
+
./spec/generators/cucumber/install_generator_spec.rb[1:1:4:1] | passed | 0.04202 seconds |
|
16
|
+
./spec/generators/cucumber/install_generator_spec.rb[1:1:4:2] | passed | 0.04029 seconds |
|
17
|
+
./spec/generators/cucumber/install_generator_spec.rb[1:1:4:3] | passed | 0.01359 seconds |
|
18
|
+
./spec/generators/cucumber/install_generator_spec.rb[1:1:5:1] | passed | 0.04387 seconds |
|
19
|
+
./spec/generators/cucumber/install_generator_spec.rb[1:1:5:2] | passed | 0.03496 seconds |
|
@@ -0,0 +1,62 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
|
+
|
4
|
+
ruby '2.5.8'
|
5
|
+
|
6
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
7
|
+
gem 'rails', '~> 5.2.4', '>= 5.2.4.3'
|
8
|
+
# Use sqlite3 as the database for Active Record
|
9
|
+
gem 'sqlite3', "~> 1.3.13"
|
10
|
+
|
11
|
+
# Use Puma as the app server
|
12
|
+
gem 'puma', '~> 3.11'
|
13
|
+
# Use SCSS for stylesheets
|
14
|
+
gem 'sass-rails', '~> 5.0'
|
15
|
+
# Use Uglifier as compressor for JavaScript assets
|
16
|
+
gem 'uglifier', '>= 1.3.0'
|
17
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
18
|
+
# gem 'mini_racer', platforms: :ruby
|
19
|
+
|
20
|
+
# Use CoffeeScript for .coffee assets and views
|
21
|
+
gem 'coffee-rails', '~> 4.2'
|
22
|
+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
23
|
+
gem 'turbolinks', '~> 5'
|
24
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
25
|
+
gem 'jbuilder', '~> 2.5'
|
26
|
+
# Use Redis adapter to run Action Cable in production
|
27
|
+
# gem 'redis', '~> 4.0'
|
28
|
+
# Use ActiveModel has_secure_password
|
29
|
+
# gem 'bcrypt', '~> 3.1.7'
|
30
|
+
|
31
|
+
# Use ActiveStorage variant
|
32
|
+
# gem 'mini_magick', '~> 4.8'
|
33
|
+
|
34
|
+
# Use Capistrano for deployment
|
35
|
+
# gem 'capistrano-rails', group: :development
|
36
|
+
|
37
|
+
group :development, :test do
|
38
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
39
|
+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
40
|
+
end
|
41
|
+
|
42
|
+
group :development do
|
43
|
+
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
44
|
+
gem 'web-console', '>= 3.3.0'
|
45
|
+
gem 'listen', '>= 3.0.5', '< 3.2'
|
46
|
+
end
|
47
|
+
|
48
|
+
group :test do
|
49
|
+
# Adds support for Capybara system testing and selenium driver
|
50
|
+
gem 'capybara', group: :test
|
51
|
+
|
52
|
+
gem 'selenium-webdriver', "~> 3.11", group: :test
|
53
|
+
|
54
|
+
# Easy installation and use of chromedriver to run system tests with Chrome
|
55
|
+
gem 'chromedriver-helper'
|
56
|
+
end
|
57
|
+
|
58
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
59
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
60
|
+
gem 'cucumber-rails', group: :test, require: false, path: "/home/luke/Code/cucumber-rails"
|
61
|
+
gem 'rspec-expectations', "~> 3.7", group: :test
|
62
|
+
gem 'factory_bot', ">= 3.2", group: :test
|