Skip to content

Instantly share code, notes, and snippets.

@3den
Created December 26, 2011 22:50
Show Gist options
  • Save 3den/1522252 to your computer and use it in GitHub Desktop.
Save 3den/1522252 to your computer and use it in GitHub Desktop.
Automatic Validation for all Factories
require 'spec_helper'
describe Factory do
FactoryGirl.factories.each do |factory|
context "with factory for :#{factory.name}" do
subject {Factory.build(factory.name)}
it "is valid" do
subject.valid?.should be, subject.errors.full_messages
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment