fixed insert_step_processor
This commit is contained in:
@@ -25,7 +25,8 @@ TEST_CASE_METHOD(SessionFixture, "Test insert object with belongs to relation wi
|
||||
const auto carrie = make_object<book_identity>("Carrie", s_king, 1974);
|
||||
|
||||
REQUIRE(carrie.is_transient());
|
||||
REQUIRE(ses.insert(carrie).is_ok());
|
||||
const auto res = ses.insert(carrie);
|
||||
REQUIRE(res.is_ok());
|
||||
REQUIRE(carrie.is_persistent());
|
||||
|
||||
auto found_author = ses.find<author_identity>(s_king->id);
|
||||
|
||||
@@ -61,6 +61,16 @@ void validate_author_state(const object_ptr<AuthorType>& ptr, object_state expec
|
||||
}
|
||||
}
|
||||
|
||||
namespace matador::utils {
|
||||
template < typename ValueType >
|
||||
std::ostream& operator<<(std::ostream& os, const result<ValueType, error>& value) {
|
||||
if (value) {
|
||||
return os;
|
||||
}
|
||||
return os << "Error: " << value.err();
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(SessionFixture, "Test insert object with has many relation", "[session][insert][has_many]") {
|
||||
const auto result = schema.attach<book>("books")
|
||||
.and_then( [this] { return schema.attach<author>("authors"); } )
|
||||
@@ -79,7 +89,7 @@ TEST_CASE_METHOD(SessionFixture, "Test insert object with has many relation", "[
|
||||
|
||||
validate_author_state(s_king, object_state::Transient);
|
||||
auto res = ses.insert(s_king);
|
||||
REQUIRE(res.is_ok());
|
||||
REQUIRE(res);
|
||||
validate_author_state(s_king, object_state::Persistent);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user