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

**URL:** https://meta.discourse.org/t/new-core-features-system-specs-in-plugins-and-themes/361381
**Category:** Development
**Tags:** dev-news
**Created:** [2025年四月11日 08:43 UTC](https://meta.discourse.org/t/new-core-features-system-specs-in-plugins-and-themes/361381 "2025-04-11T08:43:29Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![loic](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/loic/32/105621_2.png) [@loic](https://meta.discourse.org/u/loic)
#### Post date: [2025年四月11日 08:43 UTC](https://meta.discourse.org/t/new-core-features-system-specs-in-plugins-and-themes/361381/1 "2025-04-11T08:43:29Z")

</div>

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

这些规范可确保您正在开发的插件或主题不会破坏 Discourse 的基本功能。

为现有插件或主题添加这些规范非常简单：

_对于插件_

```rb
# 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

```

_对于主题_

```rb
# 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 的基本功能，则可以跳过核心功能规范中的某些示例：

```rb
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

---

_[View the full topic](https://meta.discourse.org/t/new-core-features-system-specs-in-plugins-and-themes/361381)._
