{"id":22808294,"url":"https://github.com/sixarm/sixarm_ruby_factory_girl_test_examples","last_synced_at":"2025-07-21T18:36:05.116Z","repository":{"id":137270506,"uuid":"1448324","full_name":"SixArm/sixarm_ruby_factory_girl_test_examples","owner":"SixArm","description":"SixArm.com » Ruby » Factory Girl test examples for Rails","archived":false,"fork":false,"pushed_at":"2025-04-14T09:18:49.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-14T10:29:36.133Z","etag":null,"topics":["factory","factory-girl","gem","ruby","test"],"latest_commit_sha":null,"homepage":"http://sixarm.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SixArm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-03-07T01:33:50.000Z","updated_at":"2025-04-14T09:18:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"f4938e53-7d3c-4dfd-9d5d-ac0d668791a4","html_url":"https://github.com/SixArm/sixarm_ruby_factory_girl_test_examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SixArm/sixarm_ruby_factory_girl_test_examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SixArm%2Fsixarm_ruby_factory_girl_test_examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SixArm%2Fsixarm_ruby_factory_girl_test_examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SixArm%2Fsixarm_ruby_factory_girl_test_examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SixArm%2Fsixarm_ruby_factory_girl_test_examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SixArm","download_url":"https://codeload.github.com/SixArm/sixarm_ruby_factory_girl_test_examples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SixArm%2Fsixarm_ruby_factory_girl_test_examples/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266352927,"owners_count":23915853,"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","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["factory","factory-girl","gem","ruby","test"],"created_at":"2024-12-12T11:08:58.444Z","updated_at":"2025-07-21T18:36:05.111Z","avatar_url":"https://github.com/SixArm.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SixArm.com → Ruby → \u003cbr\u003e Factory Girl test examples for Rails\n\n* Docs: \u003chttp://sixarm.com/sixarm_ruby_/doc\u003e\n* Repo: \u003chttp://github.com/sixarm/sixarm_ruby_\u003e\n\u003c!--header-shut--\u003e\n\n\n## Introduction\n\nFactory Girl examples for the ThoughtBot factory_girl gem.\nThese are useful for our testing Ruby On Rails applications.\n\nFor docs go to \u003chttp://sixarm.com/sixarm_ruby_/doc\u003e\n\nWant to help? We're happy to get pull requests.\n\n\n\u003c!--install-opent--\u003e\n\n## Install\n\nTo install using a Gemfile, add this:\n\n    gem \"\", \"\u003e= \", \"\u003c 1\"\n\nTo install using the command line, run this:\n\n    gem install  -v \"\u003e= , \u003c 1\"\n\nTo install using the command line with high security, run this:\n\n    wget http://sixarm.com/sixarm.pem\n    gem cert --add sixarm.pem \u0026\u0026 gem sources --add http://sixarm.com\n    gem install  -v \"\u003e= , \u003c 1\" --trust-policy HighSecurity\n\nTo require the gem in your code:\n\n    require \"\"\n\n\u003c!--install-shut--\u003e\n\n\n## Details\n\nThese examples are built independent of any mock data tool.\nYou will most likely want to change these examples to suit\nwhichever mock data tool you like to use in your project.\n\nWe like these mock data tools:\n\n  * forgery: best for custom dictionaries and generators.\n  * faker: best as a straight port of the Perl Faker module. \n  * ffaker: faster faker, an optimization of the faker gem.\n  * random_data: good for plausible anames, ddresses, etc.\n\n\n## To create a collection of items\n\nSimply call the factory like this:\n\n    3.times { Factory(:user) }\n\n\n## To create a collection for the \"many\" in a has_many\n\nDo it in Factory Girl after_create on the belonging object.\nSo if you wanted a test with a Company with 3 Users:\n\n    Factory.define :company_with_three_users do |blog|\n      company.after_create do |belonging|\n        3.times { Factory(:user, :company =\u003e belonging) }\n      end\n    end\n\n\n## To create records that share parameters\n\nWrite a helper method:\n\n    # in test/factories.rb or spec/factories.rb\n    def two_companies_for(user = Factory(:user))\n      [Factory(:company), Factory(:company)]\n    end\n\n\n## To connect cucumber steps for dynamic factories\n\nParse the cucumber step then send the match as a parameter:\n\n    Given /^typical (\\w+)/ do |name|\n      Factory(name)\n    end\n\n\n## To do more advanced expert setup with callbacks\n\nSee this post about callbacks before and after factories: \n\n    http://robots.thoughtbot.com/post/254496652/aint-no-calla-back-girl\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsixarm%2Fsixarm_ruby_factory_girl_test_examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsixarm%2Fsixarm_ruby_factory_girl_test_examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsixarm%2Fsixarm_ruby_factory_girl_test_examples/lists"}