Sha256: 42aea4cc12d04b106c45966aced407ae2f758bdc8708be5f7ca915c93c0e2f28

Contents?: true

Size: 1003 Bytes

Versions: 1

Compression:

Stored size: 1003 Bytes

Contents

require 'spec_helper'

describe ActiveRecord::Base do

  let(:notification_status) { FactoryGirl.build(:notification_status) }
  let(:notification_status2) { FactoryGirl.build(:notification_status) }
  
  it "generates correct Oracle Enchanced Bulk SQL" do 
    date = DateTime.now
    sql = Notifiable::NotificationStatus.send(:oracle_bulk_insert_sql, 
      [{notification_id: notification_status.notification.id, device_token_id: notification_status.device_token.id, status: 0, created_at: date},
      {notification_id: notification_status2.notification.id, device_token_id: notification_status2.device_token.id, status: 0, created_at: date}])
    
      sql.should eql "INSERT ALL INTO notifiable_statuses (created_at, device_token_id, notification_id, status) VALUES (#{ActiveRecord::Base.connection.quote(date)}, 1, 1, 0) INTO notifiable_statuses (created_at, device_token_id, notification_id, status) VALUES (#{ActiveRecord::Base.connection.quote(date)}, 2, 2, 0) SELECT 1 FROM DUAL;"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
notifiable-rails-0.19.5 spec/active_record_spec.rb