Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting started integration tests #4083

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/sqlite/getting_started_step_2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ diesel = { version = "2.1.0", path = "../../../diesel", features = ["sqlite", "r
dotenvy = "0.15"
libsqlite3-sys = { version = "0.28.0", features = ["bundled"] }

[dev-dependencies]
assert_cmd = "2.0.14"

[[bin]]
name = "show_posts"
doc = false
Expand Down
16 changes: 16 additions & 0 deletions examples/sqlite/getting_started_step_2/tests/step_2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use assert_cmd::Command;

#[test]
fn write_post() {
let _ = Command::cargo_bin("write_post")
.unwrap()
.write_stdin("Test Title\ntest text\n1 2 3")
.assert()
.append_context("write_post", "")
.stdout("What would you like your title to be?\n\nOk! Let's write Test Title (Press CTRL+D when finished)\n\n\nSaved draft Test Title with id 1\n");
let _ = Command::cargo_bin("show_posts")
.unwrap()
.assert()
.append_context("show_posts", "")
.stdout("Displaying 0 posts\n");
}
Loading