cavalle / steak

DISCONTINUED - The delicious combination of RSpec and Capybara for Acceptance BDD
MIT License
763 stars 32 forks source link

Ticket/Issue Information in Feature #24

Closed trans closed 13 years ago

trans commented 13 years ago

I've been experimenting with testing dsls and ended up with something very much like Steak. But I had a couple of additional ideas, so I thought I might share them. Perhaps you will want to incorporate them into Steak. I'll divided them up into a few issues. This issue will cover the first idea.

Allow for Ticket/Issue information in a feature definition. It could be something like:

feature "Subtraction" do

  number 2

  url "http://..."

  description %{
    The Calculator class should support subtraction.
  }

  background do
    calculator = Calculator.new
  end

  scenario "subtraction of two numbers" do |a,b,c|
    calculator.push a
    calculator.push b
    calculator.subtract
    calculator.output == c
  end

end

Or perhaps wrap the information in a ticket/issue block:

feature "Subtraction" do

  ticket do
    number 2
    url "http://..."
    description %{
      The Calculator class should support subtraction.
    }
  end

  ...

Though perhaps the description could still remain in the feature block. In any case, the idea here is to be able to more closely link one's issue tracker with testing. In fact, it could be possible to build tools up around this to automatically update tickets via tests and/or scaffold tests via tickets. Of course there is the question of which issue systems to support (I'm thinking of GitHub in my examples), but, using a ticket block especially, these fields could have arbitrary names, or be set by a configuration file, so as to reflect any system.

cavalle commented 13 years ago

RSpec 2 already provides support for metadata which is also available in a Steak feature. You could do something like this:

feature "Subtraction", :ticket => {
  :number => 2,
  :url    => "http://...",
  :description => %{
    The Calculator class should support subtraction.
  }
} do

# ...

Which is quite similar to your proposal. If you still prefer your DSL (which looks a bit nicer) and thinks that it is worth to write an extension, I'd suggest you write a new gem that extends current RSpec metadata functionality.

Anyway, I'd like to keep Steak as simple as possible. In my opinion, for this use case, what RSpec provides is enough.

Cheers!

trans commented 13 years ago

Ah, that will work. Thanks.