Skip to content

Instantly share code, notes, and snippets.

@norman
Created October 13, 2021 13:59
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 norman/8904e48cd4d2dd1b71f070202dbddc76 to your computer and use it in GitHub Desktop.
Save norman/8904e48cd4d2dd1b71f070202dbddc76 to your computer and use it in GitHub Desktop.
Test the validity of your Rails fixtures
# frozen_string_literal: true
require "rails_helper"
describe "Fixtures" do
fixture_table_names.each do |table_name|
model_class = table_name.singularize.classify.constantize
it "has valid #{table_name}" do
expect(model_class.all).to all be_valid
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment