discourse/spec/lib/git_repo_spec.rb
Vinoth Kannan 52894b9d7c
FEATURE: display commit hash for each plugin on /admin/plugins page. (#22176)
It will help to find out the current version of the plugins even without the `docker_manager` plugin.
2023-06-26 10:09:57 +05:30

18 lines
663 B
Ruby

# frozen_string_literal: true
RSpec.describe GitRepo do
let(:git_repo) { GitRepo.new("/tmp", "discourse") }
it "returns the correct URL" do
Discourse::Utils.stubs(:execute_command).returns("https://github.com/username/my_plugin.git")
expect(git_repo.url).to eq("https://github.com/username/my_plugin")
Discourse::Utils.stubs(:execute_command).returns("git@github.com/username/my_plugin.git")
expect(git_repo.url).to eq("https://github.com/username/my_plugin")
end
it "returns the correct commit hash" do
Discourse::Utils.expects(:execute_command).returns("123456")
expect(git_repo.latest_local_commit).to eq("123456")
end
end