From 0f086df12bd3ff15127822128dce7f9699e50536 Mon Sep 17 00:00:00 2001 From: David Cook Date: Wed, 26 Jul 2023 12:06:18 +1000 Subject: [PATCH] Setup StimulusReflex testing [add gem] Surprisingly, the StimulusReflex framework [doesn't have many resources for testing](https://docs.stimulusreflex.com/appendices/testing.html), but thankfully someone's made a gem. --- Gemfile | 1 + Gemfile.lock | 3 +++ spec/reflex_helper.rb | 4 ++++ spec/reflexes/products_reflex_spec.rb | 7 +++++++ 4 files changed, 15 insertions(+) create mode 100644 spec/reflex_helper.rb create mode 100644 spec/reflexes/products_reflex_spec.rb diff --git a/Gemfile b/Gemfile index 6eab0a3447..b0fd553864 100644 --- a/Gemfile +++ b/Gemfile @@ -159,6 +159,7 @@ group :test, :development do gem 'rspec-retry', require: false gem 'rswag-specs' gem 'shoulda-matchers' + gem 'stimulus_reflex_testing' gem 'timecop' end diff --git a/Gemfile.lock b/Gemfile.lock index 8b2d96200f..f2cb0b2d1a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -705,6 +705,8 @@ GEM rack (>= 2, < 4) railties (>= 5.2, < 8) redis (>= 4.0, < 6.0) + stimulus_reflex_testing (0.3.0) + stimulus_reflex (>= 3.3.0) stringex (2.8.6) stripe (8.6.0) swd (1.3.0) @@ -899,6 +901,7 @@ DEPENDENCIES spring-commands-rspec state_machines-activerecord stimulus_reflex (= 3.5.0.rc3) + stimulus_reflex_testing stringex (~> 2.8.5) stripe timecop diff --git a/spec/reflex_helper.rb b/spec/reflex_helper.rb new file mode 100644 index 0000000000..4f36f3b6f8 --- /dev/null +++ b/spec/reflex_helper.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +require "base_spec_helper" +require "stimulus_reflex_testing/rspec" diff --git a/spec/reflexes/products_reflex_spec.rb b/spec/reflexes/products_reflex_spec.rb new file mode 100644 index 0000000000..a19076a378 --- /dev/null +++ b/spec/reflexes/products_reflex_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require "reflex_helper" + +describe ProductsReflex, type: :reflex do + +end