minispec.cr
minispec.cr
Crystal spec framework with the same syntax as Ruby minitest.
Usage
In shard.yml
development_dependencies:
minispec:
github: pyer/minispec.cr
branch: main
In spec files
require "minispec"
Run your tests with crystal spec.
Tests
testpending
Assertions
assertassert_equalassert_raiserefute
Before/After blocks
If you need to run code before or after each test, declare each block like in the example below.
before do
# First block to be executed
end
after do
# Third and last block to be executed
end
test "executes the before, test and after blocks" do
# Second block to be executed
end
Example
require "minispec"
before do
# to be executed before each test
end
after do
# to be executed after each test
end
test "true assertion" do
assert true
end
test "equality" do
assert_equal 1.to_s, "1"
end
test "exception" do
assert_raise Exception do
raise Exception.new("Boom!")
end
end
pending "to do" do
# work in progress
end
Repository
minispec.cr
Owner
Statistic
- 0
- 0
- 0
- 1
- 0
- about 3 hours ago
- September 30, 2026
License
MIT License
Links
Synced at
Wed, 30 Sep 2026 20:24:08 GMT
Languages