Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
# In my test_helper
def self.should_have_valid_test_data
klass = self.name[/^(.*)Test$/, 1].constantize
test "#{klass.name} should have valid fixtures" do
invalids = klass.all.reject{|m|m.valid?}
message = "Expected all #{klass.name} fixtures to be valid.\nInvalids:\n#{
invalids.map{|m| [m.errors.full_messages, m]}.pretty_inspect}"
assert_block(message) { invalids.empty? }
end
test "#{klass.name} should have a valid factory" do
f = Factory.build(klass.name.downcase.to_sym)
f.valid?
message = "Expected #{name} factory to be valid.\nErrors:\n#{f.errors.full_messages.pretty_inspect}"
assert_block(message) { f.valid? }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.