mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 06:15:28 +08:00
427d54b2b0
Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains. We no longer need to use Rails "require_dependency" anywhere and instead can just use standard Ruby patterns to require files. This is a far reaching change and we expect some followups here.
56 lines
1.3 KiB
Ruby
56 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe Plugin::Metadata do
|
|
context "parse" do
|
|
it "correctly parses plugin info" do
|
|
metadata = Plugin::Metadata.parse <<TEXT
|
|
# name: plugin-name
|
|
# about: about: my plugin
|
|
# version: 0.1
|
|
# authors: Frank Zappa
|
|
# url: http://discourse.org
|
|
# required version: 1.3.0beta6+48
|
|
|
|
some_ruby
|
|
TEXT
|
|
|
|
expect(metadata.name).to eq("plugin-name")
|
|
expect(metadata.about).to eq("about: my plugin")
|
|
expect(metadata.version).to eq("0.1")
|
|
expect(metadata.authors).to eq("Frank Zappa")
|
|
expect(metadata.url).to eq("http://discourse.org")
|
|
expect(metadata.required_version).to eq("1.3.0beta6+48")
|
|
end
|
|
end
|
|
|
|
def official(name)
|
|
metadata = Plugin::Metadata.parse <<TEXT
|
|
# name: #{name}
|
|
TEXT
|
|
|
|
expect(metadata.official?).to eq(true)
|
|
end
|
|
|
|
def unofficial(name)
|
|
metadata = Plugin::Metadata.parse <<TEXT
|
|
# name: #{name}
|
|
TEXT
|
|
|
|
expect(metadata.official?).to eq(false)
|
|
end
|
|
|
|
it "correctly detects official vs unofficial plugins" do
|
|
official("customer-flair")
|
|
official("discourse-adplugin")
|
|
official("discourse-akismet")
|
|
official("discourse-backup-uploads-to-s3")
|
|
official("discourse-cakeday")
|
|
official("Canned Replies")
|
|
official("discourse-data-explorer")
|
|
unofficial("babble")
|
|
end
|
|
|
|
end
|