jnicklas/turnip — pull request #65 by lukaso (2012-08-11 22:00:53+00:00)
Title: Support for classes in describe -- especially useful for rspec-rails type tests

This patch is an experiment to allow feature files to specify a class and type. Let me know what you think and if I'm going in the right direction.

This means that Turnip can run exactly the same tests as rspec-rails.

NOTE: The motivation for this: we use Gherkin to document all business rules, not just for integration tests. In order to limit the code under test, it's desirable to just test the business rule whereever it appears, so in a model, helper, or controller and rspec-rails has specific support for setting up those tests.

With a feature file:

```
@describe SomeController, {:type => :controller}
Feature: A feature for describe
@describe_feature
Scenario: This is a simple describe feature
Given foo
When bar
Then baz
```

this creates an rspec:

```
describe SomeController, :type => :controller do

end
```

for that test.

This is helpful if you don't want to have every Turnip test be a black box capybara test.

Has tests that cover the new functionality and all tests passing.

Issues:
* Clobbers the `:type => :turnip`
* Ugly patch on feature files (and not really valid Gherkin)
* Code primarily to prove concept, though tests are passing. Has also been used on a Rails app and correct ControllerExampleGroup was picked up.
* Does this work in all cases?

Ideally TODO:
* Clean up the code a bit, since getting messy.
* Document the functionality in README.markdown.
* Run in production environment.