Ruby story & doc API
The Ruby package exposes the same story model as the rest of the repo, but with framework-native entry points for Minitest and RSpec. Both adapters write the same raw run JSON that executable-stories-formatters consumes.
Minitest
Section titled “Minitest”Use ExecutableStories.init("scenario") inside a normal Minitest test and call the step methods on the returned story object.
story = ExecutableStories.init("user logs in successfully", tags: %w[smoke auth])story.given("the user is on the login page")story.when("the user submits valid credentials")story.then("the user should see the dashboard")Story methods
Section titled “Story methods”given(text)/when(text)/then(text)- BDD keywords with auto-And conversion on repeatand(text)/but(text)- explicit keywords that never auto-convertarrange(text)/act(text)/assert_that(text)- AAA aliasessetup(text)/context(text)- Given aliasesexecute(text)/action(text)- When aliasesverify(text)- Then aliasfn(keyword, text) { ... }- wrap a block and capture durationexpect(text) { ... }- shorthand forfn("Then", text) { ... }
Doc methods
Section titled “Doc methods”note(text, children: nil)tag(*names, children: nil)kv(label, value, children: nil)json(label, value, children: nil)code(label, content, lang: nil, children: nil)table(label, columns, rows, children: nil)link(label, url, children: nil)section(title, markdown, children: nil)mermaid(code, title: nil, children: nil)screenshot(path, alt: nil, children: nil)custom(type, data, children: nil)
Adapter options
Section titled “Adapter options”tags:- array of tags for the storyticket:- string, array, or ticket objects withidand optionalurlmeta:- arbitrary metadata hashtrace_url_template:- template used to generate a trace link when OTel is active
Use ExecutableStories::RSpecPlugin.install! once in your spec setup, then call story("scenario") { |s| ... } inside a describe block.
RSpec.describe "Login" do story "user logs in successfully", tags: %w[smoke auth] do |s| s.given("the user is on the login page") s.when("the user submits valid credentials") s.expect("the user should see the dashboard") do expect(true).to be(true) end endendRSpec examples automatically capture:
titlePathfrom the example group nestingsourceFileandsourceLinefrom RSpec metadatastatusfrom the example outcomestory.meta["rspec"]withfullDescription,description,filePath,lineNumber, andscopedId
The Ruby RSpec adapter preserves the same story API and raw JSON shape as the Minitest path, so the formatter package can render both without special handling.