From 1b92f094d10f0884393761458996162c97b6c82b Mon Sep 17 00:00:00 2001 From: Buck Doyle Date: Sun, 28 Jul 2024 00:05:04 -0500 Subject: [PATCH] Add Graphiti setup for Guard Thanks to @Samsinite for sharing the fix here: https://github.com/graphiti-api/guard-rspec-graphiti/issues/3#issue-637891061 --- waydowntown/waydowntown_server/Gemfile | 1 + waydowntown/waydowntown_server/Gemfile.lock | 4 ++++ waydowntown/waydowntown_server/Guardfile | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/waydowntown/waydowntown_server/Gemfile b/waydowntown/waydowntown_server/Gemfile index b92fb6c7..12e5f136 100644 --- a/waydowntown/waydowntown_server/Gemfile +++ b/waydowntown/waydowntown_server/Gemfile @@ -47,6 +47,7 @@ group :development, :test do gem 'guard' gem 'guard-rspec', require: false + gem 'guard-rspec-graphiti', require: false end group :development do diff --git a/waydowntown/waydowntown_server/Gemfile.lock b/waydowntown/waydowntown_server/Gemfile.lock index 0a199d9b..da444d76 100644 --- a/waydowntown/waydowntown_server/Gemfile.lock +++ b/waydowntown/waydowntown_server/Gemfile.lock @@ -154,6 +154,9 @@ GEM guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) + guard-rspec-graphiti (1.0.1) + graphiti + guard-rspec i18n (1.14.5) concurrent-ruby (~> 1.0) io-console (0.7.2) @@ -360,6 +363,7 @@ DEPENDENCIES graphiti_spec_helpers guard guard-rspec + guard-rspec-graphiti kaminari (~> 1.1) pg (~> 1.5) puma (>= 5.0) diff --git a/waydowntown/waydowntown_server/Guardfile b/waydowntown/waydowntown_server/Guardfile index 88532804..47097eef 100644 --- a/waydowntown/waydowntown_server/Guardfile +++ b/waydowntown/waydowntown_server/Guardfile @@ -69,4 +69,14 @@ guard :rspec, cmd: 'bundle exec rspec' do # rubocop:disable Metrics/BlockLength watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' end + + # Needed for inflections used by Guard::RSpec::Graphiti + # https://github.com/graphiti-api/guard-rspec-graphiti/issues/3#issue-637891061 + require 'active_support' + require 'guard/rspec/graphiti/dsl' + require 'active_support/core_ext/string/inflections' + graphiti = Guard::RSpec::Graphiti::Dsl.new(self, dsl) + + graphiti.watch_resources + graphiti.watch_models end