Sha256: 3a993ae3c59ae9a86301a35c7bde5fd118968af9c1dd0e390cc14af588632bce

Contents?: true

Size: 1004 Bytes

Versions: 2

Compression:

Stored size: 1004 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
require 'data_objects/spec/shared/typecast/datetime_spec'

describe 'DataObjects::Mysql with DateTime' do
  it_behaves_like 'supporting DateTime'
  it_behaves_like 'supporting DateTime autocasting'

  describe 'reading 0000-00-00 00:00:00' do
    before do
      @connection = DataObjects::Connection.new(CONFIG.uri)

      @connection.create_command("SET SESSION sql_mode = 'ALLOW_INVALID_DATES'").execute_non_query
      @connection.create_command("INSERT INTO widgets (release_datetime) VALUES ('')").execute_non_query

      @command = @connection.create_command("SELECT release_datetime FROM widgets WHERE release_datetime = '0000-00-00 00:00:00'")
      @reader = @command.execute_reader
      @reader.next!
      @values = @reader.values
    end

    after do
      @reader.close
      @connection.close
    end

    it 'returns the number of created rows' do
      expect(@values.first).to be_nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sbf-do_mysql-0.11.0 spec/typecast/datetime_spec.rb
sbf-do_mysql-0.10.17 spec/typecast/datetime_spec.rb