vmg/redcarpet — pull request #243 by robin850 (2013-05-11 07:54:16+00:00)
Title: Improve the test suite

Hi there,

I propose to improve a bit the test suite. Here are some ideas that I'm working on but I would love to have some feedback:

* [x] **Split the suite into several files** : The test suite is a mess because all renderers are stored in a single test file. I think that we should improve this ; it would be easier for contributors to find where they should write tests.
* [ ] **Use a better way to compare HTML and markdown** : This is where I need your help. :smile: I have a little idea but I'm not sure about the implementation.
I think that we should use something similar to fixtures:

In the test_helper.rb file:
~~~ruby
require 'yaml'

def load_fixture(name)
YAML.load_file("fixtures/#{name}.yml")
end
~~~

A simple render test case
~~~ruby
class FooRenderTest < Test::Unit::TestCase
def setup
@fixture = load_fixture(:foo)
end

def test_bar
fixture = @fixture[__method__]
html_equal(fixture[:html], fixture[:markdown])
end
end
~~~

Located in fixtures/foo.yml
~~~yml
test_bar:
html:

Hello world!

markdown: Hello world!
~~~

__Note__ : I'm aware that this pull request will make blames on the test suite impossible but I wonder if we could improve the organization and simplify additions.