Skip to content

Commit

Permalink
Change location of rspec docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mbj committed Nov 27, 2018
1 parent 27acea5 commit 9f586f5
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 50 deletions.
49 changes: 1 addition & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Topics
* [Known Problems](/docs/known-problems.md)
* [Limitations](/docs/limitations.md)
* [Concurrency](/docs/concurrency.md)
* [Rspec Integration](/docs/mutant-rspec.md)

Sponsoring
----------
Expand All @@ -42,41 +43,6 @@ Additionally, the following features where sponsored by organizations:
If your organization is interested in sponsoring a feature, general maintainership or bugfixes, contact
[Markus Schirp](mailto:[email protected]).

Examples
--------

```
cd virtus
# Run mutant on virtus namespace
bundle exec mutant --include lib --require virtus --use rspec Virtus*
# Run mutant on specific virtus class
bundle exec mutant --include lib --require virtus --use rspec Virtus::Attribute
# Run mutant on specific virtus class method
bundle exec mutant --include lib --require virtus --use rspec Virtus::Attribute.build
# Run mutant on specific virtus instance method
bundle exec mutant --include lib --require virtus --use rspec Virtus::Attribute#type
```

Rails
-------

To mutation test Rails models with rspec, comment out ```require 'rspec/autorun'``` from your spec_helper.rb file. Having done so you should be able to use commands like the following:

```sh
RAILS_ENV=test bundle exec mutant -r ./config/environment --use rspec User
```

Passing in RSpec Options
------------------------

**NOTE: Experimental**

You can control some aspects of RSpec using the `SPEC_OPTS` environment variable as usual. If you want mutant to only pay attention to specs in a certain directory, you can run

```sh
SPEC_OPTS="--pattern spec/subdir_only/**/*_spec.rb" bundle exec mutant --use rspec SomeClass
```

Mutation-Operators
------------------

Expand All @@ -85,19 +51,6 @@ The `mutant-meta` is arranged to the AST-Node-Types of parser. Refer to parsers

There is no easy and universal way to count the number of mutation operators a tool supports.

Test-Selection
--------------

Mutation testing is slow. The key to making it fast is selecting the correct set of tests to run.
Mutant currently supports the following built-in strategy for selecting tests/specs:

Mutant uses the "longest rspec example group descriptions prefix match" to select the tests to run.

Example for a subject like `Foo::Bar#baz` it will run all example groups with description prefixes in
`Foo::Bar#baz`, `Foo::Bar` and `Foo`. The order is important, so if mutant finds example groups in the
current prefix level, these example groups *must* kill the mutation.


Neutral (noop) Tests
--------------------

Expand Down
62 changes: 62 additions & 0 deletions docs/mutant-rspec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
mutant-rspec
============

The integration into rspec.

Install `mutant-rspec` and use the `--use rspec` switch in your mutant command line.

```sh
bundle exec mutant --include lib --require 'your_code' --use rspec -- 'YourCode*'
```

Examples
--------

```
cd virtus
# Run mutant on virtus namespace
bundle exec mutant --include lib --require virtus --use rspec Virtus*
# Run mutant on specific virtus class
bundle exec mutant --include lib --require virtus --use rspec Virtus::Attribute
# Run mutant on specific virtus class method
bundle exec mutant --include lib --require virtus --use rspec Virtus::Attribute.build
# Run mutant on specific virtus instance method
bundle exec mutant --include lib --require virtus --use rspec Virtus::Attribute#type
```

Test-Selection
--------------

Mutation testing is slow. The key to making it fast is selecting the correct
set of tests to run. Mutant currently supports the following built-in
strategy for selecting tests/specs:

Mutant uses the "longest rspec example group descriptions prefix match" to
select the tests to run.

Example for a subject like `Foo::Bar#baz` it will run all example groups with
description prefixes in `Foo::Bar#baz`, `Foo::Bar` and `Foo`. The order is
important, so if mutant finds example groups in the current prefix level,
these example groups *must* kill the mutation.

Rails
-------

To mutation test Rails models with rspec, comment out `require 'rspec/autorun'`
from your `spec_helper.rb` file. Having done so you should be able to use
commands like the following:

```sh
RAILS_ENV=test bundle exec mutant -r ./config/environment --use rspec User
```

Passing in RSpec Options
------------------------

**NOTE: Experimental**

You can control some aspects of RSpec using the `SPEC_OPTS` environment variable as usual. If you want mutant to only pay attention to specs in a certain directory, you can run

```sh
SPEC_OPTS="--pattern spec/subdir_only/**/*_spec.rb" bundle exec mutant --use rspec SomeClass
```
4 changes: 2 additions & 2 deletions docs/nomenclature.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ The method used to determine if a specific inserted mutation is covered by tests

Currently mutant supports integrations for:

* rspec (https://rubygems.org/gems/mutant-rspec)
* minitest (https://rubygems.org/gems/mutant-minitest)
* [mutant-rspec](/docs/mutant-rspec.md) for [rspec](https://rspec.info)
* `mutant-minitest` for [minitest](https://github.com/seattlerb/minitest)

## Report

Expand Down

0 comments on commit 9f586f5

Please sign in to comment.