Skip to content
Browse files

Initial support for MiniTest

Closes #68, #75
  • Loading branch information...
1 parent b59a4c5 commit bcbdc4558cc838723a8d30289b52464c6d7a497e @joshuaclayton joshuaclayton committed Dec 10, 2012
View
40 features/fixture_replacement_config.feature
@@ -41,12 +41,34 @@ Feature:
But the following files should exist:
| custom/dir/users.rb |
- Scenario: Using Factory Girl and Factory Girl Rails does not override a manually-configured factories directory using Test::Unit
- When I configure the factories directory as "custom/dir"
- And I successfully run `bundle install`
- And I successfully run `bundle exec rails generate model User name:string`
- Then the following files should not exist:
- | test/factories/users.rb |
- | spec/factories/users.rb |
- But the following files should exist:
- | custom/dir/users.rb |
+ Scenario: Using Factory Girl and Factory Girl Rails does not override a manually-configured factories directory using Test::Unit
+ When I configure the factories directory as "custom/dir"
+ And I successfully run `bundle install`
+ And I successfully run `bundle exec rails generate model User name:string`
+ Then the following files should not exist:
+ | test/factories/users.rb |
+ | spec/factories/users.rb |
+ But the following files should exist:
+ | custom/dir/users.rb |
+
+ Scenario: Using Factory Girl and Factory Girl Rails with MiniTest should generate a factory file
+ When I add "minitest" as a dependency
+ And I configure the testing framework to use MiniTest
+ And I successfully run `bundle install`
+ And I successfully run `bundle exec rails generate model User name:string`
+ Then the following files should exist:
+ | test/factories/users.rb |
+ But the following files should not exist:
+ | spec/fixtures/users.yml |
+
+ Scenario: Using Factory Girl and Factory Girl Rails with MiniTest and a custom directory should generate a factory file
+ When I configure the factories directory as "custom/dir"
+ And I add "minitest" as a dependency
+ And I configure the testing framework to use MiniTest
+ And I successfully run `bundle install`
+ And I successfully run `bundle exec rails generate model User name:string`
+ Then the following files should exist:
+ | custom/dir/users.rb |
+ But the following files should not exist:
+ | spec/fixtures/users.yml |
+ And the file "test/models/user_test.rb" should contain "MiniTest::Rails::ActiveSupport::TestCase"
View
13 features/step_definitions/rails_steps.rb
@@ -28,3 +28,16 @@ class Testapp::Application
end
END
end
+
+When /^I configure the testing framework to use MiniTest$/ do
+ append_to_file('Gemfile', %{gem "minitest-rails", :group => [:development, :test]\n})
+ step %{I successfully run `rails generate mini_test:install`}
+
+ append_to_file File.join('config', 'application.rb'), <<-END
+class Testapp::Application
+ config.generators do |g|
+ g.test_framework :mini_test, :fixture => false, :fixture_replacement => :factory_girl
+ end
+end
+ END
+end
View
2 lib/factory_girl_rails/railtie.rb
@@ -13,7 +13,7 @@ class Railtie < Rails::Railtie
generators.fixture_replacement :factory_girl, :dir => 'spec/factories'
end
else
- generators.test_framework :test_unit, :fixture => false, :fixture_replacement => :factory_girl
+ generators.test_framework rails_options[:test_framework], :fixture => false, :fixture_replacement => :factory_girl
end
end

0 comments on commit bcbdc45

Please sign in to comment.
Something went wrong with that request. Please try again.