ensured_schema 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/ensured_schema/version.rb +1 -1
- data/test/cases/ensured_schema_test.rb +28 -42
- metadata +3 -3
@@ -22,16 +22,12 @@ if ActiveRecord::Base.connection.supports_migrations?
|
|
22
22
|
|
23
23
|
def test_table_definition
|
24
24
|
assert_nothing_raised do
|
25
|
-
|
26
|
-
|
27
|
-
t.string :test, :limit => 30, :default => "", :null => false
|
28
|
-
end
|
25
|
+
@conn.table(:testings, :id => false, :force => true) do |t|
|
26
|
+
t.string :test, :limit => 30, :default => "", :null => false
|
29
27
|
end
|
30
28
|
|
31
|
-
|
32
|
-
|
33
|
-
t.string :test, :limit => 30, :default => "", :null => false
|
34
|
-
end
|
29
|
+
@conn.table(:testings, :id => false, :force => true) do |t|
|
30
|
+
t.string :test, :limit => 30, :default => "", :null => false
|
35
31
|
end
|
36
32
|
end
|
37
33
|
assert @conn.table_exists?("testings")
|
@@ -39,16 +35,14 @@ if ActiveRecord::Base.connection.supports_migrations?
|
|
39
35
|
|
40
36
|
def test_column_definition_does_not_raise
|
41
37
|
assert_nothing_raised do
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
t.column :test2, :string
|
51
|
-
end
|
38
|
+
@conn.table(:testings, :id => false, :force => true) do |t|
|
39
|
+
t.string :test, :limit => 30, :default => "", :null => false
|
40
|
+
t.column :test2, :string
|
41
|
+
end
|
42
|
+
@conn.table(:testings, :id => false, :force => true) do |t|
|
43
|
+
t.expects(:change).never
|
44
|
+
t.string :test, :limit => 30, :default => "", :null => false
|
45
|
+
t.column :test2, :string
|
52
46
|
end
|
53
47
|
end
|
54
48
|
end
|
@@ -171,13 +165,11 @@ if ActiveRecord::Base.connection.supports_migrations?
|
|
171
165
|
end
|
172
166
|
|
173
167
|
def test_column_gets_changed
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
t.string :test, :limit => 20, :default => "", :null => false
|
180
|
-
end
|
168
|
+
@conn.table(:testings, :id => false, :force => true) do |t|
|
169
|
+
t.string :test, :limit => 30, :default => "", :null => false
|
170
|
+
end
|
171
|
+
@conn.table(:testings, :id => false, :force => true) do |t|
|
172
|
+
t.string :test, :limit => 20, :default => "", :null => false
|
181
173
|
end
|
182
174
|
|
183
175
|
assert !@conn.column_exists?(:testings, :test, :string, :limit => 30)
|
@@ -187,19 +179,15 @@ if ActiveRecord::Base.connection.supports_migrations?
|
|
187
179
|
|
188
180
|
def test_column_is_removed_once
|
189
181
|
assert_nothing_raised do
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
t.remove(:test)
|
196
|
-
end
|
182
|
+
@conn.table(:testings, :id => false, :force => true) do |t|
|
183
|
+
t.string :test, :limit => 30, :default => "", :null => false
|
184
|
+
t.string :test2
|
185
|
+
t.remove(:test)
|
186
|
+
t.remove(:test)
|
197
187
|
end
|
198
188
|
|
199
|
-
|
200
|
-
|
201
|
-
t.remove(:test)
|
202
|
-
end
|
189
|
+
@conn.table(:testings, :id => false, :force => true) do |t|
|
190
|
+
t.remove(:test)
|
203
191
|
end
|
204
192
|
end
|
205
193
|
assert !@conn.column_exists?(:testings, :test)
|
@@ -207,13 +195,11 @@ if ActiveRecord::Base.connection.supports_migrations?
|
|
207
195
|
|
208
196
|
def test_ensure_index
|
209
197
|
assert_nothing_raised do
|
210
|
-
|
211
|
-
|
212
|
-
t.string :test, :limit => 30, :default => "", :null => false
|
213
|
-
end
|
214
|
-
ensure_index :testings, [:test], :name => "test_index", :unique => true
|
215
|
-
ensure_index :testings, [:test], :name => "test_index", :unique => true
|
198
|
+
@conn.table(:testings, :id => false, :force => true) do |t|
|
199
|
+
t.string :test, :limit => 30, :default => "", :null => false
|
216
200
|
end
|
201
|
+
@conn.ensure_index :testings, [:test], :name => "test_index", :unique => true
|
202
|
+
@conn.ensure_index :testings, [:test], :name => "test_index", :unique => true
|
217
203
|
end
|
218
204
|
assert @conn.new_index_exists?(:testings, :test, :name => "test_index")
|
219
205
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ensured_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Conley
|