Last active
March 23, 2016 11:09
-
-
Save AquisTech/c37fb627f201977319b7 to your computer and use it in GitHub Desktop.
Generalized specs to test all factories and traits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
FactoryGirl.factories.each do |factory| | |
describe "The '#{factory.name}' factory" do | |
it 'is valid' do | |
build(factory.name).should be_valid | |
end | |
factory.definition.defined_traits.each do |trait| | |
describe "The '#{trait.name}' trait" do | |
it 'is valid' do | |
build(factory.name, trait.name).should be_valid | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment