-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #776 from jrafanie/fix-rails-7-1-plus-test-failure
Allow the rails method to be called and change the result only when called from the migration
- Loading branch information
Showing
3 changed files
with
11 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
def require_migration | ||
spec_name = caller_locations.first.path | ||
migration_name = spec_name.sub("spec/migrations", "db/migrate").sub("_spec.rb", ".rb") | ||
require migration_path | ||
end | ||
|
||
require migration_name | ||
def migration_path | ||
spec_name = caller_locations.detect {|loc| loc.path.end_with?("_spec.rb")}.path | ||
spec_name.sub("spec/migrations", "db/migrate").sub("_spec.rb", ".rb") | ||
end |