loic
(Loïc Guitaut)
2025 年4 月 11 日 08:43
1
我们刚刚在插件和主题的骨架中加入了我们称之为“烟雾规范”或“核心功能规范”。
这些规范可确保您正在开发的插件或主题不会破坏 Discourse 的基本功能。
为现有插件或主题添加这些规范非常简单:
对于插件
# spec/system/core_features_spec.rb
RSpec.describe "Core features", type: :system do
before { enable_current_plugin }
it_behaves_like "having working core features"
end
对于主题
# spec/system/core_features_spec.rb
RSpec.describe "Core features", type: :system do
before { upload_theme_or_component }
it_behaves_like "having working core features"
end
如果您需要一次更新多个存储库,可以使用我们的 mass-pr 工具提供的脚本。
如果您的插件或主题有意更改 Discourse 的基本功能,则可以跳过核心功能规范中的某些示例:
it_behaves_like "having working core features", skip_examples: %i[login likes]
以下是跳过示例的关键字完整列表:
login
likes
profile
topics
topics:read
topics:reply
topics:create
search
search:quick_search
search:full_page
10 个赞
gormus
(Osman Görmüş)
2025 年5 月 21 日 13:51
2
loic:
If the plugin or the theme you’re working on changes a basic functionality of Discourse on purpose, then it’s possible to skip some of the examples from the core features specs:
it_behaves_like "having working core features", skip_examples: %i[login likes]
Here’s the complete list of keywords for skipping examples:
login
likes
profile
topics
topics:read
topics:reply
topics:create
search
search:quick_search
search:full_page
IMHO, it would be very handy and helpful to include this detail in
# frozen_string_literal: true
# Parts of the core features examples can be skipped like so:
# it_behaves_like "having working core features", skip_examples: %i[login likes]
#
# List of keywords for skipping examples:
# login, likes, profile, topics, topics:read, topics:reply, topics:create,
and
… or the link of this topic
loic:
如果插件或主题有意更改了 Discourse 的基本功能,则可以跳过一些核心功能规范中的示例:
it_behaves_like "having working core features", skip_examples: %i[login likes]
以下是跳过示例的关键字的完整列表:
login
likes
profile
topics
topics:read
topics:reply
topics:create
search
search:quick_search
search:full_page
在我看来,将此详细信息包含在
# frozen_string_literal: true
# Parts of the core features examples can be skipped like so:
# it_behaves_like "having working core features", skip_examples: %i[login likes]
#
# List of keywords for skipping examples:
# login, likes, profile, topics, topics:read, topics:reply, topics:create,
和
… 或此主题的链接中 将非常方便和有用。
2 个赞
pfaffman
(Jay Pfaffman)
2025 年5 月 23 日 19:20
4
如果您的主题需要具有不同的 Theme authorized extensions,所有测试都会失败,因为主题无法加载。