From 93dba9267f877f5e9c7b65d026c53a6cf2b613c2 Mon Sep 17 00:00:00 2001 From: Jon Palmer <328224+jonspalmer@users.noreply.github.com> Date: Sat, 27 May 2023 12:39:51 -0400 Subject: [PATCH] Fix #169 write_stories_json tries too write non stories files --- docs/configuration.md | 2 +- lib/view_component/storybook/collections/stories_collection.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/configuration.md b/docs/configuration.md index 043d4e6..c188a0b 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -23,7 +23,7 @@ Other environments, such as production, require equivalent configuration. ## Stories Path -Story classes live in `test/components/stories`, which can be configured using the `stories_path` setting. For example to use RSpec set the following configuration: +Story classes live in `test/components/stories`, which can be configured using the `stories_paths` setting. For example to use RSpec set the following configuration: ```ruby # config/application.rb diff --git a/lib/view_component/storybook/collections/stories_collection.rb b/lib/view_component/storybook/collections/stories_collection.rb index f2d7972..b7f6022 100644 --- a/lib/view_component/storybook/collections/stories_collection.rb +++ b/lib/view_component/storybook/collections/stories_collection.rb @@ -16,6 +16,8 @@ def load(code_objects) def self.stories_from_code_object(code_object) klass = code_object.path.constantize + return unless stories_class?(klass) + klass.code_object = code_object klass end