Testaroni
🍕 a fun and simple testing framework for ruby code.
Installation
gem install testaroni
Example
file: my_test.rb
require 'testaroni'
test "Make sure my value is equal" do
value = 100
make_sure(value).equals(100)
end
test "Make sure my value is not equal" do
value = 200
make_sure(value).is_not(100)
endruby my_test.rb
Output:
🍕 Running tests now!
✅ Test passed
✅ Test passedCLI Command
You can run testaroni in a project and it will look for a /tests folder and run all ruby files inside.
Basic Assertions
The basic assertions you can use are make_sure which takes a value and then gets access to sub methods equals/is_not
make_sure(1).equals(1)make_sure(1).is_not(2)Should
You can use the should keyword to get access to file helper methods. for example
should { have "app.rb" }
this will make sure the project contains a certain file.
Details
Testaroni is simple and basic, nothing fancy just enough to make testing work. For me this is perfect.
It allows certain things other libraries don't like. for example
order dependent tests. I know this a bad way of design but what If. I just want my test to read like a long script that performs a simulated task and test it all the way long then being able to write a test class with multiple tests and run it in order is perfectly reasonable.
How to use
-
create a ruby file and include testaroni gem
-
write your first test using the test keyword and passing a string to describe the test and a block
-
use the make_sure keyword to start your test evaluation.
-
pass a value to make_sure then you can use one of the evaluation helpers
-
use the equals or is_not keyword for evaluation
-
run the file in terminal