ensured_schema 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module EnsuredSchema
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -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
- ActiveRecord::Schema.ensure(:version => '1') do
26
- table(:testings, :id => false, :force => true) do |t|
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
- ActiveRecord::Schema.ensure(:version => '1') do
32
- table(:testings, :id => false, :force => true) do |t|
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
- ActiveRecord::Schema.ensure(:version => '1') do
43
- table(:testings, :id => false, :force => true) do |t|
44
- t.string :test, :limit => 30, :default => "", :null => false
45
- t.column :test2, :string
46
- end
47
- table(:testings, :id => false, :force => true) do |t|
48
- t.expects(:change).never
49
- t.string :test, :limit => 30, :default => "", :null => false
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
- ActiveRecord::Schema.ensure(:version => '1') do
175
- table(:testings, :id => false, :force => true) do |t|
176
- t.string :test, :limit => 30, :default => "", :null => false
177
- end
178
- table(:testings, :id => false, :force => true) do |t|
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
- ActiveRecord::Schema.ensure(:version => '1') do
191
- table(:testings, :id => false, :force => true) do |t|
192
- t.string :test, :limit => 30, :default => "", :null => false
193
- t.string :test2
194
- t.remove(:test)
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
- ActiveRecord::Schema.ensure(:version => '1') do
200
- table(:testings, :id => false, :force => true) do |t|
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
- ActiveRecord::Schema.ensure(:version => '1') do
211
- table(:testings, :id => false, :force => true) do |t|
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: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Conley