spec/support/driver_databases_collection.rb in baza-0.0.20 vs spec/support/driver_databases_collection.rb in baza-0.0.21
- old
+ new
@@ -9,11 +9,13 @@
end
it "renames database" do
begin
db.databases["renamed-db"].drop
+ # rubocop:disable Lint/HandleExceptions
rescue Baza::Errors::DatabaseNotFound
+ # rubocop:enable Lint/HandleExceptions
# Ignore - it shouldn't exist
end
test_database.name = "renamed-db"
test_database.save!
@@ -21,9 +23,29 @@
expect(test_database.name).to eq "renamed-db"
end
it "drops databases" do
test_database.drop
-
expect { db.databases["baza-test-create"] }.to raise_error(Baza::Errors::DatabaseNotFound)
+ end
+
+ it "creates tables" do
+ if test_database.table_exists?("test")
+ puts "DROPPING TEST TABLE"
+ test_database.table("test").drop
+ end
+
+ test_database.create_table(
+ "test",
+ columns: [
+ {name: :id, type: :int, autoincr: true, primarykey: true},
+ {name: :name, type: :varchar}
+ ]
+ )
+
+ tables = test_database.tables.map(&:name).to_a
+ expect(tables).to eq ["test"]
+
+ table = test_database.table("test")
+ expect(table.name).to eq "test"
end
end