Sha256: 7837601cc27edfa041199260b9c9364be7fa3b3d411fe59e8a6a86503590521a
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
[![Code Climate](https://codeclimate.com/github/doctest/doctest-rspec.png)](https://codeclimate.com/github/doctest/doctest-rspec) [![Build Status](https://travis-ci.org/doctest/doctest-rspec.png)](https://travis-ci.org/doctest/doctest-rspec) # Doctest::RSpec Add [doctests](http://github.com/doctest/doctest-core) to your ruby files and have them executed within a rspec test suite. ## Installation Add this line to your application's Gemfile: gem 'doctest-rspec' And then execute: $ bundle Or install it yourself as: $ gem install doctest-rspec ## Usage Add doctest-formatted tests to your ruby files (see http://github.com/doctest/doctest-core for syntax examples) Add doctest directives to your rspec suite: ```ruby class MyClassWithDoctests # Adds two to a given number # # Usage: # >> m = MyClassWithDoctests.new # >> m.plus_two(3) # => 5 def plus_two(x) 2 + x end end ``` Within the rspec suite: ```ruby require 'doctest/rspec' describe MyClassWithDoctests do doctest MyClassWithDoctests end ``` This will lead to one passing spec. This will parse the given source files for doctest occurrences and add a spec for each instance. ## Alternative Solutions * [rubydoctest](https://github.com/tablatom/rubydoctest), [rdoctest](https://github.com/stephencelis/rdoctest): Serve a very similar purpose. However, they do not integrate into rspec, but provide a custom test runner. ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
doctest-rspec-0.0.3 | README.md |