2019-08-13 22:43:29 +00:00
|
|
|
use ansi_term::Color;
|
2019-09-04 23:13:53 +00:00
|
|
|
use std::fs::File;
|
2019-08-13 22:43:29 +00:00
|
|
|
use std::io;
|
2019-10-15 14:01:44 +00:00
|
|
|
use tempfile;
|
2019-08-13 22:43:29 +00:00
|
|
|
|
|
|
|
use crate::common;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn folder_without_ruby_files() -> io::Result<()> {
|
2019-10-15 14:01:44 +00:00
|
|
|
let dir = tempfile::tempdir()?;
|
2019-08-13 22:43:29 +00: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]
|
2019-08-15 01:50:25 +00:00
|
|
|
#[ignore]
|
2019-08-13 22:43:29 +00:00
|
|
|
fn folder_with_gemfile() -> io::Result<()> {
|
2019-10-15 14:01:44 +00:00
|
|
|
let dir = tempfile::tempdir()?;
|
2019-10-15 15:10:16 +00:00
|
|
|
File::create(dir.path().join("Gemfile"))?.sync_all()?;
|
2019-08-13 22:43:29 +00:00
|
|
|
|
|
|
|
let output = common::render_module("ruby")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
2019-09-04 23:13:53 +00:00
|
|
|
let expected = format!("via {} ", Color::Red.bold().paint("💎 v2.6.3"));
|
2019-08-13 22:43:29 +00:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2019-08-15 01:50:25 +00:00
|
|
|
#[ignore]
|
2019-08-13 22:43:29 +00:00
|
|
|
fn folder_with_rb_file() -> io::Result<()> {
|
2019-10-15 14:01:44 +00:00
|
|
|
let dir = tempfile::tempdir()?;
|
2019-10-15 15:10:16 +00:00
|
|
|
File::create(dir.path().join("any.rb"))?.sync_all()?;
|
2019-08-13 22:43:29 +00:00
|
|
|
|
|
|
|
let output = common::render_module("ruby")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
2019-09-04 23:13:53 +00:00
|
|
|
let expected = format!("via {} ", Color::Red.bold().paint("💎 v2.6.3"));
|
2019-08-13 22:43:29 +00:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|