Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/redding/much-factory
An API for generating randomized data.
https://github.com/redding/much-factory
Last synced: about 9 hours ago
JSON representation
An API for generating randomized data.
- Host: GitHub
- URL: https://github.com/redding/much-factory
- Owner: redding
- License: mit
- Created: 2018-06-05T22:25:22.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2021-10-29T19:01:47.000Z (about 3 years ago)
- Last Synced: 2024-10-06T06:42:30.561Z (about 1 month ago)
- Language: Ruby
- Size: 25.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MuchFactory
MuchFactory is an API for generating randomized data. This is intended to be brought into testing environments and used in test runs to help generate randomized test data.
Note: this was originally implemented in and extracted from [Assert](https://github.com/redding/assert).
## Usage
```ruby
require "much-factory"MuchFactory.integer #=> 15742
MuchFactory.integer(3) #=> 2
MuchFactory.float #=> 87.2716908041922
MuchFactory.float(3) #=> 2.5466638138805MuchFactory.date #=> #
MuchFactory.time #=> Wed Sep 07 10:37:22 -0500 2016
MuchFactory.datetime #=> #MuchFactory.string #=> "boxsrbazeq"
MuchFactory.string(3) #=> "rja"
MuchFactory.symbol #=> :sfdhortksj
MuchFactory.symbol(3) #=> :emh
MuchFactory.text #=> "khcwyizmymajfzzxlfwz"
MuchFactory.text(3) #=> "qcy"
MuchFactory.slug #=> "licia"
MuchFactory.slug(3) #=> "luu"
MuchFactory.hex #=> "48797adb33"
MuchFactory.hex(3) #=> "2fe"
MuchFactory.url #=> "/cdqz/hqeq/zbsl"
MuchFactory.email #=> "[email protected]"MuchFactory.file_name #=> "kagahm.ybb"
MuchFactory.path #=> "jbzf/omyk/vbha"
MuchFactory.dir_path #=> "fxai/lwnq/urqu"
MuchFactory.file_path #=> "bcno/pzxg/gois/mpvlfo.wdr"MuchFactory.binary #=> "\000\000\003S"
MuchFactory.boolean #=> false
```You can also extend on your own factory class:
```ruby
module Factory
extend MuchFactorydef self.data
{ Factory.string => Factory.string }
end
end
```## Installation
Add this line to your application's Gemfile:
gem "much-factory"
And then execute:
$ bundle
Or install it yourself as:
$ gem install much-factory
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request