Skip to content

Commit 2605981

Browse files
committed
test: Add tests for apply and check
- Create test_mise_install.rb
1 parent 8210e6c commit 2605981

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# frozen_string_literal: true
2+
3+
require "test_helper"
4+
5+
class Serverkit::Resources::TestMiseInstall < Minitest::Test
6+
ATTRIBUTES = {"name" => "test"}
7+
8+
def setup
9+
@resource = Serverkit::Resources::MiseInstall.new({}, ATTRIBUTES)
10+
end
11+
12+
def test_resource_instance
13+
assert_instance_of Serverkit::Resources::MiseInstall, @resource
14+
end
15+
16+
def test_apply
17+
@resource.stub :run_command, ->(cmd) { cmd } do
18+
assert_equal("mise install test", @resource.apply)
19+
end
20+
end
21+
22+
def test_check
23+
@resource.stub :check_command, ->(cmd) { cmd } do
24+
assert_equal('mise ls test | grep "$(mise latest test)"', @resource.check)
25+
end
26+
end
27+
end

0 commit comments

Comments
 (0)