Skip to content

Commit

Permalink
Fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
weiznich committed Mar 4, 2020
1 parent a3274db commit 46fe6dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
15 changes: 9 additions & 6 deletions diesel_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,15 @@ fn migrations_dir(matches: &ArgMatches) -> Result<PathBuf, MigrationError> {
let migrations_dir = migrations_dir_from_cli(matches)
.or_else(|| env::var("MIGRATION_DIRECTORY").map(PathBuf::from).ok())
.or_else(|| {
Some(
Config::read(matches)
.unwrap_or_else(handle_error)
.migrations_directory?
.dir,
)
let mut project_root = find_project_root().ok()?;
let migrations_dir = Config::read(matches)
.unwrap_or_else(handle_error)
.migrations_directory?
.dir;

project_root.push(migrations_dir);

Some(project_root)
});

match migrations_dir {
Expand Down
3 changes: 2 additions & 1 deletion diesel_cli/tests/migration_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,8 @@ fn verify_schema_errors_if_schema_file_would_change() {
assert!(
result
.stderr()
.contains("Command would result in changes to src/my_schema.rs"),
.contains("Command would result in changes to")
&& result.stderr().contains("src/my_schema.rs"),
"Unexpected stderr {}",
result.stderr()
);
Expand Down

0 comments on commit 46fe6dc

Please sign in to comment.