플러그인과 테마에 새로운 핵심 기능 시스템 사양

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

개인적으로, 이 세부 사항을 아래 위치에 포함하는 것이 매우 유용하고 도움이 될 것 같습니다.

그리고

… 또는 이 토픽의 링크를 포함하는 것도 좋습니다 :slight_smile:

좋은 아이디어네요. DEV: Add short explanations for the core features specs - Pull Request #52%EC%99%80 - discourse/discourse-theme-skeleton - GitHub DEV: Add short explanations for the core features specs - Pull Request #78%EC%97%90%EC%84%9C - discourse/discourse-plugin-skeleton - GitHub 이미 적용된 적이 있습니다 :grin:

테마에 다른 Theme authorized extensions가 필요한 경우, 테마를 로드할 수 없어 모든 테스트가 실패합니다.

최근 이 문제를 우연히 발견했습니다. 필요한 확장 기능이 어떻게 설정되는지 아래에 공유합니다:

RSpec.describe "Core features" do
+ SiteSetting.theme_authorized_extensions = "js|css"
  before { upload_theme_or_component }

  it_behaves_like "having working core features"
end

그건 어렵지 않아요. 내가 어떤 테마로 작업 중이었는지, 아니면 문제를 해결했는지가 궁금하네요! :person_shrugging: