Sha256: 1a955bdb01217de737bb76f943da68f1607060836b86fa642e3c9f190b5a1947

Contents?: true

Size: 910 Bytes

Versions: 3

Compression:

Stored size: 910 Bytes

Contents

require 'test_helper'

class TablelessTest < MiniTest::Test
  def test_find_all
    assert FileModel.all.to_a.empty?
  end

  def test_where
    assert FileModel.where(name: 'file').to_a.empty?
  end

  def test_where_using_assoc
    assert FileModel.includes(:person).where(people: {name: 'Name'}).to_a.empty?
  end

  def test_count
    assert_equal 0, FileModel.count
  end

  def test_find_by_id
    assert_raises ActiveRecord::RecordNotFound do
      FileModel.find('filename')
    end
  end

  def test_find_with_association
    assert Person.new.files.empty?
  end

  def test_tableless_assoc_with_dependent
    @person = Person.new
    @person.save(validate: false)
    assert @person.destroy
  end

  def test_find_with_through_association
    assert Building.new.files.empty?
  end

  def test_new
    assert FileModel.new
  end

  def test_association
    assert FileModel.new.person.nil?
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_scaffold-3.6.0.rc2 test/misc/tableless_test.rb
active_scaffold-3.6.0.rc1 test/misc/tableless_test.rb
active_scaffold-3.6.0.pre test/misc/tableless_test.rb