Skip to content

Commit 521e65a

Browse files
committed
test that rvx @name/gem hits the right gem server URL
1 parent d2bc2f3 commit 521e65a

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
mod install_test;
22
mod list_test;
3+
mod run_test;
34
mod uninstall_test;

crates/rv/tests/integration_tests/tool_test/run_test.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
use fs_err as fs;
2-
31
use crate::{RvOutput, RvTest};
4-
use owo_colors::OwoColorize;
5-
use rv_cache::rm_rf;
62

73
impl RvTest {
84
pub fn tool_run(&mut self, args: &[&str]) -> RvOutput {
@@ -15,9 +11,13 @@ impl RvTest {
1511
}
1612

1713
mod test {
14+
use owo_colors::OwoColorize as _;
15+
use rv_cache::rm_rf;
16+
17+
use crate::RvTest;
18+
1819
#[test]
1920
fn test_tool_run_works() {
20-
panic!("test failed");
2121
let mut test = RvTest::new();
2222

2323
let releases_mock = test.mock_releases_all_platforms(["4.0.0"].to_vec());
@@ -48,13 +48,22 @@ mod test {
4848
#[test]
4949
fn test_tool_run_works_with_namespaced_gem() {
5050
let mut test = RvTest::new();
51+
test.namespace = Some("@indirect".to_string());
5152

5253
let releases_mock = test.mock_releases_all_platforms(["4.0.0"].to_vec());
5354
let ruby_mock = test.mock_ruby_download("4.0.0").create();
5455
let info_endpoint_mock = test.mock_info_endpoint("indirect").create();
5556
let tarball_mock = test.mock_gem_download("indirect-1.2.0.gem").create();
5657

57-
let output = test.tool_run(&["@indirect/indirect"]);
58+
// skip using `tool_run()` specifically so we do not include the namespace
59+
// in the gem server URL, and test that it gets added from the gem name.
60+
let output = test.rv(&[
61+
"tool",
62+
"run",
63+
"--gem-server",
64+
&test.server_url(),
65+
"@indirect/indirect",
66+
]);
5867

5968
let tool_home = "/tmp/home/.local/share/rv/tools/indirect@1.2.0";
6069
let expected_info_message = format!(

0 commit comments

Comments
 (0)