Skip to content

Commit cf1707a

Browse files
authored
fix: add default-tls feature (#305)
# Objective In f40055d i removed the `default-features` from `reqwest`. This broke the template subcommand. # Solutioin enable the `default-tls` feature. While I tested all the `web` commands in the above-mentioned commit, I forgot about `bevy new`. To prevent this from happening I added some simple e2e tests. # Testing `cargo test` ```sh bevy new proj ❯ ls proj Cargo.toml src ``` Fixes: #304
1 parent f40055d commit cf1707a

3 files changed

Lines changed: 231 additions & 1 deletion

File tree

Cargo.lock

Lines changed: 147 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ dialoguer = { version = "0.11.0", default-features = false }
5151
serde = { features = ["derive"], version = "1.0.210" }
5252
serde_json = "1.0.128"
5353
reqwest = { version = "0.12.7", default-features = false, features = [
54+
"default-tls",
5455
"blocking",
5556
"json",
5657
] }
@@ -100,3 +101,4 @@ cc = "=1.2.2"
100101
# Forcing tests that can't be parallelized to be run sequentially
101102
serial_test = "3.2.0"
102103
assert_cmd = "2.0.16"
104+
tempfile = "3"

tests/new.rs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
use assert_cmd::prelude::*;
2+
use std::{path::Path, process::Command};
3+
use tempfile::TempDir;
4+
5+
fn temp_test_dir() -> anyhow::Result<TempDir> {
6+
Ok(tempfile::tempdir()?)
7+
}
8+
9+
fn ensure_path_exists<P: AsRef<Path>>(path: P) -> anyhow::Result<()> {
10+
anyhow::ensure!(
11+
path.as_ref().exists(),
12+
"Expected path {} does not exist",
13+
path.as_ref().display()
14+
);
15+
Ok(())
16+
}
17+
18+
#[test]
19+
fn should_scaffold_new_default_project() -> anyhow::Result<()> {
20+
let temp_dir = temp_test_dir()?;
21+
let project_name = "default-project";
22+
let project_path = temp_dir.path().join(project_name);
23+
24+
let mut cmd = Command::cargo_bin("bevy")?;
25+
cmd.current_dir(temp_dir.path()).args(["new", project_name]);
26+
27+
cmd.output()?;
28+
29+
ensure_path_exists(&project_path)?;
30+
31+
ensure_path_exists(project_path.join("Cargo.toml"))?;
32+
33+
ensure_path_exists(project_path.join("src").join("main.rs"))?;
34+
35+
Ok(())
36+
}
37+
38+
#[test]
39+
fn should_scaffold_new_with_minimal_template_shortcut_project() -> anyhow::Result<()> {
40+
let temp_dir = temp_test_dir()?;
41+
let project_name = "minimal-project-shortcut";
42+
let project_path = temp_dir.path().join(project_name);
43+
44+
let mut cmd = Command::cargo_bin("bevy")?;
45+
cmd.current_dir(temp_dir.path())
46+
.args(["new", project_name, "-t", "minimal"]);
47+
48+
cmd.output()?;
49+
50+
ensure_path_exists(&project_path)?;
51+
52+
ensure_path_exists(project_path.join("Cargo.toml"))?;
53+
54+
ensure_path_exists(project_path.join("src").join("main.rs"))?;
55+
56+
Ok(())
57+
}
58+
59+
#[test]
60+
fn should_scaffold_new_with_minimal_template_project() -> anyhow::Result<()> {
61+
let temp_dir = temp_test_dir()?;
62+
let project_name = "minimal-project";
63+
let project_path = temp_dir.path().join(project_name);
64+
65+
let mut cmd = Command::cargo_bin("bevy")?;
66+
cmd.current_dir(temp_dir.path()).args([
67+
"new",
68+
project_name,
69+
"-t",
70+
"https://github.com/TheBevyFlock/bevy_new_minimal",
71+
]);
72+
73+
cmd.output()?;
74+
75+
ensure_path_exists(&project_path)?;
76+
77+
ensure_path_exists(project_path.join("Cargo.toml"))?;
78+
79+
ensure_path_exists(project_path.join("src").join("main.rs"))?;
80+
81+
Ok(())
82+
}

0 commit comments

Comments
 (0)