Inside your project's directory create a new `spec` folder and add all your _spec_ files inside. _Spec_ files are regular fish files that shall look like `*.spec.fish` and contain your tests.
You can have multiple `spec.fish` files to organize your tests in a per module basis, or you can squash everything into a single file and use describe blocks to separate groups of tests.
# Use -d to enter a friendly description (optional)
function describe_library -d "the grand library"
function before_all
# Optional. Runs only once before all the tests.
end
function after_all
# Optional. Runs only once after all the tests.
end
function before_each
# Optional. Runs once before each test.
end
function after_each
# Optional. Runs once after each test.
end
function it_does_this
# ...
expect $what_I_got --to-equal $what_I_wanted
end
function it_does_that
# ...
expect $a_list --to-contain-all $expected_items
end
# ...
end
# Run tests when this file is sourced.
spec.run $argv
```
## API
As of now, there is only one method you should be aware of, [expect](https://github.com/bpinto/oh-my-fish/blob/master/plugins/fish-spec/expect.fish):
> Assert a list of expected values match an actual value/s.
Under the hood, _expect_ checks an _actual_ value, usually a relevant result from your test unit, is equal to, not equal to, etc., to an _expected_ value, as determined by your test. Below are the list of conditions available to use with `expect`:
`fish-spec` is currently only available bundled with Oh-My-Fish. As the library matures and grows, however, a future guide describing how to export `fish-spec` may be written.