Last active
October 9, 2015 06:18
-
-
Save tscolari/3452805 to your computer and use it in GitHub Desktop.
Spec for all factories
This file contains hidden or 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 'spec_helper' | |
describe FactoryGirl do | |
FactoryGirl.factories.each do |factory| | |
context "with factory for :#{factory.name}" do | |
subject {FactoryGirl.build(factory.name)} | |
it "is valid" do | |
subject.valid?.should be, subject.errors.full_messages.join(',') | |
end | |
context "traits" do | |
factory.defined_traits.each do |trait| | |
describe "trait: #{trait.name}" do | |
subject {FactoryGirl.build(factory.name, trait.name)} | |
it "is valid" do | |
subject.valid?.should be, subject.errors.full_messages.join(',') | |
end | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment