Created
July 21, 2015 10:55
-
-
Save lime/61df8428bf24c114c393 to your computer and use it in GitHub Desktop.
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 'spec_helper' | |
FactoryGirl.factories.each do |factory| | |
describe "The #{factory.name} factory" do | |
subject { build(factory.name) } | |
it { should be_valid } | |
factory.defined_traits.each do |trait| | |
describe "with trait #{trait.name}" do | |
subject { build(factory.name, trait.name) } | |
if trait.name.to_sym == :invalid | |
it { should be_invalid } | |
else | |
it { 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