use super::super::effect::RebaseResult;
use super::core::MockAppEffectHandler;
use std::path::PathBuf;
impl MockAppEffectHandler {
#[must_use]
pub fn with_file(self, path: impl Into<PathBuf>, content: impl Into<String>) -> Self {
self.files.borrow_mut().insert(path.into(), content.into());
self
}
#[must_use]
pub fn on_main_branch(self) -> Self {
*self.is_main_branch.borrow_mut() = true;
self
}
#[must_use]
pub fn with_head_oid(self, oid: impl Into<String>) -> Self {
*self.head_oid.borrow_mut() = oid.into();
self
}
#[must_use]
pub fn without_repo(self) -> Self {
*self.repo_exists.borrow_mut() = false;
self
}
#[must_use]
pub fn with_default_branch(self, branch: impl Into<String>) -> Self {
*self.default_branch.borrow_mut() = branch.into();
self
}
#[must_use]
pub fn with_env_var(self, name: impl Into<String>, value: impl Into<String>) -> Self {
self.env_vars.borrow_mut().insert(name.into(), value.into());
self
}
#[must_use]
pub fn with_diff(self, diff: impl Into<String>) -> Self {
*self.diff_output.borrow_mut() = diff.into();
self
}
#[must_use]
pub fn with_staged_changes(self, staged: bool) -> Self {
*self.staged_changes.borrow_mut() = staged;
self
}
#[must_use]
pub fn with_rebase_result(self, result: RebaseResult) -> Self {
*self.rebase_result.borrow_mut() = Some(result);
self
}
#[must_use]
pub fn with_conflicted_files(self, files: Vec<String>) -> Self {
*self.conflicted_files.borrow_mut() = files;
self
}
#[must_use]
pub fn with_cwd(self, cwd: impl Into<PathBuf>) -> Self {
*self.cwd.borrow_mut() = cwd.into();
self
}
}