Sha256: 12fba31ec197d2dfc340b2d6e3aacb54124ad276889c72321e3fdac2f31e3117

Contents?: true

Size: 935 Bytes

Versions: 2

Compression:

Stored size: 935 Bytes

Contents

require File.dirname(__FILE__) + "/spec_helper"

describe DataObject do
  
  # These specs only fail in MySQL because:
  # 1) An insert happened in the previous connection
  # 2) We are searching for NULL
  # 
  # It turns out that this is actually by design o.O:
  #   http://dev.mysql.com/doc/refman/5.0/en/myodbc-usagenotes-functionality.html
  #
  #   Certain ODBC applications (including Delphi and Access) may have trouble 
  #   obtaining the auto-increment value using the previous examples. In this case, 
  #   try the following statement as an alternative:
  #     SELECT * FROM tbl WHERE auto IS NULL;
  it "should return an empty reader" do
    database.adapter.connection do |connection|
      command = connection.create_command('SELECT `id`, `name` FROM `zoos` WHERE (`id` IS NULL)')

      command.execute_reader do |reader|
        reader.has_rows?.should eql(ENV['ADAPTER'] == 'mysql')
      end
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
datamapper-0.2.1 spec/dataobjects_spec.rb
datamapper-0.2.2 spec/dataobjects_spec.rb