// Given the tool was just run with a new version of a dependency in the
//     depencency file and then the dependency was downgraded
// When the command is run
// Then the older version of the dependency is pulled to the correct location
//     with the correct contents
Given the tool was just run with a new version of a dependency in the
depencency file and then the dependency was downgraded
When the command is run
Then the older version of the dependency is pulled to the correct location
with the correct contents
Given the tool was just run with a new version of a dependency in the depencency file and then the dependency was downgraded When the command is run Then the older version of the dependency is pulled to the correct location with the correct contents
fn downgrade_dep() {
    let test_deps = test_deps();
    let Layout{dep_srcs_dir, proj_dir, deps_commit_hashes, deps_file, ..} =
        create_test_setup_and_run_tool(
            "upgrade_dep",
            &test_deps,
            hashmap!{"my_scripts" => 1},
        );
    let deps_file_conts = test_setup::write_test_deps_file(
        &deps_file,
        &deps_commit_hashes,
        &hashmap!{"my_scripts" => 0},
    );
    let cmd_result = test_setup::with_git_server(
        dep_srcs_dir,
        || {
            let mut cmd = test_setup::new_test_cmd(proj_dir.clone());
            cmd.assert()
        },
    );
    cmd_result.code(0).stdout("").stderr("");
    fs_check::assert_contents(
        &proj_dir,
        &Node::Dir(hashmap!{
            "dpnd.txt" => Node::File(&deps_file_conts),
            "deps" => Node::Dir(hashmap!{
                "current_dpnd.txt" => Node::AnyFile,
                "my_scripts" => Node::Dir(hashmap!{
                    ".git" => Node::AnyDir,
                    "script.sh" => Node::File("echo 'hello world'"),
                }),
            }),
        }),
    );
}
fn downgrade_dep ( ) { let test_deps = test_deps ( ) ; let Layout { dep_srcs_dir , proj_dir , deps_commit_hashes , deps_file , .. } = create_test_setup_and_run_tool ( " " , & test_deps , hashmap ! { " " 1 } , ) ; let deps_file_conts = test_setup :: write_test_deps_file ( & deps_file , & deps_commit_hashes , & hashmap ! { " " 0 } , ) ; let cmd_result = test_setup :: with_git_server ( dep_srcs_dir , | | { let mut cmd = test_setup :: new_test_cmd ( proj_dir . clone ( ) ) ; cmd . assert ( ) } , ) ; cmd_result . code ( 0 ) . stdout ( " " ) . stderr ( " " ) ; fs_check :: assert_contents ( & proj_dir , & Node :: Dir ( hashmap ! { " " Node File ( deps_file_conts ) " " Node Dir ( hashmap { " " Node AnyFile " " Node Dir ( hashmap { " " Node AnyDir " " Node File ( " " ) } ) } ) } ) , ) ; }
Given the tool was just run with a new version of a dependency in the
depencency file and then the dependency was downgraded
When the command is run
Then the older version of the dependency is pulled to the correct location
with the correct contents
Given the tool was just run with a new version of a dependency in the depencency file and then the dependency was downgraded When the command is run Then the older version of the dependency is pulled to the correct location with the correct contents