RSpec::Crispy
Custom matchers for RSpec to call Crispy's API.
Installation
Add this line to your application's Gemfile:
gem 'rspec-crispy'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rspec-crispy
Usage
Use with rspec-mocks
Add ::RSpec::Crispy.configure_without_conflict config
in your spec_helper.rb
.
RSpec.configure do|config|
config.mock_with(:rspec)
::RSpec::Crispy.configure_without_conflict config
end
Then, include ::RSpec::Crispy::CrispyFeatures
in a context where you want to use the features.
RSpec.describe YourClass do
subject { YourClass }
context 'use crispy' do
include ::RSpec::Crispy::CrispyFeatures
before do
spy_into subject
subject.new.hoge
end
it { is_expected.to have_received(:foo) }
end
context 'use rspec-mocks' do
subject { spy("rspec's spy") }
before { some_object.some_method(spy) }
it { is_expected.to have_received(:foo) }
end
end
Use only rspec-crispy (without rspec-mocks)
TODO: Write usage instructions here
Available Crispy API
TODO: Write usage instructions here
Contributing
- Fork it ( https://github.com/igrep/rspec-crispy/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
NOTE
- You must use
rake test
to runrspec spec/rspec/crispy/configure_without_conflict_spec.rb
andrspec spec/rspec/crispy/mock_with_rspec_crispy_spec.rb
separately. DO NOT run all specs at once byrspec spec
.