Sha256: 81c0e93f535106d875a2d9fb5fe4049499ecbaba5695ae56ecaac02e4935c3c5

Contents?: true

Size: 693 Bytes

Versions: 1

Compression:

Stored size: 693 Bytes

Contents

require File.join(File.dirname(__FILE__), 'CONFIG.rb')

require 'rubygems'
require 'facets'
require "og"
require "pp"
require "test/unit"

$DBG = true

class Playlist
  property :name, String
  has_many :tracks
end

class Track
  property :name, String
  belongs_to Playlist

  def initialize(playlist)
    self.playlist = playlist
  end
end


class OgDeleteAll < Test::Unit::TestCase
  def setup
    Og.setup($og_config)
  end

  def pop
    @pl = Playlist.create
    5.times do |i|
      Track.create(@pl)
    end
  end
  
  def test1
    pop()
    @pl.tracks.delete_all
    assert(Track.all.empty?)

    pop()
    @pl.tracks.each { |obj| obj.delete }
    assert(Track.all.empty?)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
og-0.27.0 test/og/tc_delete_all.rb