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 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:
최근 이 문제를 우연히 발견했습니다. 필요한 확장 기능이 어떻게 설정되는지 아래에 공유합니다:
RSpec.describe "Core features" do
+ SiteSetting.theme_authorized_extensions = "js|css"
before { upload_theme_or_component }
it_behaves_like "having working core features"
end