starship/tests/testsuite/ruby.rs

56 lines
1.3 KiB
Rust
Raw Normal View History

2019-08-14 00:43:29 +02:00
use ansi_term::Color;
use std::fs::File;
2019-08-14 00:43:29 +02:00
use std::io;
use tempfile;
2019-08-14 00:43:29 +02:00
use crate::common;
#[test]
fn folder_without_ruby_files() -> io::Result<()> {
let dir = tempfile::tempdir()?;
2019-08-14 00:43:29 +02:00
let output = common::render_module("ruby")
.arg("--path")
.arg(dir.path())
.output()?;
let actual = String::from_utf8(output.stdout).unwrap();
let expected = "";
assert_eq!(expected, actual);
Ok(())
}
#[test]
#[ignore]
2019-08-14 00:43:29 +02:00
fn folder_with_gemfile() -> io::Result<()> {
let dir = tempfile::tempdir()?;
File::create(dir.path().join("Gemfile"))?.sync_all()?;
2019-08-14 00:43:29 +02:00
let output = common::render_module("ruby")
.arg("--path")
.arg(dir.path())
.output()?;
let actual = String::from_utf8(output.stdout).unwrap();
2020-01-17 19:12:13 +01:00
let expected = format!("via {} ", Color::Red.bold().paint("💎 v2.7.0"));
2019-08-14 00:43:29 +02:00
assert_eq!(expected, actual);
Ok(())
}
#[test]
#[ignore]
2019-08-14 00:43:29 +02:00
fn folder_with_rb_file() -> io::Result<()> {
let dir = tempfile::tempdir()?;
File::create(dir.path().join("any.rb"))?.sync_all()?;
2019-08-14 00:43:29 +02:00
let output = common::render_module("ruby")
.arg("--path")
.arg(dir.path())
.output()?;
let actual = String::from_utf8(output.stdout).unwrap();
2020-01-17 19:12:13 +01:00
let expected = format!("via {} ", Color::Red.bold().paint("💎 v2.7.0"));
2019-08-14 00:43:29 +02:00
assert_eq!(expected, actual);
Ok(())
}