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

We’ve just included what we call smoke specs or core features specs in both skeletons for plugins and themes.

These specs ensure the plugin or the theme you’re working on doesn’t break the basic functionality of Discourse.

It’s easy to add these specs to an existing plugin or theme:

For a plugin

# 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

For a theme

# 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

If you need to update many repositories at once, a script for our mass-pr tool is available.

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
10 个赞

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

and

… or the link of this topic :slight_smile:

2 个赞

That’s a good idea, it’s been done in DEV: Add short explanations for the core features specs by Flink · Pull Request #52 · discourse/discourse-theme-skeleton · GitHub and DEV: Add short explanations for the core features specs by Flink · Pull Request #78 · discourse/discourse-plugin-skeleton · GitHub :grin:

1 个赞

If your theme needs to have a different Theme authorized extensions all tests fail because the theme can’t load.