Skip to content

Instantly share code, notes, and snippets.

@jimjh
Created March 28, 2013 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimjh/5263666 to your computer and use it in GitHub Desktop.
Save jimjh/5263666 to your computer and use it in GitHub Desktop.
have_a_valid_factory - a custom Shoulda/RSpec matcher
RSpec::Matchers.define :have_a_valid_factory do
match do |subject|
factory = subject.class.name.underscore.to_sym
FactoryGirl.build(factory).should be_valid
end
end
@dannyvanhoof
Copy link

I like the idea, but I don't like the fact that the be_valid overrides the description...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment