Skip to content

Instantly share code, notes, and snippets.

@kingsleyh
Created January 6, 2018 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingsleyh/7170d5de30671047fbce14498a1e488b to your computer and use it in GitHub Desktop.
Save kingsleyh/7170d5de30671047fbce14498a1e488b to your computer and use it in GitHub Desktop.
crystal types
result = repo.user.findByEmail(user.value["email"])
p typeof(result.value) #(Iterator::Stop | RethinkDB::QueryResult | String)
p result.value.is_a?(RethinkDB::QueryResult) #true
result.should be_a(DB::Success(RethinkDB::QueryResult)) # fails with error below
Failures:
1) Repository Repository::User should find a user by email
Failure/Error: result.should be_a(DB::Success(RethinkDB::QueryResult))
Expected DB::Success(Iterator::Stop | RethinkDB::QueryResult)(@value={"activeChannel" => {}, "channels" => [], "email" => "test3@test.com", "groups" => [], "id" => "4667082c-f378-4e02-86bf-b985dbf68584", "name" => "test3", "password" => "password3"}) (DB::Success(Iterator::Stop | RethinkDB::QueryResult)) to be a DB::Success(RethinkDB::QueryResult)
# spec/repository_spec.cr:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment