Skip to content

Instantly share code, notes, and snippets.

@lime
Created July 21, 2015 10:55
Show Gist options
  • Save lime/61df8428bf24c114c393 to your computer and use it in GitHub Desktop.
Save lime/61df8428bf24c114c393 to your computer and use it in GitHub Desktop.
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