2019-04-29 20:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-16 02:26:03 -04:00
|
|
|
RSpec.describe AdminPluginSerializer do
|
2023-06-21 10:00:19 -04:00
|
|
|
subject(:serializer) { described_class.new(instance) }
|
2018-05-16 02:26:03 -04:00
|
|
|
|
2023-06-21 10:00:19 -04:00
|
|
|
let(:instance) { Plugin::Instance.new }
|
2018-05-16 02:26:03 -04:00
|
|
|
|
|
|
|
describe "enabled_setting" do
|
|
|
|
it "should return the right value" do
|
|
|
|
instance.enabled_site_setting("test")
|
2023-06-21 10:00:19 -04:00
|
|
|
expect(serializer.enabled_setting).to eq("test")
|
2018-05-16 02:26:03 -04:00
|
|
|
end
|
|
|
|
end
|
2023-06-26 00:39:57 -04:00
|
|
|
|
|
|
|
describe "commit_hash" do
|
|
|
|
it "should return commit_hash and commit_url" do
|
|
|
|
instance = Plugin::Instance.find_all("#{Rails.root}/spec/fixtures/plugins")[0]
|
|
|
|
subject = described_class.new(instance)
|
|
|
|
|
|
|
|
git_repo = instance.git_repo
|
|
|
|
git_repo.stubs(:latest_local_commit).returns("123456")
|
|
|
|
git_repo.stubs(:url).returns("http://github.com/discourse/discourse-plugin")
|
|
|
|
|
|
|
|
expect(subject.commit_hash).to eq("123456")
|
|
|
|
expect(subject.commit_url).to eq("http://github.com/discourse/discourse-plugin/commit/123456")
|
|
|
|
end
|
|
|
|
end
|
2018-05-16 02:26:03 -04:00
|
|
|
end
|