This is an adapter of mocks.cr for spec2.cr.
Make sure, that you have correct versions of spec2
and mocks
in you
shard.yml
in depdendencies
section.
Next, add this to your application's shard.yml
:
dependencies:
spec2-mocks:
github: waterlink/spec2-mocks.cr
version: ~> 0.4
require "spec2-mocks"
This additionally adds before { Mocks.reset }
to each top-level
Spec2.describe
.
expect(person).to have_received(say("hello world"))
expect(person).to receive(say("hello world"))
This uses spec2
's delayed { ... }
feature to verify expectations after the
end of the example.
After cloning the project:
cd spec2-mocks.cr
crystal deps # install dependencies
crystal spec # run specs
Just use normal TDD development style.
- Fork it ( https://github.com/waterlink/spec2-mocks.cr/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- waterlink Oleksii Fedorov - creator, maintainer