-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to unmigrate test models (#252)
- Loading branch information
Showing
3 changed files
with
38 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//! Test the "current" migration created by the butane_test_helper due to | ||
//! all of the other tests in the butane/tests directory. | ||
#![cfg(test)] | ||
use butane::db::Connection; | ||
use butane::migrations::{Migration, Migrations}; | ||
use butane_test_helper::*; | ||
|
||
fn unmigrate(mut connection: Connection) { | ||
let mem_migrations = create_current_migrations(&connection); | ||
|
||
let migrations = mem_migrations.unapplied_migrations(&connection).unwrap(); | ||
assert_eq!(migrations.len(), 0); | ||
|
||
let migration = mem_migrations.latest().unwrap(); | ||
migration.downgrade(&mut connection).unwrap(); | ||
|
||
let migrations = mem_migrations.unapplied_migrations(&connection).unwrap(); | ||
assert_eq!(migrations.len(), 1); | ||
} | ||
testall!(unmigrate); |
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