Sha256: e780030fe63df1809ffafad3cd92ec207b6fe3091983d00f30232738e4826d7f

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

= yard-rspec_examples

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-rspec_examples

== Description

This plugin simply includes an example tag and recreates it with the source code that corresponds
to the first example included in the describe blocks below.
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

Another usage is to pass the example's name to the tag:

  class Foo
    ##
    # This is a foo method with an example
    # @rspec_example works this way
    def foo_method
    end
  end




== Using it

In order to use it, you just have to add the --plugin param plus yours

  yardoc --plugin yar-rspec_examples [OPTS]


== Copyright
Copyright (c) 2011 Jose Fernandez (magec). See LICENSE.txt for
further details.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yard-rspec_examples-0.0.1 README.rdoc