Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Supporting minitest #68

wants to merge 8 commits into from

7 participants


Added minitest support. Otherwise it's not possible to use mini test with factory girl fixtures. Maybe this gem should not touch the test framwork setups at all?


Thank you! Just got crazy over this problem. Using your fork for now :)


Here is my fix: jonesdeini@fe632cf
It's very general and works with test_unit or mini_test.


+1 for @jonesdeini's fix.

Umur Ozkul Minitest and all frameworks supported. Because you configure them nor…
…mally. They are not touched here. +1 for @joedesini

I've merged @jonesdeini's fix.
MiniTesting with FactoryGirl now. Just having normal configuration in my application.rb

DemoBlogHobo::Application.configure do
  config.generators do |g|
    g.test_framework :mini_test, :spec => true, :fixture=>false, :fixture_replacement=>:factory_girl

You don't need to add this to your configuration to your config/application.rb file because the factory_girl_rails gem in your Gemfile will do this for you, right?


This breaks features/fixture_replacement_config.feature:18 because it no longer generates the factory file correctly.


The reason I know the test is failing is because I tried to merge this, because we want this feature.

It's worth noting that this branch did not merge cleanly. Perhaps if you rebase against master you will do a better job resolving conflicts than I.

This is the failure I see. I do not see it in master, only in this branch:

~/thoughtbot/factory_girl_rails% ruby -v
ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux]
~/thoughtbot/factory_girl_rails% rake
/home/mike/.rvm/rubies/ruby-1.9.2-p320/bin/ruby -S bundle exec cucumber --format progress

(::) failed steps (::)

expected file?("test/factories/users.rb") to return true, got false (RSpec::Expectations::ExpectationNotMetError)
features/fixture_replacement_config.feature:18:in `Then the following files should exist:'

Failing Scenarios:
cucumber features/fixture_replacement_config.feature:14 # Scenario: Using Factory Girl and Factory Girl Rails with Test Unit generates
a factory file and does not generate a fixture file

5 scenarios (1 failed, 4 passed)
49 steps (1 failed, 1 skipped, 47 passed)
rake aborted!
Command failed with status (1): [/home/mike/.rvm/rubies/ruby-1.9.2-p320/bin...]

Tasks: TOP => default => cucumber
(See full trace by running task with --trace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 13, 2012
  1. @ryanatwork
Commits on Aug 27, 2012
  1. @jonesdeini
Commits on Aug 28, 2012
  1. Allow both test_unit and mini_test as well as rspec

    Umur Ozkul authored
  2. @jonesdeini
Commits on Aug 29, 2012
  1. Minitest and all frameworks supported. Because you configure them nor…

    Umur Ozkul authored
    …mally. They are not touched here. +1 for @joedesini
Commits on Aug 30, 2012
  1. @umuro


    umuro authored
  2. @umuro


    umuro authored
This page is out of date. Refresh to see the latest.
@@ -30,6 +30,12 @@ Configuration
Add factory_girl_rails to your Gemfile:
gem 'factory_girl_rails'
+If you are not using rspec then configure your test generator in config/application.rb. For example, to enable MiniTest with Factory, you would add
+ config.generators do |g|
+ g.test_framework :mini_test, :spec => true, :fixture=>false, :fixture_replacement=>:factory_girl
+ end
Cucumber Integration
2  factory_girl_rails.gemspec
@@ -22,5 +22,5 @@ do |s|
s.add_development_dependency('rspec', '~> 2.6.0')
s.add_development_dependency('cucumber', '~> 1.0.0')
- s.add_development_dependency('rails', '3.0.7')
+ s.add_development_dependency('rails', '>= 3.0.7')
2  lib/factory_girl_rails/railtie.rb
@@ -10,7 +10,7 @@ class Railtie < Rails::Railtie
if generators.options[:rails][:test_framework] == :rspec
generators.fixture_replacement :factory_girl, :dir => 'spec/factories'
- generators.test_framework :test_unit, :fixture => false, :fixture_replacement => :factory_girl
+ generators.fixture_replacement :factory_girl
Something went wrong with that request. Please try again.