https://github.com/magec/yard-examples-from-rspec
Yard plugin to include examples in the generated doc through rspec
https://github.com/magec/yard-examples-from-rspec
Last synced: about 1 year ago
JSON representation
Yard plugin to include examples in the generated doc through rspec
- Host: GitHub
- URL: https://github.com/magec/yard-examples-from-rspec
- Owner: magec
- License: mit
- Created: 2011-01-03T11:19:03.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2011-01-03T11:33:01.000Z (over 15 years ago)
- Last Synced: 2025-04-24T06:49:32.024Z (about 1 year ago)
- Language: Ruby
- Homepage: https://github.com/magec
- Size: 93.8 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- License: LICENSE.txt
Awesome Lists containing this project
README
= yard-examples-from-rspec
Yard plugin to include examples in the generated doc through rspec
== Installation
In order to install it you just have to install it gem from gemcutter
gem install yard-examples-from-rspec
== Description
This plugin simply includes an example tag and recreates it with the source code that corresponds to an example called "works this way". This have to be defined inside a describe block called "#method_name" that, in turn, has to be defined in a describe block with the class name, i.e. the regular way people use rspec when testing objects.
So, for example,
Given this source code:
class Foo
##
# This is a foo method with an example
# @rspec_example
def foo_method
end
end
And this spec:
describe Foo do
describe "#foo_method" do
it "works this way" do
this = "is"
# The code that will be included in the example
end
end
end
A result like this is to be expected
class Foo
##
# This is a foo method with an example
# @example
# this = "is"
# # The code that will be included in the example
def foo_method
end
end
== Using it
In order to use it, you just have to add the --plugin param plus yours
yardoc --plugin examples-from-rspec [OPTS]
== Contributing to yard-examples-from-rspec
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
== Copyright
Copyright (c) 2011 Jose Fernandez (magec). See LICENSE.txt for
further details.