diff --git a/spec/mysql2/result_spec.rb b/spec/mysql2/result_spec.rb index 47a4a6de..86752e13 100644 --- a/spec/mysql2/result_spec.rb +++ b/spec/mysql2/result_spec.rb @@ -410,8 +410,13 @@ end it "should raise an error given an invalid DATETIME" do - expect { @client.query("SELECT CAST('1972-00-27 00:00:00' AS DATETIME) as bad_datetime").each }.to \ - raise_error(Mysql2::Error, "Invalid date in field 'bad_datetime': 1972-00-27 00:00:00") + if @client.info[:version] < "8.0" + expect { @client.query("SELECT CAST('1972-00-27 00:00:00' AS DATETIME) as bad_datetime").each }.to \ + raise_error(Mysql2::Error, "Invalid date in field 'bad_datetime': 1972-00-27 00:00:00") + else + expect(@client.query("SELECT CAST('1972-00-27 00:00:00' AS DATETIME) as bad_datetime").to_a.first).to \ + eql("bad_datetime" => nil) + end end context "string encoding for ENUM values" do diff --git a/spec/mysql2/statement_spec.rb b/spec/mysql2/statement_spec.rb index 77c86b55..3c00d0ff 100644 --- a/spec/mysql2/statement_spec.rb +++ b/spec/mysql2/statement_spec.rb @@ -482,8 +482,13 @@ def stmt_count end it "should raise an error given an invalid DATETIME" do - expect { @client.query("SELECT CAST('1972-00-27 00:00:00' AS DATETIME) as bad_datetime").each }.to \ - raise_error(Mysql2::Error, "Invalid date in field 'bad_datetime': 1972-00-27 00:00:00") + if @client.info[:version] < "8.0" + expect { @client.query("SELECT CAST('1972-00-27 00:00:00' AS DATETIME) as bad_datetime").each }.to \ + raise_error(Mysql2::Error, "Invalid date in field 'bad_datetime': 1972-00-27 00:00:00") + else + expect(@client.query("SELECT CAST('1972-00-27 00:00:00' AS DATETIME) as bad_datetime").to_a.first).to \ + eql("bad_datetime" => nil) + end end context "string encoding for ENUM values" do