class ViewWithoutPrimaryKeyTest
Public Instance Methods
test_attributes()
click to toggle source
# File activerecord/test/cases/view_test.rb, line 143 def test_attributes assert_equal({ "name" => "Agile Web Development with Quails", "status" => 2 }, Paperback.first.attributes) end
test_column_definitions()
click to toggle source
# File activerecord/test/cases/view_test.rb, line 138 def test_column_definitions assert_equal([["name", :string], ["status", :integer]], Paperback.columns.map { |c| [c.name, c.type] }) end
test_does_not_dump_view_as_table()
click to toggle source
# File activerecord/test/cases/view_test.rb, line 152 def test_does_not_dump_view_as_table schema = dump_table_schema "paperbacks" assert_no_match %r{create_table "paperbacks"}, schema end
test_does_not_have_a_primary_key()
click to toggle source
# File activerecord/test/cases/view_test.rb, line 148 def test_does_not_have_a_primary_key assert_nil Paperback.primary_key end
test_reading()
click to toggle source
# File activerecord/test/cases/view_test.rb, line 119 def test_reading books = Paperback.all assert_equal ["Agile Web Development with Quails"], books.map(&:name) end
test_table_exists()
click to toggle source
# File activerecord/test/cases/view_test.rb, line 133 def test_table_exists view_name = Paperback.table_name assert_not @connection.table_exists?(view_name), "'#{view_name}' table should not exist" end
test_view_exists()
click to toggle source
# File activerecord/test/cases/view_test.rb, line 128 def test_view_exists view_name = Paperback.table_name assert @connection.view_exists?(view_name), "'#{view_name}' view should exist" end
test_views()
click to toggle source
# File activerecord/test/cases/view_test.rb, line 124 def test_views assert_equal [Paperback.table_name], @connection.views end