Skip to content

Commit 4ac7459

Browse files
authored
test: Add tests for apply and check / 💎 Add minitest-reporters (#10)
* Colorize minitest output with minitest/pride * `bundle add minitest-reporters` * test: Enable `Minitest::Reporters` * test: Add tests for `apply` and `check` - Create test_mise_install.rb
1 parent f8f9883 commit 4ac7459

3 files changed

Lines changed: 34 additions & 3 deletions

File tree

‎Gemfile‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ source "https://rubygems.org"
66
gemspec
77

88
gem "irb"
9-
gem "rake", "~> 13.0"
10-
gem "minitest", "~> 5.16"
11-
gem "standard", "~> 1.3"
9+
gem "minitest"
10+
gem "minitest-reporters"
11+
gem "rake"
12+
gem "standard"
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

‎test/test_helper.rb‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
require "serverkit/mise"
55

66
require "minitest/autorun"
7+
8+
require "minitest/reporters"
9+
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new

0 commit comments

Comments
 (0)