Sha256: dfa9a828b5a6665c7f31a37150704d10eedc489054d7d073f710d4547cfec5c1

Contents?: true

Size: 1.15 KB

Versions: 17

Compression:

Stored size: 1.15 KB

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?
    @person = Person.new
    @person.save(validate: false)
    assert @person.files.empty?
    assert_equal [], @person.files.to_a
  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?
    @building = Building.new
    @building.save(validate: false)
    assert @building.files.empty?
    assert_equal [], @building.files.to_a
  end

  def test_new
    assert FileModel.new
  end

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

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
active_scaffold-3.6.15 test/misc/tableless_test.rb
active_scaffold-3.6.14 test/misc/tableless_test.rb
active_scaffold-3.6.13 test/misc/tableless_test.rb
active_scaffold-3.6.12 test/misc/tableless_test.rb
active_scaffold-3.6.11.1 test/misc/tableless_test.rb
active_scaffold-3.6.11 test/misc/tableless_test.rb
active_scaffold-3.6.10 test/misc/tableless_test.rb
active_scaffold-3.6.9 test/misc/tableless_test.rb
active_scaffold-3.6.8 test/misc/tableless_test.rb
active_scaffold-3.6.6 test/misc/tableless_test.rb
active_scaffold-3.6.5 test/misc/tableless_test.rb
active_scaffold-3.6.4.1 test/misc/tableless_test.rb
active_scaffold-3.6.4 test/misc/tableless_test.rb
active_scaffold-3.6.3 test/misc/tableless_test.rb
active_scaffold-3.6.2 test/misc/tableless_test.rb
active_scaffold-3.6.1 test/misc/tableless_test.rb
active_scaffold-3.6.0 test/misc/tableless_test.rb