First Story (Ruby)
Minitest example
Section titled “Minitest example”Create a test file such as test/login_test.rb:
require "minitest/autorun"require "executable_stories/minitest"
class LoginTest < Minitest::Test def test_user_logs_in_successfully story = ExecutableStories.init("user logs in successfully")
story.given("the user is on the login page") password = "secret"
story.when("the user submits valid credentials")
story.then("the user should see the dashboard") assert_equal true, result endendRSpec example
Section titled “RSpec example”Create a spec file such as spec/login_spec.rb:
require "executable_stories/rspec"
ExecutableStories::RSpecPlugin.install!
RSpec.describe "Login" do story "user logs in successfully" do |s| s.given("the user is on the login page") password = "secret"
s.when("the user submits valid credentials")
s.expect("the user should see the dashboard") do expect(result).to be(true) end endendRun tests
Section titled “Run tests”bundle exec ruby -Ilib -Itest test/login_test.rbOr run your specs:
bundle exec rspecGenerated output
Section titled “Generated output”The raw run JSON can be rendered by executable-stories-formatters. A Markdown report for the examples above will include the scenario title and the Given/When/Then steps.
Ruby story & doc API — steps, docs, and options.
Other adapters — the rest of the repo’s non-JS adapters.