Permalink
Browse files

Test that we don't break the schema methods.

  • Loading branch information...
1 parent 6a5781e commit c674666a8ee6c3e9cd92651a0ebc2c6cccf7ab46 @oggy committed Jun 27, 2012
@@ -9,6 +9,11 @@
end
describe "#add_column" do
+ it "still adds the column if ok" do
+ connection.add_column 'test_table', 'test_column', :boolean, null: false, default: false
+ connection.column_exists?('test_table', 'test_column', :boolean, null: false, default: false).must_equal true
+ end
+
describe "when nullability is required" do
use_attribute_value DBNazi, :require_nullability, true
@@ -63,6 +68,11 @@
connection.add_column 'test_table', 'test_column', :boolean, null: false, default: false
end
+ it "still changes the column if ok" do
+ connection.change_column 'test_table', 'test_column', :integer, null: false
+ connection.column_exists?('test_table', 'test_column', :integer, null: false).must_equal true
+ end
+
describe "when nullability is required" do
use_attribute_value DBNazi, :require_nullability, true
@@ -117,6 +127,11 @@
connection.add_column 'test_table', 'test_column', :boolean, null: true
end
+ it "still adds the index if ok" do
+ connection.add_index 'test_table', 'test_column', unique: false
+ connection.index_exists?('test_table', 'test_column').must_equal true
+ end
+
describe "when index uniqueness is required" do
use_attribute_value DBNazi, :require_index_uniqueness, true
@@ -12,6 +12,13 @@
connection.create_table 'test_table'
end
+ it "still creates the column if ok" do
+ connection.change_table 'test_table', bulk: true do |t|
+ t.column 'test_column', :boolean, null: true
+ end
+ connection.column_exists?('test_table', 'test_column', :boolean, null: true).must_equal true
+ end
+
describe "when nullability is required" do
use_attribute_value DBNazi, :require_nullability, true
@@ -82,6 +89,13 @@
end
end
+ it "still creates the index if ok" do
+ connection.change_table 'test_table', bulk: true do |t|
+ t.index 'test_column', unique: false
+ end
+ connection.index_exists?('test_table', 'test_column', unique: false).must_equal true
+ end
+
describe "when index uniqueness is required" do
use_attribute_value DBNazi, :require_index_uniqueness, true
@@ -124,6 +138,13 @@
end
end
+ it "still changes the column if ok" do
+ connection.change_table 'test_table', bulk: true do |t|
+ t.change 'test_column', :integer, null: true
+ end
+ connection.column_exists?('test_table', 'test_column', :integer, null: true).must_equal true
+ end
+
describe "when nullability is required" do
use_attribute_value DBNazi, :require_nullability, true
@@ -8,6 +8,13 @@
end
describe "#column" do
+ it "still creates the column if ok" do
+ connection.create_table 'test_table' do |t|
+ t.column 'test_column', :boolean, null: true
+ end
+ connection.column_exists?('test_table', 'test_column', :boolean, null: true).must_equal true
+ end
+
describe "when nullability is required" do
use_attribute_value DBNazi, :require_nullability, true

0 comments on commit c674666

Please sign in to comment.