-
-
Notifications
You must be signed in to change notification settings - Fork 910
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use correct migration class in acceptance tests
In Rails 5.0, migration classes changed so that they were versioned: instead of inheriting from `ActiveRecord::Migration`, you inherited from `ActiveRecord::Migration[5.0]`. The old way wasn't removed, however -- that is, until Rails 5.1. Hence, our acceptance tests that use the old style no longer work under the 5.1 Appraisal.
- Loading branch information
Showing
4 changed files
with
25 additions
and
2 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
21 changes: 21 additions & 0 deletions
21
spec/support/acceptance/helpers/rails_migration_helpers.rb
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require_relative 'gem_helpers' | ||
|
||
module AcceptanceTests | ||
module RailsMigrationHelpers | ||
include RailsVersionHelpers | ||
|
||
def migration_class_name | ||
if rails_version >= 5 | ||
"ActiveRecord::Migration[#{rails_version_for_migration}]" | ||
else | ||
'ActiveRecord::Migration' | ||
end | ||
end | ||
|
||
private | ||
|
||
def rails_version_for_migration | ||
rails_version.to_s.split('.')[0..1].join('.') | ||
end | ||
end | ||
end |