Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Test your examples!
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib initial commit
test
.gitignore
Gemfile
README.md
Rakefile
testable_examples.gemspec

README.md

Testable Examples

Run your rdoc examples like they are tests!

How to

In your rdoc, you might have something like this

# Example:
#   Test1.new.add(1, 2)
#   => 3
#   Test1.new.add(1, "something")
#   => TypeError: String can't be coerced into Fixnum
def add(num1, num2)
  num1 + num2
end

With testable examples, simply add this to your Rakefile

desc "test_examples"
task :test do
  $: << 'lib'
  require 'testable_examples'
  TestableExamples::Runner.new(:dir => 'lib', :include_path => 'lib', :requires => 'test1').run_examples
end

And you will now be able to validate these!

TODO

So much, this is really just a proof-of-concept.

Something went wrong with that request. Please try again.