{"id":19142193,"url":"https://github.com/eldoy/futest","last_synced_at":"2026-06-04T16:31:08.247Z","repository":{"id":56847911,"uuid":"75981654","full_name":"eldoy/futest","owner":"eldoy","description":"Program your tests as flexible scripts without dependencies and rules.","archived":false,"fork":false,"pushed_at":"2017-01-06T00:50:53.000Z","size":55,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-20T16:09:37.915Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eldoy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-08T22:48:40.000Z","updated_at":"2022-06-04T21:57:56.000Z","dependencies_parsed_at":"2022-09-22T14:24:24.407Z","dependency_job_id":null,"html_url":"https://github.com/eldoy/futest","commit_stats":null,"previous_names":["fugroup/futest"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eldoy/futest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Ffutest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Ffutest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Ffutest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Ffutest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldoy","download_url":"https://codeload.github.com/eldoy/futest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Ffutest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33914543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T07:26:16.801Z","updated_at":"2026-06-04T16:31:08.225Z","avatar_url":"https://github.com/eldoy.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Futest flexible testing for Ruby\n\nTest driven development has never been easier. If you like to write scripts instead of tests, and not worry about how your testing framework works, then Futest will give you exactly what you need.\n\nIf you're using MongoDB, check out [Minimongo,](https://github.com/fugroup/minimongo) it goes hand in hand with Futest and is super easy to use.\n\n### Installation\n```\ngem install futest\n```\nor add to Gemfile. In your tests include the line\n```ruby\ninclude Futest::Helpers\n```\nand you're good to go.\n\n### Settings\n```ruby\n# The command to run when you use 'show' to show the @body from the last pull.\n# The default is for MacOs. The -g flag opens the page in the background.\nFutest.show = 'open -g'\n\n# Mode, default is development\nFutest.mode = ENV['RACK_ENV'] || 'development'\n\n# Debug\nFutest.debug = false\n```\n\n### Commands\n- **test:** Takes a message and optional setup methods, then prints the message and current line number.\n- **stop:** Stop test and print message along with line number.\n- **is:** Checks if something is true and stops if it isn't. See the usage section below.\n- **pull:** Pulls a URL and expose varibles with info you can use.\n- **show:** Shows the body from the last pull in your web browser.\n- **err:** Print formatted exception error message and stops the test.\n\n### Usage\nFor a real-world example with a test runner ready, have a look at [the tests for Futest.](https://github.com/fugroup/futest/tree/master/test)\n```ruby\n# Require futest if not using Bundler\nrequire 'futest'\n\n# Include the Futest helpers in your test runner\ninclude Futest::Helpers\n\n# Run the tests from your app root directory\nruby test/run.rb\n\n# Auto-test with Rerun, Guard or other libraries\nRerun: https://github.com/alexch/rerun\ngem 'rerun'\ngem 'rb-fsevent'\ngem 'terminal-notifier'\n\n# Example command for Rerun, can be added to a shell alias\nbundle exec rerun --dir .,config --pattern '**/*.{rb,ru,yml}' -- ruby test/run.rb\n\n# Use begin to have formatted output on error\nbegin\n\n  # Print string in green\n  test 'Testing Heliocentric Model'\n\n  # Optionally pass setup methods to run as symbols\n  # define setup methods\n  def setup; @hello = 'Welcome to the curve.'; end\n\n  def setup_user\n    @user = User.first\n  end\n\n  test 'Reality', :setup, :setup_user\n  is @user, :a? =\u003e User\n  is @hello, 'Welcome to the flatness.'\n\n  # :eq is default, can be omitted\n  is 'horizon', 'curved'\n  is 1, 1\n  is 1, :eq =\u003e 1\n  is 1, :gt =\u003e 0\n  is 1, :lt =\u003e 2\n  is 1, :a? =\u003e Integer\n\n  # 1 argument is also allowed\n  is 'everything' == 'stories'\n\n  # Use stop to end the test run\n  stop \"Can't process\" if :earth == 'flat'\n\n  # Pass the validated model object to print the error messages\n  @user = User.first\n  @user.name = \"Truth\"\n\n  stop \"Can't believe user\", @user unless @user.save\n\n  # Here are the tests that show how it works\n  # There options are:\n  # :a?, :eq, :lt, :lte, :gt, :gte, :in, :nin, :has\n  s = 'hello'\n  is s, 'hello'\n  is s == 'hello', true\n  is s != 'hello', false\n  is s.start_with?('h'), true\n  is nil, NilClass\n\n  is 1, 1\n  is 1, Integer\n  is 1, :a? =\u003e Integer\n  is 1, :eq =\u003e 1\n  is 1, :lt =\u003e 2\n  is 1, :lte =\u003e 2\n  is 2, :lte =\u003e 2\n  is 2, :gte =\u003e 2\n  is 3, :gte =\u003e 2\n  is 6, :gte =\u003e 2\n  is 1, :in =\u003e [1,2,3]\n  is 5, :nin =\u003e [1,2,3]\n  is({:test =\u003e 1}, :has =\u003e :test)\n\n  # Set up the @host variable to use pull if you want to test requests\n  # The pull format is pull(method = :get, path, params, headers)\n  # Default is :get, but :post, :delete, :update, :patch are supported.\n\n  # You can set the @host globally with $host in stead, or $base for @base\n  # Optionally specify a @base variable to pre-add a path after the @host\n  @base = '/login' # Optional\n  @host = 'http://waveorb.com' # Required\n\n  # URL will be @host + @base, http://waveorb.com/login in this case\n  pull '/login'\n  pull '/login', :duration =\u003e 'long'\n  pull '/login', {:duration =\u003e 'long'}, :pjax =\u003e '1'\n\n  # The pull command exposes these variables for use with tests\n  is @host, 'http://waveorb.com'\n  is @page, :a? =\u003e String\n  is @code, 200\n  is @cookies, :a? =\u003e Hash\n  is @headers, :a? =\u003e Hash\n  is @raw, :a? =\u003e Hash\n  is @history, :a? =\u003e Array\n  is @body, :a? =\u003e String\n\n\n  # # # # # # # # # # # #\n  # Example test with login\n\n  # Post the email and password to the login resource\n  def login\n    pull :post, '/login', :email =\u003e 'vidar@fugroup.net', :password =\u003e 'test'\n  end\n\n  # Print the name of the test, and run the login\n  # Cookies will be sent back automatically, so your login works for the duration of the test\n  test 'Profile', :login\n\n  # Now that we're logged in, we can view the profile page\n  pull '/profile'\n\n  # The show command displays the last @body from the pull in the browser\n  show\n\n  # Now @page, @code, @cookies, @headers, @raw, @history, @body, @url is available\n  is @page, :a? =\u003e String     # =\u003e Actually a RestClient response object\n  is @code, 200\n  is @cookies, :a? =\u003e Hash\n  is @headers, :a? =\u003e Hash\n  is @raw, :a? =\u003e Hash\n  is @history, :a? =\u003e Array\n  is @body, :a? =\u003e String\n  is @url, :a? =\u003e String\n\n  # Check if the HTML contains a string\n  is @body.include?('string')\n\n  # Flexible, many ways to do it.\n  is @body =~ /string/, Integer\n  is @body !~ /string/, false\n  is @body =~ /string/, :ne =\u003e nil\n\nrescue =\u003e x\n  # You can print more information here if you need to debug\n  puts x.message\n  puts x.backtrace\n\n  # Err prints a short backtrace and the line number, then stops the tests.\n  err x\n\n  # Err takes options as symbols\n  err x, :v      # Verbose, prints the full message\n  err x, :vv     # Very verbose, prints the full backtrace as well\nend\n```\n\nCreated and maintained by [Fugroup Ltd.](https://www.fugroup.net) We are the creators of [CrowdfundHQ.](https://crowdfundhq.com)\n\n`@authors: Vidar`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Ffutest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldoy%2Ffutest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Ffutest/lists"}