Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
integrate factory_girl directly into the RSpec DSL
Ruby
Tree: c57b31d736

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
.gitignore
.rvmrc
CONTRIBUTORS.txt
Gemfile
LICENSE.txt
README.md
Rakefile
factory_girl_rspec.gemspec

README.md

factory_girl_rspec

Integrate FactoryGirl fixture initialization into the RSpec DSL.

Usage

Basic usage:

# spec/models/user_spec.rb
describe User do
  context 'basic user' do
    # instantiate FactoryGirl :user fixture
    with :user
    it { user.should be_inactive }
    it { user.should_not be_happy }
  end
end

Advanced usage:

# spec/models/user_spec.rb
describe User do
  context 'when user.first_name == nil' do
    # instantiate FactoryGirl :user fixture with custom options
    with :user, :first_name => nil
    it { user.should be_inactive }
    it { user.should_not be_happy }
  end
end

Features

  • clean and concise DSL for instantiating FactoryGirl fixtures
  • easily configure deviations in fixtures with optional parameter hash

Installation

# Bundler Gemfile
gem 'factory_girl_rspec'

Contributing

  • Fork the project
  • Fix the issue
  • Add unit tests
  • Submit pull request on github

Original implementation described on Ryan Sonnek's blog

See CONTRIBUTORS.txt for list of project contributors

Copyright

Copyright (c) 2011 Ryan Sonnek See LICENSE.txt for further details.

Something went wrong with that request. Please try again.