I released My new Gem MarkdownToRspec💎✨
https://rubygems.org/gems/markdown_to_rspec
MarkdownToRspec
converts text in markdown format into text in RSpec
format.
This gem uses RDoc::Markdown
to parse the text in markdown format, generates RDoc::Markup::Document
, and then generates an text in RSpec
format from it.
Usage
$ gem install markdown_to_rspec
for CLI
$ markdown_to_rspec -f `MARKDOWN_FILE_PATH`
#=> return A string in RSpec format
$ markdown_to_rspec -t `MARKDOWN__TEXT`
#=> return A string in RSpec format
for in ruby code
require 'rspec_to_markdown'
markdown = "A string in markdown format"
MarkdownToRspec.to_rspec(markdown)
#=> return A string in RSpec format
Sample
markdown
# Details.
A screen to check something
ref: https://example/com/tickets/1
## Initial Display.
### When a record exists.
* The title must be displayed.
* The text must be displayed.
### When the record does not exist.
* The title should not be displayed.
* The text should not be displayed.
### Other cases.
* 500 pages to be displayed.
# Index.
A screen to check something
## Initial Display.
* The items must be displayed.
converted to RSpec
RSpec.describe 'Details.' do
# A screen to check something
# ref: https://example/com/tickets/1
describe 'Initial Display.' do
context 'When a record exists.' do
it 'The title must be displayed.' do
end
it 'The text must be displayed.' do
end
end
context 'When the record does not exist.' do
it 'The title should not be displayed.' do
end
it 'The text should not be displayed.' do
end
end
context 'Other cases.' do
it '500 pages to be displayed.' do
end
end
end
end
RSpec.describe 'Index.' do
# A screen to check something
describe 'Initial Display.' do
it 'The items must be displayed.' do
end
end
end
Please use it if you like 👋
Top comments (0)