rspec-side_effects alternatives and similar gems
Based on the "Extra" category.
Alternatively, view rspec-side_effects alternatives based on common mentions on social networks and blogs.
-
vcr
Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests. -
Parallel Tests
Ruby: 2 CPUs = 2x Testing Speed for RSpec, Test::Unit and Cucumber -
timecop
A gem providing "time travel", "time freezing", and "time acceleration" capabilities, making it simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call. -
mutant
Automated code reviews via mutation testing - semantic code coverage. -
Appraisal
A Ruby library for testing your library against different versions of dependencies. -
Ruby-JMeter
A Ruby based DSL for building JMeter test plans -
Knapsack
Knapsack splits tests evenly across parallel CI nodes to run fast CI build and save you time. -
Wrong
Wrong provides a general assert method that takes a predicate block. Assertion failure messages are rich in detail.
Free Global Payroll designed for tech teams
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of rspec-side_effects or a related project?
README
Rspec::SideEffects
RSpec extension for checking the side effects of your specifications.
Installation
Add this line to your application's Gemfile:
gem 'rspec-side_effects'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rspec-side_effects
Usage
This gem is intended to replace explicitly calling the subject before checking its side effects. It might be used when testing things like:
- method which works directly with a database
- method which works directly with a file system
- method which only integrates mocked objects
There are several aliases for it_has_side_effects_are which can be used to communicate different things to the reader.
subject { test_class.test }
its_side_effects_are do
# Check a side effect, such as writing to the file system.
# Check a have_received expectation
end
Or leave out the block and only check expectations which are already setup.
subject { test_class.test }
before do
# Setup an expecation for the method call
end
end
it_has_side_effects
Both of these examples are testing methods where you do not care about the return value. When you do care about the return value and the side effects, you can do that too.
subject { test_class.test }
it { is_expected.to eq(:result) }
its_side_effects_are do
# Check a side effect, such as writing to the file system.
# Check a have_received expectation
end
Exceptions are also rescued by the helper, so you can still check side effects which also expecting an exception to be raised.
subject { test_class.test }
it { expect { subject }.to raise_error(StandardError) }
its_side_effects_are do
# Check what might have happened before the exception.
# Or confirm things which should not have happend with an error.
end
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Elsewhere on the web
Links to other places on the web where this projects exists:
Contributing
See [CONTRIBUTING](CONTRIBUTING.md) for how you can contribute changes back into this project.
Acknowledgments
Copyright 2019 SugarCRM Inc., released under the Apache2 License.
*Note that all licence references and agreements mentioned in the rspec-side_effects README section above
are relevant to that project's source code only.