cucumber-rails 2.2.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +86 -19
- data/README.md +4 -13
- data/lib/cucumber/rails/capybara/select_dates_and_times.rb +28 -13
- data/lib/cucumber/rails/database/deletion_strategy.rb +2 -0
- data/lib/cucumber/rails/database/null_strategy.rb +15 -0
- data/lib/cucumber/rails/database/shared_connection_strategy.rb +2 -0
- data/lib/cucumber/rails/database/strategy.rb +4 -0
- data/lib/cucumber/rails/database/truncation_strategy.rb +2 -0
- data/lib/cucumber/rails/database.rb +2 -1
- data/lib/cucumber/rails.rb +1 -0
- data/lib/generators/cucumber/install_generator.rb +13 -16
- data/lib/generators/cucumber/templates/config/cucumber.yml.erb +3 -3
- data/lib/generators/cucumber/templates/tasks/cucumber.rake.erb +5 -0
- metadata +79 -244
- data/Appraisals +0 -26
- data/Gemfile +0 -5
- data/Rakefile +0 -53
- data/bin/install_geckodriver.sh +0 -19
- data/bin/install_webpacker.sh +0 -9
- data/config/cucumber.yml +0 -17
- data/cucumber-rails.gemspec +0 -53
- data/dev_tasks/cucumber.rake +0 -5
- data/dev_tasks/rspec.rake +0 -5
- data/dev_tasks/yard/default/layout/html/bubble_32x32.png +0 -0
- data/dev_tasks/yard/default/layout/html/footer.erb +0 -5
- data/dev_tasks/yard/default/layout/html/index.erb +0 -1
- data/dev_tasks/yard/default/layout/html/layout.erb +0 -25
- data/dev_tasks/yard/default/layout/html/logo.erb +0 -1
- data/dev_tasks/yard/default/layout/html/setup.rb +0 -9
- data/dev_tasks/yard.rake +0 -28
- data/features/allow_rescue.feature +0 -66
- data/features/annotations.feature +0 -20
- data/features/capybara_javascript_drivers.feature +0 -132
- data/features/choose_javascript_database_strategy.feature +0 -125
- data/features/configuration.feature +0 -48
- data/features/database_cleaner.feature +0 -131
- data/features/disable_automatic_database_cleaning.feature +0 -49
- data/features/emulate_javascript.feature +0 -109
- data/features/install_cucumber_rails.feature +0 -14
- data/features/no_database.feature +0 -61
- data/features/raising_errors.feature +0 -22
- data/features/rerun_profile.feature +0 -47
- data/features/rest_api.feature +0 -47
- data/features/step_definitions/cucumber_rails_steps.rb +0 -80
- data/features/support/aruba.rb +0 -5
- data/features/support/cucumber_rails_helper.rb +0 -86
- data/features/support/env.rb +0 -6
- data/features/support/hooks.rb +0 -8
- data/gemfiles/rails_5_0.gemfile +0 -10
- data/gemfiles/rails_5_1.gemfile +0 -10
- data/gemfiles/rails_5_2.gemfile +0 -9
- data/gemfiles/rails_6_0.gemfile +0 -8
- data/lib/generators/cucumber/templates/support/rails_spork.rb.erb +0 -13
- data/spec/cucumber/rails/database_spec.rb +0 -74
- data/spec/examples.txt +0 -19
- data/spec/generators/cucumber/install_generator_spec.rb +0 -55
- data/spec/spec_helper.rb +0 -16
- data/tmp/aruba/test_app/Gemfile +0 -62
- data/tmp/aruba/test_app/Gemfile.lock +0 -249
- data/tmp/aruba/test_app/README.md +0 -24
- data/tmp/aruba/test_app/Rakefile +0 -6
- data/tmp/aruba/test_app/app/assets/config/manifest.js +0 -3
- data/tmp/aruba/test_app/app/assets/javascripts/application.js +0 -16
- data/tmp/aruba/test_app/app/assets/javascripts/appointments.coffee +0 -3
- data/tmp/aruba/test_app/app/assets/javascripts/cable.js +0 -13
- data/tmp/aruba/test_app/app/assets/stylesheets/application.css +0 -15
- data/tmp/aruba/test_app/app/assets/stylesheets/appointments.scss +0 -3
- data/tmp/aruba/test_app/app/assets/stylesheets/scaffolds.scss +0 -84
- data/tmp/aruba/test_app/app/channels/application_cable/channel.rb +0 -4
- data/tmp/aruba/test_app/app/channels/application_cable/connection.rb +0 -4
- data/tmp/aruba/test_app/app/controllers/application_controller.rb +0 -2
- data/tmp/aruba/test_app/app/controllers/appointments_controller.rb +0 -74
- data/tmp/aruba/test_app/app/helpers/application_helper.rb +0 -2
- data/tmp/aruba/test_app/app/helpers/appointments_helper.rb +0 -2
- data/tmp/aruba/test_app/app/jobs/application_job.rb +0 -2
- data/tmp/aruba/test_app/app/mailers/application_mailer.rb +0 -4
- data/tmp/aruba/test_app/app/models/application_record.rb +0 -3
- data/tmp/aruba/test_app/app/models/appointment.rb +0 -2
- data/tmp/aruba/test_app/app/views/appointments/_appointment.json.jbuilder +0 -2
- data/tmp/aruba/test_app/app/views/appointments/_form.html.erb +0 -27
- data/tmp/aruba/test_app/app/views/appointments/edit.html.erb +0 -6
- data/tmp/aruba/test_app/app/views/appointments/index.html.erb +0 -29
- data/tmp/aruba/test_app/app/views/appointments/index.json.jbuilder +0 -1
- data/tmp/aruba/test_app/app/views/appointments/new.html.erb +0 -5
- data/tmp/aruba/test_app/app/views/appointments/show.html.erb +0 -14
- data/tmp/aruba/test_app/app/views/appointments/show.json.jbuilder +0 -1
- data/tmp/aruba/test_app/app/views/layouts/application.html.erb +0 -15
- data/tmp/aruba/test_app/app/views/layouts/mailer.html.erb +0 -13
- data/tmp/aruba/test_app/app/views/layouts/mailer.text.erb +0 -1
- data/tmp/aruba/test_app/bin/bundle +0 -3
- data/tmp/aruba/test_app/bin/rails +0 -4
- data/tmp/aruba/test_app/bin/rake +0 -4
- data/tmp/aruba/test_app/bin/setup +0 -36
- data/tmp/aruba/test_app/bin/update +0 -31
- data/tmp/aruba/test_app/bin/yarn +0 -11
- data/tmp/aruba/test_app/config/application.rb +0 -19
- data/tmp/aruba/test_app/config/boot.rb +0 -3
- data/tmp/aruba/test_app/config/cable.yml +0 -10
- data/tmp/aruba/test_app/config/credentials.yml.enc +0 -1
- data/tmp/aruba/test_app/config/cucumber.yml +0 -9
- data/tmp/aruba/test_app/config/database.yml +0 -25
- data/tmp/aruba/test_app/config/environment.rb +0 -5
- data/tmp/aruba/test_app/config/environments/development.rb +0 -61
- data/tmp/aruba/test_app/config/environments/production.rb +0 -94
- data/tmp/aruba/test_app/config/environments/test.rb +0 -46
- data/tmp/aruba/test_app/config/initializers/application_controller_renderer.rb +0 -8
- data/tmp/aruba/test_app/config/initializers/assets.rb +0 -14
- data/tmp/aruba/test_app/config/initializers/backtrace_silencers.rb +0 -7
- data/tmp/aruba/test_app/config/initializers/content_security_policy.rb +0 -25
- data/tmp/aruba/test_app/config/initializers/cookies_serializer.rb +0 -5
- data/tmp/aruba/test_app/config/initializers/filter_parameter_logging.rb +0 -4
- data/tmp/aruba/test_app/config/initializers/inflections.rb +0 -16
- data/tmp/aruba/test_app/config/initializers/mime_types.rb +0 -4
- data/tmp/aruba/test_app/config/initializers/wrap_parameters.rb +0 -14
- data/tmp/aruba/test_app/config/locales/en.yml +0 -33
- data/tmp/aruba/test_app/config/master.key +0 -1
- data/tmp/aruba/test_app/config/puma.rb +0 -37
- data/tmp/aruba/test_app/config/routes.rb +0 -4
- data/tmp/aruba/test_app/config/storage.yml +0 -34
- data/tmp/aruba/test_app/config.ru +0 -5
- data/tmp/aruba/test_app/db/development.sqlite3 +0 -0
- data/tmp/aruba/test_app/db/migrate/20200821080656_create_appointments.rb +0 -10
- data/tmp/aruba/test_app/db/schema.rb +0 -22
- data/tmp/aruba/test_app/db/seeds.rb +0 -7
- data/tmp/aruba/test_app/db/test.sqlite3 +0 -0
- data/tmp/aruba/test_app/features/create_appointment.feature +0 -9
- data/tmp/aruba/test_app/features/create_appointment_steps.rb +0 -19
- data/tmp/aruba/test_app/features/support/env.rb +0 -18
- data/tmp/aruba/test_app/lib/tasks/cucumber.rake +0 -76
- data/tmp/aruba/test_app/log/development.log +0 -27
- data/tmp/aruba/test_app/log/test.log +0 -38
- data/tmp/aruba/test_app/package.json +0 -5
- data/tmp/aruba/test_app/public/404.html +0 -67
- data/tmp/aruba/test_app/public/422.html +0 -67
- data/tmp/aruba/test_app/public/500.html +0 -66
- 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 +0 -1
- data/tmp/aruba/test_app/script/cucumber +0 -11
- data/tmp/aruba/test_app/test/application_system_test_case.rb +0 -5
- data/tmp/aruba/test_app/test/controllers/appointments_controller_test.rb +0 -48
- data/tmp/aruba/test_app/test/fixtures/appointments.yml +0 -9
- data/tmp/aruba/test_app/test/models/appointment_test.rb +0 -7
- data/tmp/aruba/test_app/test/system/appointments_test.rb +0 -45
- data/tmp/aruba/test_app/test/test_helper.rb +0 -10
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/0I/0I0oT83oN3NKiEi9XIhexiT3XgkA8mKyCbs25v3l20g.cache +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/0W/0WnFNEwHN4bhDiFTvyMWURx02L4yP3gkP7vtjzKQFVo.cache +0 -1
- 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 +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/72/72jdZDzrM3-D_zYkIiPdAWQNeaFsqah154_QvcqWqTQ.cache +0 -3
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/99/99m8UCKl4j8IpsVOK8ltLHyNh8Ae0nHw3GBkC34V_co.cache +0 -2
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/9O/9OOXnKHBQnaCeE5HDe5csQsItouzWM6rTl8sESvkGTE.cache +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/AF/AFloQwm_M7GZudPY87xx4TA0xEeuX9Psl0SJ94i5EyU.cache +0 -3
- 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 +0 -2
- 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 +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/HC/HCDOUd7-S45aJ_PjVAC_Vmjyud3i1aQv4cE3t9_Z3Dw.cache +0 -2
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/Hv/HvPd_vK17QbhWq8QnCuyhqm0cPaGnHyO9lSzN-icQdg.cache +0 -2
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/II/IIhUO-5-DcfCyD_rVJeHjRMNVJxLmAmXP8i2XEjFpns.cache +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/Ka/KaLHRsUYc4EUxUr4q_UhArFJUTF_EaBklpeU4TsE9SY.cache +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/MZ/MZcwDENEs93Wd9q7A_7UWdfJrWsBXa0pGp03P9mqG2I.cache +0 -3
- 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 +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/RE/REtgGrS74n4Y7OKRcGvZsA2EUClg_RM66mVgGpySI20.cache +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/Rk/RkQLRXSz5LhJQnH7BT-ZDkVK0Rx8N9KhcVwR2A1HY4M.cache +0 -2
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/Sx/SxtNEQ-KKVBCTtsDD-xf4oJEIdBPIHkGktnLXvG-GRk.cache +0 -1
- 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 +0 -3
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/U6/U6pXyI-5haNcHRdsB-SoztzlXb98-256hFReXsL31J4.cache +0 -2
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/UE/UEKUaC9O_XBO5acP8HnxcJ1dtNM_1C7MTofkTQvPgRA.cache +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/UV/UVcnI5bo-eQvULfmzeQUFVTDYEMF2cbAXpsOsh01XNY.cache +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/WK/WK8RpMP5qb9GRQTsTHAzlfo8t2nsTLU6B8CQAc4UfOU.cache +0 -1
- 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 +0 -5
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/ac/acWu1-1ZAW1jRVKlHYlzlEg28lk-SdHfTq-P-viJMS0.cache +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/b3/b3NiYrQOlN2zxiJYqbl4gmvK6it3Md9gSzAYgsIMhnY.cache +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/c1/c1Pm-rFPEB3LXIjOtswD6x8SEAgI9y2BR16jc8ifcsc.cache +0 -1
- 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 +0 -1
- 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 +0 -3
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/oi/oiPhXw8pYdWv5T4qRFzePHaXZLI50xMvvTyfry-ILSo.cache +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/r-/r--YB1ugrZ4F-ogbLLYNwIH3j9pQ2u_ZBjTJxoS7TrM.cache +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/s6/s68UIyg0lNko7IA42JXv_wwy9Ea3WH-zc9h0GYPg88Y.cache +0 -1
- 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 +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/t9/t93lpjyly3MvgKs51_OlLXneJXGyYFGmshXsk4Wr69M.cache +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/tE/tEy2QePsDnmFyyAQEric23sSBnfHBst3SEM7p-J7el8.cache +0 -2
- 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 +0 -1
- 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 +0 -3
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/vC/vCsc-q2WmT8vWM2d2pb6_5hFav8mGlylwEKVWQvsumo.cache +0 -1
- 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 +0 -1
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/w4/w4y_Lms54hD2Nivh5PHeccAmh2DX53sc_HDTQYNyNXw.cache +0 -3
- data/tmp/aruba/test_app/tmp/cache/assets/sprockets/v3.0/yZ/yZpoD5Zf4RAQoOwi5kMVksuta_0KhYSK_Yy_6Ykyt7E.cache +0 -1
- data/tmp/aruba/test_app/tmp/development_secret.txt +0 -1
@@ -1,49 +0,0 @@
|
|
1
|
-
Feature: Disable automatic database cleaning
|
2
|
-
|
3
|
-
By default, a set of Before/After hooks are installed to
|
4
|
-
invoke database_cleaner on every scenario except those tagged
|
5
|
-
"@no-database-cleaner". Sometimes when a user is switching between
|
6
|
-
cleaning strategies, this can initiate an undesired database
|
7
|
-
transaction.
|
8
|
-
|
9
|
-
To avoid the need for users making frequent strategy switches to apply
|
10
|
-
this tag, a configuration option is provided so that the user can
|
11
|
-
control the invocation of database_cleaner explicitly.
|
12
|
-
|
13
|
-
Scenario: Disabling automatic cleaning
|
14
|
-
Given I have created a new Rails app and installed cucumber-rails
|
15
|
-
When I append to "features/env.rb" with:
|
16
|
-
"""
|
17
|
-
Cucumber::Rails::Database.autorun_database_cleaner = false
|
18
|
-
"""
|
19
|
-
And I write to "features/widgets.feature" with:
|
20
|
-
"""
|
21
|
-
Feature: Create widgets
|
22
|
-
Scenario: Create 3 widgets
|
23
|
-
When I create 3 widgets
|
24
|
-
Then I should have 3 widgets
|
25
|
-
|
26
|
-
Scenario: Create 5 widgets
|
27
|
-
When I create 5 widgets
|
28
|
-
Then I should have 8 widgets
|
29
|
-
"""
|
30
|
-
And I run `rails generate model widget name:string`
|
31
|
-
And I write to "features/step_definitions/widget_steps.rb" with:
|
32
|
-
"""
|
33
|
-
When('I create {int} widgets') do |number|
|
34
|
-
number.times do |i|
|
35
|
-
Widget.create! name: "Widget #{Widget.count + i}"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
Then('I should have {int} widgets') do |number|
|
40
|
-
expect(Widget.count).to eq(number)
|
41
|
-
end
|
42
|
-
"""
|
43
|
-
And I run `bundle exec rake db:migrate`
|
44
|
-
And I run `bundle exec rake cucumber`
|
45
|
-
Then the feature run should pass with:
|
46
|
-
"""
|
47
|
-
2 scenarios (2 passed)
|
48
|
-
4 steps (4 passed)
|
49
|
-
"""
|
@@ -1,109 +0,0 @@
|
|
1
|
-
Feature: Emulate Javascript
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given I have created a new Rails app and installed cucumber-rails
|
5
|
-
And I force selenium to run Firefox in headless mode
|
6
|
-
When I run `rails generate scaffold widget name:string`
|
7
|
-
And I write to "features/step_definitions/widget_steps.rb" with:
|
8
|
-
"""
|
9
|
-
Given('there is a widget named {string}') do |name|
|
10
|
-
FactoryBot.create(:widget, name: name)
|
11
|
-
end
|
12
|
-
|
13
|
-
When('I am on the widgets page') do
|
14
|
-
visit widgets_path
|
15
|
-
end
|
16
|
-
|
17
|
-
Then('I should see {string}') do |text|
|
18
|
-
expect(page).to have_content(text)
|
19
|
-
end
|
20
|
-
"""
|
21
|
-
And I write to "features/support/factories/widget.rb" with:
|
22
|
-
"""
|
23
|
-
FactoryBot.define do
|
24
|
-
factory :widget do
|
25
|
-
name { 'testwidget' }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
"""
|
29
|
-
|
30
|
-
Scenario: See a widget
|
31
|
-
When I write to "features/widgets.feature" with:
|
32
|
-
"""
|
33
|
-
@javascript
|
34
|
-
Feature: Widget inventory
|
35
|
-
Scenario: Delete a widget
|
36
|
-
Given there is a widget named "wrench"
|
37
|
-
And I am on the widgets page
|
38
|
-
Then I should see "wrench"
|
39
|
-
"""
|
40
|
-
And I run `bundle exec rake db:migrate`
|
41
|
-
And I run `bundle exec rake cucumber`
|
42
|
-
Then the feature run should pass with:
|
43
|
-
"""
|
44
|
-
1 scenario (1 passed)
|
45
|
-
3 steps (3 passed)
|
46
|
-
"""
|
47
|
-
|
48
|
-
Scenario: Pass on the CSRF token
|
49
|
-
When I run `sed -i -e 's/forgery_protection *= false/forgery_protection = true/' config/environments/test.rb`
|
50
|
-
And I run `rails generate controller session establish`
|
51
|
-
And I write to "app/controllers/session_controller.rb" with:
|
52
|
-
"""
|
53
|
-
class SessionController < ApplicationController
|
54
|
-
def establish
|
55
|
-
session[:verified] = true
|
56
|
-
end
|
57
|
-
end
|
58
|
-
"""
|
59
|
-
And I write to "app/controllers/application_controller.rb" with:
|
60
|
-
"""
|
61
|
-
class ApplicationController < ActionController::Base
|
62
|
-
protect_from_forgery
|
63
|
-
|
64
|
-
before_action except: :establish do
|
65
|
-
render text: 'denied', status: :forbidden and return false unless session[:verified]
|
66
|
-
end
|
67
|
-
end
|
68
|
-
"""
|
69
|
-
And I write to "features/widgets.feature" with:
|
70
|
-
"""
|
71
|
-
Feature: Widget inventory
|
72
|
-
Scenario: Delete a widget
|
73
|
-
Given there is a widget named "wrench"
|
74
|
-
And I am on the session establish page
|
75
|
-
And I am on the widgets page
|
76
|
-
Then I should see "wrench"
|
77
|
-
When I follow "Destroy"
|
78
|
-
Then I should not see "denied"
|
79
|
-
And I should be on the widgets page
|
80
|
-
And I should not see "wrench"
|
81
|
-
"""
|
82
|
-
And I append to "features/step_definitions/widget_steps.rb" with:
|
83
|
-
# TODO: Remove the newline below (Required) once bug is fixed: https://github.com/cucumber/aruba/issues/662
|
84
|
-
"""
|
85
|
-
|
86
|
-
Given('I am on the session establish page') do
|
87
|
-
visit session_establish_path
|
88
|
-
end
|
89
|
-
|
90
|
-
When('I follow {string}') do |link|
|
91
|
-
click_link(link)
|
92
|
-
end
|
93
|
-
|
94
|
-
Then('I should not see {string}') do |text|
|
95
|
-
expect(page).not_to have_content(text)
|
96
|
-
end
|
97
|
-
|
98
|
-
Then('I should be on the widgets page') do
|
99
|
-
current_path = URI.parse(current_url).path
|
100
|
-
expect(current_path).to eq(widgets_path)
|
101
|
-
end
|
102
|
-
"""
|
103
|
-
And I run `bundle exec rake db:migrate`
|
104
|
-
And I run `bundle exec rake cucumber`
|
105
|
-
Then the feature run should pass with:
|
106
|
-
"""
|
107
|
-
1 scenario (1 passed)
|
108
|
-
8 steps (8 passed)
|
109
|
-
"""
|
@@ -1,14 +0,0 @@
|
|
1
|
-
Feature: Install Cucumber Rails
|
2
|
-
|
3
|
-
Cucumber-Rails should work on supported versions
|
4
|
-
of Ruby on Rails, with Capybara and DatabaseCleaner
|
5
|
-
|
6
|
-
Scenario: Install Cucumber-Rails
|
7
|
-
Given I have created a new Rails app and installed cucumber-rails
|
8
|
-
Then the following files should exist:
|
9
|
-
| config/cucumber.yml |
|
10
|
-
| script/cucumber |
|
11
|
-
| features/support/env.rb |
|
12
|
-
| features/step_definitions/.gitkeep |
|
13
|
-
| lib/tasks/cucumber.rake |
|
14
|
-
And the file "features/support/env.rb" should contain "require 'cucumber/rails'"
|
@@ -1,61 +0,0 @@
|
|
1
|
-
Feature: No Database
|
2
|
-
|
3
|
-
Allow Cucumber to work with a Rails app without a database
|
4
|
-
|
5
|
-
Scenario: No ActiveRecord and DatabaseCleaner
|
6
|
-
Given I have created a new Rails app with no database and installed cucumber-rails
|
7
|
-
# Turn off ActiveRecord
|
8
|
-
When I write to "config/application.rb" with:
|
9
|
-
"""
|
10
|
-
require File.expand_path('../boot', __FILE__)
|
11
|
-
|
12
|
-
require 'action_controller/railtie'
|
13
|
-
require 'action_mailer/railtie'
|
14
|
-
require 'rails/test_unit/railtie'
|
15
|
-
|
16
|
-
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
17
|
-
|
18
|
-
module TestApp
|
19
|
-
class Application < Rails::Application
|
20
|
-
config.encoding = 'utf-8'
|
21
|
-
config.filter_parameters += [:password]
|
22
|
-
end
|
23
|
-
end
|
24
|
-
"""
|
25
|
-
And I overwrite "features/support/env.rb" with:
|
26
|
-
"""
|
27
|
-
require 'cucumber/rails'
|
28
|
-
"""
|
29
|
-
And I remove the 'database_cleaner' gem from the Gemfile
|
30
|
-
And I remove the 'sqlite' gem from the Gemfile
|
31
|
-
And I write to "app/controllers/posts_controller.rb" with:
|
32
|
-
"""
|
33
|
-
class PostsController < ApplicationController
|
34
|
-
def index
|
35
|
-
raise 'There is an error in index'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
"""
|
39
|
-
And I write to "config/routes.rb" with:
|
40
|
-
"""
|
41
|
-
TestApp::Application.routes.draw do
|
42
|
-
resources :posts
|
43
|
-
end
|
44
|
-
"""
|
45
|
-
And I write to "features/posts.feature" with:
|
46
|
-
"""
|
47
|
-
Feature: posts
|
48
|
-
Scenario: See them
|
49
|
-
When I view the posts
|
50
|
-
"""
|
51
|
-
And I write to "features/step_definitions/posts_steps.rb" with:
|
52
|
-
"""
|
53
|
-
When('I view the posts') do
|
54
|
-
visit '/posts'
|
55
|
-
end
|
56
|
-
"""
|
57
|
-
And I run `bundle exec rake cucumber`
|
58
|
-
Then it should fail with:
|
59
|
-
"""
|
60
|
-
There is an error in index
|
61
|
-
"""
|
@@ -1,22 +0,0 @@
|
|
1
|
-
Feature: Raise Errors
|
2
|
-
|
3
|
-
Scenario: Raise error for undefined route
|
4
|
-
Given I have created a new Rails app with no database and installed cucumber-rails
|
5
|
-
When I write to "features/home.feature" with:
|
6
|
-
"""
|
7
|
-
Feature: Tests
|
8
|
-
Scenario: Tests
|
9
|
-
When I go to the home page
|
10
|
-
"""
|
11
|
-
And I write to "features/home_steps.rb" with:
|
12
|
-
"""
|
13
|
-
When('I go to the home page') do
|
14
|
-
visit('/')
|
15
|
-
end
|
16
|
-
"""
|
17
|
-
And I run `bundle exec cucumber`
|
18
|
-
Then it should fail with:
|
19
|
-
"""
|
20
|
-
1 scenario (1 failed)
|
21
|
-
1 step (1 failed)
|
22
|
-
"""
|
@@ -1,47 +0,0 @@
|
|
1
|
-
Feature: Rerun profile
|
2
|
-
|
3
|
-
In order to concentrate on failing features
|
4
|
-
As a Rails developer working with Cucumber
|
5
|
-
I want to rerun only failing features
|
6
|
-
|
7
|
-
Scenario: Rerun
|
8
|
-
Given I have created a new Rails app and installed cucumber-rails
|
9
|
-
And a file named "rerun.txt" with:
|
10
|
-
"""
|
11
|
-
features/rerun_test.feature:2
|
12
|
-
features/rerun_test.feature:5
|
13
|
-
"""
|
14
|
-
And a file named "features/rerun_test.feature" with:
|
15
|
-
"""
|
16
|
-
Feature: Rerun test
|
17
|
-
Scenario: failing before
|
18
|
-
Given fixed now
|
19
|
-
|
20
|
-
Scenario: still failing
|
21
|
-
Given broken
|
22
|
-
|
23
|
-
Scenario: always passing
|
24
|
-
Given passing
|
25
|
-
"""
|
26
|
-
And a file named "features/step_definitions/rerun_steps.rb" with:
|
27
|
-
"""
|
28
|
-
Given('fixed now') do
|
29
|
-
puts 'All fixed now'
|
30
|
-
end
|
31
|
-
|
32
|
-
Given('broken') do
|
33
|
-
raise "I'm broken"
|
34
|
-
end
|
35
|
-
|
36
|
-
Given('passing') do
|
37
|
-
puts "I've always been passing"
|
38
|
-
end
|
39
|
-
"""
|
40
|
-
When I run `bundle exec cucumber -p rerun`
|
41
|
-
Then it should fail with:
|
42
|
-
"""
|
43
|
-
2 scenarios (1 failed, 1 passed)
|
44
|
-
2 steps (1 failed, 1 passed)
|
45
|
-
"""
|
46
|
-
And the file "rerun.txt" should not contain "features/rerun_test.feature:2"
|
47
|
-
And the file "rerun.txt" should contain "features/rerun_test.feature:5"
|
data/features/rest_api.feature
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
Feature: REST API
|
2
|
-
|
3
|
-
Scenario: Compare JSON
|
4
|
-
Given I have created a new Rails app and installed cucumber-rails
|
5
|
-
When I write to "app/controllers/posts_controller.rb" with:
|
6
|
-
"""
|
7
|
-
class PostsController < ApplicationController
|
8
|
-
def index
|
9
|
-
render json: {'hello' => 'world'}.to_json
|
10
|
-
end
|
11
|
-
end
|
12
|
-
"""
|
13
|
-
And I write to "config/routes.rb" with:
|
14
|
-
"""
|
15
|
-
TestApp::Application.routes.draw do
|
16
|
-
resources :posts
|
17
|
-
end
|
18
|
-
"""
|
19
|
-
And I write to "features/posts.feature" with:
|
20
|
-
"""
|
21
|
-
Feature: posts
|
22
|
-
Scenario: See them
|
23
|
-
When the client requests GET /posts
|
24
|
-
Then the response should be JSON:
|
25
|
-
\"\"\"
|
26
|
-
{
|
27
|
-
"hello": "world"
|
28
|
-
}
|
29
|
-
\"\"\"
|
30
|
-
"""
|
31
|
-
And I write to "features/step_definitions/post_steps.rb" with:
|
32
|
-
"""
|
33
|
-
When('the client requests GET /{word}') do |path|
|
34
|
-
get(path)
|
35
|
-
end
|
36
|
-
|
37
|
-
Then('the response should be JSON:') do |json|
|
38
|
-
expect(JSON.parse(last_response.body)).to eq(JSON.parse(json))
|
39
|
-
end
|
40
|
-
"""
|
41
|
-
And I run `bundle exec rake db:migrate`
|
42
|
-
And I run `bundle exec rake cucumber`
|
43
|
-
Then the feature run should pass with:
|
44
|
-
"""
|
45
|
-
1 scenario (1 passed)
|
46
|
-
2 steps (2 passed)
|
47
|
-
"""
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Given('I have created a new Rails app and installed cucumber-rails, accidentally outside of the test group in my Gemfile') do
|
4
|
-
rails_new
|
5
|
-
install_cucumber_rails :not_in_test_group
|
6
|
-
end
|
7
|
-
|
8
|
-
Given('I have created a new Rails app and installed cucumber-rails') do
|
9
|
-
rails_new
|
10
|
-
install_cucumber_rails
|
11
|
-
end
|
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
|
-
|
24
|
-
Given('I have created a new Rails app with no database and installed cucumber-rails') do
|
25
|
-
rails_new args: '--skip-active-record'
|
26
|
-
install_cucumber_rails :no_database_cleaner, :no_factory_bot
|
27
|
-
overwrite_file('features/support/env.rb', "require 'cucumber/rails'\n")
|
28
|
-
end
|
29
|
-
|
30
|
-
Given('I have a {string} ActiveRecord model object') do |name|
|
31
|
-
run_command_and_stop("bundle exec rails g model #{name}")
|
32
|
-
run_command_and_stop('bundle exec rake db:migrate RAILS_ENV=test')
|
33
|
-
end
|
34
|
-
|
35
|
-
Given('I remove the {string} gem from the Gemfile') do |gem_name|
|
36
|
-
content = File.open(expand_path('Gemfile'), 'r').readlines
|
37
|
-
new_content = []
|
38
|
-
|
39
|
-
content.each do |line|
|
40
|
-
next if /gem ["|']#{gem_name}["|'].*/.match?(line)
|
41
|
-
|
42
|
-
new_content << line
|
43
|
-
end
|
44
|
-
|
45
|
-
overwrite_file('Gemfile', new_content.join("\r\n"))
|
46
|
-
end
|
47
|
-
|
48
|
-
Given('I force selenium to run Firefox in headless mode') do
|
49
|
-
selenium_config = %{
|
50
|
-
Capybara.register_driver :selenium do |app|
|
51
|
-
http_client = Selenium::WebDriver::Remote::Http::Default.new
|
52
|
-
http_client.read_timeout = 180
|
53
|
-
|
54
|
-
browser_options = Selenium::WebDriver::Firefox::Options.new
|
55
|
-
browser_options.args << '--headless'
|
56
|
-
Capybara::Selenium::Driver.new(
|
57
|
-
app,
|
58
|
-
browser: :firefox,
|
59
|
-
options: browser_options,
|
60
|
-
http_client: http_client
|
61
|
-
)
|
62
|
-
end
|
63
|
-
|
64
|
-
Capybara.server = :webrick
|
65
|
-
}
|
66
|
-
|
67
|
-
step 'I append to "features/support/env.rb" with:', selenium_config
|
68
|
-
end
|
69
|
-
|
70
|
-
When('I run the cukes') do
|
71
|
-
run_command_and_stop('bundle exec cucumber')
|
72
|
-
end
|
73
|
-
|
74
|
-
# Copied from Aruba
|
75
|
-
Then('the feature run should pass with:') do |string|
|
76
|
-
step 'the output should not contain " failed)"'
|
77
|
-
step 'the output should not contain " undefined)"'
|
78
|
-
step 'the exit status should be 0'
|
79
|
-
step 'the output should contain:', string
|
80
|
-
end
|
data/features/support/aruba.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module CucumberRailsHelper
|
4
|
-
def rails_new(options = {})
|
5
|
-
validate_rails_new_success(run_rails_new_command(options))
|
6
|
-
clear_bundle_env_vars(options[:name])
|
7
|
-
end
|
8
|
-
|
9
|
-
def install_cucumber_rails(*options)
|
10
|
-
add_conditional_gems(options)
|
11
|
-
|
12
|
-
add_gem 'capybara', group: :test
|
13
|
-
add_gem 'selenium-webdriver', '~> 3.11', group: :test
|
14
|
-
add_gem 'rspec-expectations', '~> 3.7', group: :test
|
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)
|
17
|
-
add_gem 'factory_bot', '>= 3.2', group: :test unless options.include?(:no_factory_bot)
|
18
|
-
|
19
|
-
run_command_and_stop 'bundle install'
|
20
|
-
run_command_and_stop 'bundle exec rails webpacker:install' if rails6?
|
21
|
-
run_command_and_stop 'bundle exec rails generate cucumber:install'
|
22
|
-
end
|
23
|
-
|
24
|
-
def add_gem(name, *args)
|
25
|
-
line = convert_gem_opts_to_string(name, *args)
|
26
|
-
gem_regexp = /gem ["']#{name}["'].*$/
|
27
|
-
gemfile_content = File.read(expand_path('Gemfile'))
|
28
|
-
|
29
|
-
if gemfile_content&.match?(gem_regexp)
|
30
|
-
updated_gemfile_content = gemfile_content.gsub(gem_regexp, line)
|
31
|
-
overwrite_file('Gemfile', updated_gemfile_content)
|
32
|
-
else
|
33
|
-
append_to_file('Gemfile', line)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def run_rails_new_command(options)
|
40
|
-
options[:name] ||= 'test_app'
|
41
|
-
flags = '--skip-bundle --skip-test-unit --skip-spring --skip-bootsnap'
|
42
|
-
flags += ' --skip-webpack-install' if rails6?
|
43
|
-
run_command "bundle exec rails new #{options[:name]} #{flags} #{options[:args]}"
|
44
|
-
end
|
45
|
-
|
46
|
-
def validate_rails_new_success(result)
|
47
|
-
expect(result).to have_output(/README/)
|
48
|
-
expect(last_command_started).to be_successfully_executed
|
49
|
-
end
|
50
|
-
|
51
|
-
def clear_bundle_env_vars(dir)
|
52
|
-
cd dir
|
53
|
-
delete_environment_variable 'RUBYOPT'
|
54
|
-
delete_environment_variable 'BUNDLE_BIN_PATH'
|
55
|
-
delete_environment_variable 'BUNDLE_GEMFILE'
|
56
|
-
end
|
57
|
-
|
58
|
-
def rails6?
|
59
|
-
`bundle exec rails -v`.start_with?('Rails 6')
|
60
|
-
end
|
61
|
-
|
62
|
-
def add_conditional_gems(options)
|
63
|
-
if options.include?(:not_in_test_group)
|
64
|
-
add_gem 'cucumber-rails', path: File.expand_path('.').to_s
|
65
|
-
else
|
66
|
-
add_gem 'cucumber-rails', group: :test, require: false, path: File.expand_path('.').to_s
|
67
|
-
end
|
68
|
-
|
69
|
-
if rails6?
|
70
|
-
add_gem 'sqlite3', '~> 1.4'
|
71
|
-
else
|
72
|
-
add_gem 'sqlite3', '~> 1.3.13'
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def convert_gem_opts_to_string(name, *args)
|
77
|
-
options = args.last.is_a?(Hash) ? args.pop : {}
|
78
|
-
parts = ["'#{name}'"]
|
79
|
-
parts << args.map(&:inspect) if args.any?
|
80
|
-
parts << options.inspect[1..-2] if options.any?
|
81
|
-
new_parts = parts.flatten.map { |part| part.gsub(/:(\w+)=>/, '\1: ') }
|
82
|
-
"gem #{new_parts.join(', ')}\n"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
World(CucumberRailsHelper)
|
data/features/support/env.rb
DELETED
data/features/support/hooks.rb
DELETED
data/gemfiles/rails_5_0.gemfile
DELETED
data/gemfiles/rails_5_1.gemfile
DELETED
data/gemfiles/rails_5_2.gemfile
DELETED
data/gemfiles/rails_6_0.gemfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
<%= embed_file('support/edit_warning.txt') %>
|
2
|
-
require 'rubygems'
|
3
|
-
require 'spork'
|
4
|
-
|
5
|
-
Spork.prefork do
|
6
|
-
<%= embed_template('support/_rails_prefork.rb.erb', ' ') %>
|
7
|
-
|
8
|
-
<%= embed_file("support/capybara.rb", ' ') %>
|
9
|
-
end
|
10
|
-
|
11
|
-
Spork.each_run do
|
12
|
-
<%= embed_template('support/_rails_each_run.rb.erb', ' ') %>
|
13
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
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'
|
7
|
-
require 'cucumber/rails/database'
|
8
|
-
|
9
|
-
describe Cucumber::Rails::Database do
|
10
|
-
before { allow(strategy_type).to receive(:new).and_return(strategy) }
|
11
|
-
|
12
|
-
let(:strategy) { instance_double(strategy_type, before_js: nil, before_non_js: nil) }
|
13
|
-
let(:strategy_type) { Cucumber::Rails::Database::TruncationStrategy }
|
14
|
-
|
15
|
-
context 'when using a valid pre-determined strategy' do
|
16
|
-
before { described_class.javascript_strategy = :truncation }
|
17
|
-
|
18
|
-
it 'forwards a `before_non_js` event to the selected strategy' do
|
19
|
-
expect(strategy).to receive(:before_non_js)
|
20
|
-
|
21
|
-
described_class.before_non_js
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'forwards a `before_js` event to the selected strategy' do
|
25
|
-
expect(strategy).to receive(:before_js)
|
26
|
-
|
27
|
-
described_class.before_js
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'when using an invalid pre-determined strategy' do
|
32
|
-
it 'raises an error if you use a non-understood strategy' do
|
33
|
-
expect { described_class.javascript_strategy = :invalid }
|
34
|
-
.to raise_error(Cucumber::Rails::Database::InvalidStrategy)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'when using a valid custom strategy' do
|
39
|
-
before { described_class.javascript_strategy = strategy_type }
|
40
|
-
|
41
|
-
let(:strategy_type) do
|
42
|
-
Class.new do
|
43
|
-
def before_js
|
44
|
-
# Anything
|
45
|
-
end
|
46
|
-
|
47
|
-
def before_non_js
|
48
|
-
# Likewise
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'forwards a `before_non_js` event to the strategy' do
|
54
|
-
expect(strategy).to receive(:before_non_js)
|
55
|
-
|
56
|
-
described_class.before_non_js
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'forwards a `before_js` event to the strategy' do
|
60
|
-
expect(strategy).to receive(:before_js)
|
61
|
-
|
62
|
-
described_class.before_js
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
context 'when using an invalid custom strategy' do
|
67
|
-
let(:invalid_strategy) { Class.new }
|
68
|
-
|
69
|
-
it 'raises an error if the strategy does not have a valid interface' do
|
70
|
-
expect { described_class.javascript_strategy = invalid_strategy }
|
71
|
-
.to raise_error(ArgumentError)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|