-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a test requiring data migrations to have an associated spec file #247
Conversation
d485d17
to
f930dbe
Compare
|
||
data_migration_files.each do |data_migration_file| | ||
spec_file_basename = File.basename(data_migration_file).sub(".rb", "_spec.rb") | ||
next if spec_file_basename.in?(KNOWN_MISSING_DATA_MIGRATION_SPEC_FILES) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think move this down and XOR the comparison, such that if someone adds a test that's in the missing list, they are forced to remove it.
f930dbe
to
76a72cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end | ||
end | ||
|
||
ActiveRecord::Base.singleton_class.prepend(Spec::Support::ConstantWatcher) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you verify this works locally if you do bundle exec rspec spec/specific/spec/file.rb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's loaded by spec_helper
#249 is merged, so please update the KNOWN list. |
We can determine which files are data migrations since they will define a class that inherits from ActiveRecord::Base. If we hook inherited in AR::Base, we can get the constant and the file in which it is defined (the data migration).
76a72cc
to
622e6fa
Compare
Checked commit bdunne@622e6fa with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
We can determine which files are data migrations since they will define a class that inherits from ActiveRecord::Base. If we hook inherited in AR::Base, we can get the constant and the file in which it is defined (the data migration).
Adding this as an automated code review to address #4 (comment)