{"id":15693608,"url":"https://github.com/marioruiz/create_tests","last_synced_at":"2025-05-08T04:45:19.883Z","repository":{"id":62556375,"uuid":"173470702","full_name":"MarioRuiz/create_tests","owner":"MarioRuiz","description":"Create Tests automatically from a Requests file. Perfect to be used with the result from importing a Swagger file using the open_api_import gem. Now we are supporting RSpec.","archived":false,"fork":false,"pushed_at":"2023-07-04T13:25:10.000Z","size":42,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-08T04:44:50.319Z","etag":null,"topics":["create","openapi","requests","rspec","ruby","swagger","swagger2","swagger3","tests"],"latest_commit_sha":null,"homepage":null,"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/MarioRuiz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-02T16:21:27.000Z","updated_at":"2023-11-07T19:07:57.000Z","dependencies_parsed_at":"2024-10-24T01:15:02.479Z","dependency_job_id":"be0f58c5-7ad2-48c9-8d81-9ad1e8a476e3","html_url":"https://github.com/MarioRuiz/create_tests","commit_stats":{"total_commits":28,"total_committers":2,"mean_commits":14.0,"dds":0.3214285714285714,"last_synced_commit":"5ccfb5589253bf0afb8439c219fe40f8840cb2cc"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarioRuiz%2Fcreate_tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarioRuiz%2Fcreate_tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarioRuiz%2Fcreate_tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarioRuiz%2Fcreate_tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarioRuiz","download_url":"https://codeload.github.com/MarioRuiz/create_tests/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253002844,"owners_count":21838637,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["create","openapi","requests","rspec","ruby","swagger","swagger2","swagger3","tests"],"created_at":"2024-10-03T18:46:28.854Z","updated_at":"2025-05-08T04:45:19.847Z","avatar_url":"https://github.com/MarioRuiz.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CreateTests\n\n[![Gem Version](https://badge.fury.io/rb/create_tests.svg)](https://rubygems.org/gems/create_tests)\n[![Build Status](https://travis-ci.com/MarioRuiz/create_tests.svg?branch=master)](https://github.com/MarioRuiz/create_tests)\n[![Coverage Status](https://coveralls.io/repos/github/MarioRuiz/create_tests/badge.svg?branch=master)](https://coveralls.io/github/MarioRuiz/create_tests?branch=master)\n![Gem](https://img.shields.io/gem/dt/create_tests)\n![GitHub commit activity](https://img.shields.io/github/commit-activity/y/MarioRuiz/create_tests)\n![GitHub last commit](https://img.shields.io/github/last-commit/MarioRuiz/create_tests)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/MarioRuiz/create_tests)\n\n\nCreate Tests automatically from a Requests file. Perfect to be used with the result from importing a Swagger file using the open_api_import gem. Now we are supporting RSpec.\n\nMore info about the Request Hashes: https://github.com/MarioRuiz/Request-Hash\n\nIf you want to know how to import Swagger / Open API files in just a couple of seconds and transform them into Request Ruby Hashes: https://github.com/MarioRuiz/open_api_import\n\nWe strongly recommend to use nice_http gem for your tests: https://github.com/MarioRuiz/nice_http\n\n\n## Installation\n\nInstall it yourself as:\n\n    $ gem install create_tests\n\n\nTake in consideration create_tests gem is using the 'rufo' gem that executes in command line the `rufo` command. In case you experience any trouble with it, visit: https://github.com/ruby-formatter/rufo\n\n## Usage\n\nAfter installation you can run using command line executable or just from Ruby.\n\nThe execution will create an spec folder where you will have all the RSpec tests. Also it will be added to that file a `helper.rb` file.\n\nAlso a `settings` folder that will contain a `general.rb` file that will be required by the tests.\n\n### Executable\n\nFor help and see the options, run in command line / bash: `create_tests -h`\n\nExample: \n```bash\n create_tests ./requests/uber.yaml.rb\n```\n\n### Ruby file\nWrite your ruby code on a file and in command line/bash: `ruby my_file.rb`\n\nThis is an example:\n\n```ruby\n  require 'create_tests'\n  \n  CreateTests.from \"./requests/uber.yaml.rb\"\n\n```\n\n## Example\n\nOn this example we will be creating tests for the Uber API using the Swagger / Open API file.\n\n1. Create a folder in your computer called for example `create_tests_example`\n\n2. Copy the file that we have on `./example/requests/uber.yaml` into a folder called `requests` inside `create_tests_example folder`.\n\n3. First we will convert this Swagger file into Requests Hashes by running from `create_tests_example` folder:\n```bash\nopen_api_import ./requests/uber.yaml -fT\n```\nNow all the Request files were created on the `requests` folder:\n```\n** Generated files that contain the code of the requests after importing the Swagger file: \n  - requests/uber.yaml_Products.rb\n  - requests/uber.yaml_Estimates.rb\n  - requests/uber.yaml_User.rb\n** File that contains all the requires for all Request files: \n   - requests/uber.yaml.rb \n```\n\n4. Now we will create the tests by running:\n```bash\ncreate_tests ./requests/uber.yaml.rb\n```\n\n5. All your tests will be on `spec` folder, and a `general.rb` file inside `settings` folder was created and also take a look at your `helper.rb` file on `spec` folder.\n```\n- Logs: ./requests/uber.yaml.rb_create_tests.log\n** Pay attention, if any of the test files exist or the help file exist only will be added the tests, methods that are missing.\n- Settings: ./settings/general.rb\n- Test created: ./spec/User/profile_user_spec.rb\n- Test created: ./spec/User/activity_user_spec.rb\n- Test created: ./spec/Products/list_products_spec.rb\n- Test created: ./spec/Estimates/price_estimates_spec.rb\n- Test created: ./spec/Estimates/time_estimates_spec.rb\n- Helper: ./spec/helper.rb\n```\n\nYou can see a reproduction of what we did before on here: https://github.com/MarioRuiz/create_tests/tree/master/example\n\n## Parameters\n\nThe parameters can be supplied alone or with other parameters. In case a parameter is not supplied then it will be used the default value.\n\n### mode\n\nAccepts three different options: :overwrite, :dont_overwrite and :append. By default :append. \n\n  append: In case the test file already exists will be only adding those tests that are missing from that file. If the test file doesn't exist, will be created and added all tests.\n\n  dont_overwrite: In case the test file exists any change will be done. If it doesn't exist then it will be created.\n\n  overwrite: In case the file exist you will loose the current code and a new code will be created. Take in consideration that all previous content will be deleted.\n  If it doesn't exist the test file then it will be created.\n\n```ruby\n  require 'create_tests'\n\n  CreateTests.from \"./requests/uber.yaml.rb\", mode: :overwrite\n\n```\n\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/marioruiz/create_tests.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarioruiz%2Fcreate_tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarioruiz%2Fcreate_tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarioruiz%2Fcreate_tests/lists"}