0.0
No commit activity in last 3 years
No release in over 3 years
Barebones factories
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
>= 0
 Project Readme

Forge

A Factory library that's about as barebones as you can get.

Installation

# "forge" was taken -_-

gem "forge-factories"
$ bundle install

# or

gem install forge-factories

Define Factories

Forge.define(:user, User) do |u|
  u.name = "Spike Spiegel"
  u.location = "Mars"
end

Defining Factories That Use Other Factories

Forge.define(:ship, Ship) do |s|
  s.name = "Bebop"
end

Forge.define(:user, User) do |u|
  u.name = "Spike Spiegel"
  u.ship = Forge.build(:ship)
end

Building Objects

Forge.build(:user)

Building Objects and Overriding Attributes

Forge.build(:user, name: "Jet")

DSL

You can drop the Forge part of the methods if you include Forge::DSL.

RSpec.configure do |config|
  config.include Forge::DSL
end

it "..." do
  build(:user).should be_awesome
end

Errors

Forge::DuplicateFactoryError Raised when you try to define two factories using the same name.

Forge::MissingFactoryError Raised when you try to build a factory that has not been defined.