插件和主题中的新核心功能系统规格

我们刚刚在插件和主题的骨架中加入了我们称之为“烟雾规范”或“核心功能规范”。

这些规范可确保您正在开发的插件或主题不会破坏 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 个赞

IMHO, it would be very handy and helpful to include this detail in

and

… or the link of this topic :slight_smile:

在我看来,将此详细信息包含在

… 或此主题的链接中 :slight_smile: 将非常方便和有用。

2 个赞

这是一个好主意,已经在 DEV: Add short explanations for the core features specs by Flink · Pull Request #52 · discourse/discourse-theme-skeleton · GitHubDEV: Add short explanations for the core features specs by Flink · Pull Request #78 · discourse/discourse-plugin-skeleton · GitHub 中完成 :grin:

1 个赞

如果您的主题需要具有不同的 Theme authorized extensions,所有测试都会失败,因为主题无法加载。