migration_test_helper 1.3.2 → 1.3.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/Manifest.txt +39 -0
- data/README +4 -1
- data/Rakefile +7 -9
- data/generators/full_migration_test/USAGE +30 -0
- data/generators/full_migration_test/full_migration_test_generator.rb +10 -0
- data/generators/full_migration_test/templates/full_migration_test.rb +89 -0
- data/generators/migration_test/migration_test_generator.rb +33 -0
- data/generators/migration_test/templates/migration_test.rb +25 -0
- data/lib/migration_test_helper.rb +11 -3
- data/test/db/schema.rb +1 -0
- data/test/foundry_only_helper.rb +0 -2
- data/test/migration_test_generator_test.rb +15 -13
- data/test/migration_test_helper_test.rb +42 -5
- metadata +79 -62
data/Manifest.txt
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
.
|
2
|
+
./generators
|
3
|
+
./generators/full_migration_test
|
4
|
+
./generators/full_migration_test/full_migration_test_generator.rb
|
5
|
+
./generators/full_migration_test/templates
|
6
|
+
./generators/full_migration_test/templates/full_migration_test.rb
|
7
|
+
./generators/full_migration_test/USAGE
|
8
|
+
./generators/migration_test
|
9
|
+
./generators/migration_test/migration_test_generator.rb
|
10
|
+
./generators/migration_test/templates
|
11
|
+
./generators/migration_test/templates/migration_test.rb
|
12
|
+
./init.rb
|
13
|
+
./install.rb
|
14
|
+
./lib
|
15
|
+
./lib/migration_test_helper.rb
|
16
|
+
./LICENSE
|
17
|
+
./Manifest.txt
|
18
|
+
./Rakefile
|
19
|
+
./README
|
20
|
+
./tasks
|
21
|
+
./tasks/migration_test_helper_tasks.rake
|
22
|
+
./test
|
23
|
+
./test/config
|
24
|
+
./test/config/database.yml
|
25
|
+
./test/db
|
26
|
+
./test/db/migrate_bad
|
27
|
+
./test/db/migrate_bad/001_create_top_dogs.rb
|
28
|
+
./test/db/migrate_good
|
29
|
+
./test/db/migrate_good/001_create_top_dogs.rb
|
30
|
+
./test/db/migrate_good/002_create_bottom_dogs.rb
|
31
|
+
./test/db/migrate_good/003_create_cats.rb
|
32
|
+
./test/db/schema.rb
|
33
|
+
./test/foundry_only_helper.rb
|
34
|
+
./test/full_migration_test_generator_test.rb
|
35
|
+
./test/helper.rb
|
36
|
+
./test/log
|
37
|
+
./test/migration_test_generator_test.rb
|
38
|
+
./test/migration_test_helper_test.rb
|
39
|
+
./uninstall.rb
|
data/README
CHANGED
@@ -41,11 +41,12 @@ If you're using it outside of a Rails environment (for whatever reason) include
|
|
41
41
|
t.column :book_id, :integer
|
42
42
|
t.column :body, :text
|
43
43
|
t.column :rating, :integer, :default => 0
|
44
|
+
t.index :book_id, :name => 'index_book_id_on_reviews'
|
44
45
|
end
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
48
|
-
This would verify there are only two tables defined in the test database: _books_ and _reviews_ (schema_info is ignored). It will also verify that the _book_ table has the three columns, _id_, _title_ and _author_, each with their respective types.
|
49
|
+
This would verify there are only two tables defined in the test database: _books_ and _reviews_ (schema_info is ignored). It will also verify that the _book_ table has the three columns, _id_, _title_ and _author_, each with their respective types. Indexes are verified too.
|
49
50
|
|
50
51
|
|
51
52
|
*assert_table*: verify a table is found exactly as specified:
|
@@ -54,6 +55,7 @@ This would verify there are only two tables defined in the test database: _books
|
|
54
55
|
t.column :id, :integer
|
55
56
|
t.column :title, :string, :limit => 5
|
56
57
|
t.column :author, :string
|
58
|
+
t.index :author, :name => 'index_author_on_books'
|
57
59
|
end
|
58
60
|
|
59
61
|
|
@@ -101,6 +103,7 @@ By combining the two helpers you can write a test that shows you can run all you
|
|
101
103
|
t.column :book_id, :integer
|
102
104
|
t.column :body, :text
|
103
105
|
t.column :rating, :integer
|
106
|
+
t.index :book_id, :name => 'index_book_id_on_reviews'
|
104
107
|
end
|
105
108
|
end
|
106
109
|
end
|
data/Rakefile
CHANGED
@@ -16,7 +16,7 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
16
16
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
17
17
|
end
|
18
18
|
|
19
|
-
GEM_VERSION = '1.3.
|
19
|
+
GEM_VERSION = '1.3.3'
|
20
20
|
|
21
21
|
Hoe.new('migration_test_helper',GEM_VERSION) do |p|
|
22
22
|
p.author = "Micah Alles"
|
@@ -30,8 +30,6 @@ current state of the schema and executing migrations against the
|
|
30
30
|
test database.
|
31
31
|
EOS
|
32
32
|
|
33
|
-
p.gem_files = FileList["{test,lib,tasks}/**/*"] + %w|LICENSE README Rakefile init.rb install.rb uninstall.rb|
|
34
|
-
|
35
33
|
p.changes = <<-EOS
|
36
34
|
* fixed bug where test:migration was calling itself, thanks Patrick ;)
|
37
35
|
EOS
|
@@ -52,13 +50,13 @@ task :plugin_release do
|
|
52
50
|
status = `svn status`
|
53
51
|
raise "Please clean up before releasing.\n#{status}" unless status == ""
|
54
52
|
|
55
|
-
unless `svn ls svn+ssh://
|
56
|
-
sh "svn del svn+ssh://
|
53
|
+
unless `svn ls svn+ssh://swieton@rubyforge.org/var/svn/migrationtest/tags/rel-#{GEM_VERSION} -m`.strip.empty?
|
54
|
+
sh "svn del svn+ssh://swieton@rubyforge.org/var/svn/migrationtest/tags/rel-#{GEM_VERSION} -m 'Preparing to update stable release tag'"
|
57
55
|
end
|
58
|
-
sh "svn cp . svn+ssh://
|
59
|
-
unless `svn ls svn+ssh://
|
60
|
-
sh "svn del svn+ssh://
|
56
|
+
sh "svn cp . svn+ssh://swieton@rubyforge.org/var/svn/migrationtest/tags/rel-#{GEM_VERSION} -m 'Releasing version #{GEM_VERSION}'"
|
57
|
+
unless `svn ls svn+ssh://swieton@rubyforge.org/var/svn/migrationtest/tags/migration_test_helper`.strip.empty?
|
58
|
+
sh "svn del svn+ssh://swieton@rubyforge.org/var/svn/migrationtest/tags/migration_test_helper -m 'Preparing to update stable release tag'"
|
61
59
|
end
|
62
|
-
sh "svn cp . svn+ssh://
|
60
|
+
sh "svn cp . svn+ssh://swieton@rubyforge.org/var/svn/migrationtest/tags/migration_test_helper -m 'Updating stable tag to version #{GEM_VERSION}'"
|
63
61
|
end
|
64
62
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Description:
|
2
|
+
The controller generator creates stubs for a new controller and its views.
|
3
|
+
|
4
|
+
The generator takes a controller name and a list of views as arguments.
|
5
|
+
The controller name may be given in CamelCase or under_score and should
|
6
|
+
not be suffixed with 'Controller'. To create a controller within a
|
7
|
+
module, specify the controller name as 'module/controller'.
|
8
|
+
|
9
|
+
The generator creates a controller class in app/controllers with view
|
10
|
+
templates in app/views/controller_name, a helper class in app/helpers,
|
11
|
+
and a functional test suite in test/functional.
|
12
|
+
|
13
|
+
Example:
|
14
|
+
./script/generate controller CreditCard open debit credit close
|
15
|
+
|
16
|
+
Credit card controller with URLs like /credit_card/debit.
|
17
|
+
Controller: app/controllers/credit_card_controller.rb
|
18
|
+
Views: app/views/credit_card/debit.rhtml [...]
|
19
|
+
Helper: app/helpers/credit_card_helper.rb
|
20
|
+
Test: test/functional/credit_card_controller_test.rb
|
21
|
+
|
22
|
+
Modules Example:
|
23
|
+
./script/generate controller 'admin/credit_card' suspend late_fee
|
24
|
+
|
25
|
+
Credit card admin controller with URLs /admin/credit_card/suspend.
|
26
|
+
Controller: app/controllers/admin/credit_card_controller.rb
|
27
|
+
Views: app/views/admin/credit_card/debit.rhtml [...]
|
28
|
+
Helper: app/helpers/admin/credit_card_helper.rb
|
29
|
+
Test: test/functional/admin/credit_card_controller_test.rb
|
30
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
#
|
4
|
+
# This excercises the full set of migrations for your Rails app.
|
5
|
+
# It proves:
|
6
|
+
# - After full migration, the database is in the expected state, including:
|
7
|
+
# - All table structure
|
8
|
+
# - Default data (if any)
|
9
|
+
# - Full downward (version 0) migration functions correctly.
|
10
|
+
#
|
11
|
+
# YOU NEED TO:
|
12
|
+
# - Update "see_full_schema"
|
13
|
+
# - Update "see_data"
|
14
|
+
#
|
15
|
+
class FullMigrationTest < ActionController::IntegrationTest
|
16
|
+
|
17
|
+
#
|
18
|
+
# Transactional fixtures can, on occasion, cause migration tests to hang.
|
19
|
+
# Applying this setting here will turn transactional fixtures off for THIS
|
20
|
+
# SUITE ONLY
|
21
|
+
#
|
22
|
+
# self.use_transactional_fixtures = false
|
23
|
+
|
24
|
+
def conn
|
25
|
+
ActiveRecord::Base.connection
|
26
|
+
end
|
27
|
+
|
28
|
+
def see_empty_schema
|
29
|
+
assert_schema do |s|
|
30
|
+
# is nothing
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# Structure and Content assertions
|
36
|
+
#
|
37
|
+
|
38
|
+
# Fully assert db structure after full migration
|
39
|
+
def see_full_schema
|
40
|
+
# TODO: add assertions here to verify your schema was built
|
41
|
+
flunk "implement me"
|
42
|
+
|
43
|
+
#
|
44
|
+
# Something like this can be used to see the entire schema
|
45
|
+
# is as expeted.
|
46
|
+
#
|
47
|
+
# assert_schema do |s|
|
48
|
+
# s.table :cat_tails do |t|
|
49
|
+
# t.column :id, :integer
|
50
|
+
# t.column :name, :string
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# s.table :dogs do |t|
|
54
|
+
# t.column :id, :integer
|
55
|
+
# t.column :name, :string
|
56
|
+
# end
|
57
|
+
# end
|
58
|
+
|
59
|
+
#
|
60
|
+
# Alternatively individual tables can be checked.
|
61
|
+
#
|
62
|
+
# assert_table :cats_tails do |s|
|
63
|
+
# t.column :id, :integer
|
64
|
+
# t.column :name, :string
|
65
|
+
# end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Make sure data you expect your migrations to load are in there:
|
69
|
+
def see_default_data
|
70
|
+
# TODO: add assertions here to verify any default data was loaded
|
71
|
+
end
|
72
|
+
|
73
|
+
#
|
74
|
+
# TESTS
|
75
|
+
#
|
76
|
+
|
77
|
+
def test_full_migration
|
78
|
+
drop_all_tables
|
79
|
+
|
80
|
+
see_empty_schema
|
81
|
+
|
82
|
+
migrate
|
83
|
+
|
84
|
+
see_full_schema
|
85
|
+
|
86
|
+
see_default_data
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class MigrationTestGenerator < Rails::Generator::NamedBase
|
2
|
+
def manifest
|
3
|
+
schema_version = class_name.to_i
|
4
|
+
raise "Invalid schema version '#{class_name}'" unless schema_version > 0
|
5
|
+
|
6
|
+
schema_version_string = schema_version.to_s.rjust(3,'0')
|
7
|
+
|
8
|
+
migration = Dir["db/migrate/#{schema_version_string}*.rb"].first
|
9
|
+
raise "No migration found for schema version #{schema_version_string}" unless migration
|
10
|
+
|
11
|
+
migration_name = File.basename(migration,'.rb').sub(/^\d+_/,'')
|
12
|
+
test_class_name = migration_name.camelize + "Test"
|
13
|
+
test_file = "test/migration/#{schema_version_string}_#{migration_name}_test.rb"
|
14
|
+
|
15
|
+
record do |m|
|
16
|
+
m.directory 'test/migration'
|
17
|
+
m.template 'migration_test.rb', test_file, :assigns => {
|
18
|
+
:test_class_name => test_class_name,
|
19
|
+
:migration_name => migration_name,
|
20
|
+
:schema_version => schema_version,
|
21
|
+
:previous_schema_version => previous_schema_version(schema_version_string)
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def previous_schema_version(current_version_string)
|
27
|
+
versions = Dir["db/migrate/*.rb"].map do |migration_file|
|
28
|
+
migration_file.match(/db\/migrate\/(\d+)_.*\.rb/)[1]
|
29
|
+
end.sort
|
30
|
+
prev_index = versions.index(current_version_string) - 1
|
31
|
+
prev_index < 0 ? -1 : versions[prev_index].to_i
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
class <%= test_class_name %> < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def teardown
|
6
|
+
migrate
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_migration_should_<%= migration_name %>
|
10
|
+
drop_all_tables
|
11
|
+
|
12
|
+
migrate :version => <%= previous_schema_version %>
|
13
|
+
|
14
|
+
flunk "TODO: setup test data"
|
15
|
+
|
16
|
+
migrate :version => <%= schema_version %>
|
17
|
+
|
18
|
+
flunk "TODO: examine results"
|
19
|
+
|
20
|
+
migrate :version => <%= previous_schema_version %>
|
21
|
+
|
22
|
+
flunk "TODO: examine results"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -114,7 +114,7 @@ module MigrationTestHelper
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def verify #:nodoc:
|
117
|
-
actual_tables = conn.tables.reject {|t| t == 'schema_info' }
|
117
|
+
actual_tables = conn.tables.reject {|t| t == 'schema_info' || t == 'schema_migrations' }
|
118
118
|
expected_tables = @tables.map {|t| t.name }
|
119
119
|
assert_equal expected_tables.sort, actual_tables.sort, 'wrong tables in schema'
|
120
120
|
end
|
@@ -128,6 +128,7 @@ module MigrationTestHelper
|
|
128
128
|
def initialize(name) #:nodoc:
|
129
129
|
@name = name.to_s
|
130
130
|
@columns = []
|
131
|
+
@indexes = []
|
131
132
|
assert conn.tables.include?(@name), "table <#{@name}> not found in schema"
|
132
133
|
end
|
133
134
|
|
@@ -138,14 +139,21 @@ module MigrationTestHelper
|
|
138
139
|
assert_not_nil col, "column <#{colname}> not found in table <#{self.name}>"
|
139
140
|
assert_equal type, col.type, "wrong type for column <#{colname}> in table <#{name}>"
|
140
141
|
options.each do |k,v|
|
141
|
-
k = k.to_sym
|
142
|
-
assert_equal v,
|
142
|
+
k = k.to_sym; actual = col.send(k); actual = actual.is_a?(String) ? actual.sub(/'$/,'').sub(/^'/,'') : actual
|
143
|
+
assert_equal v, actual, "column <#{colname}> in table <#{name}> has wrong :#{k}"
|
143
144
|
end
|
144
145
|
end
|
145
146
|
|
147
|
+
def index(column_name, options = {})
|
148
|
+
@indexes << "name <#{options[:name]}> columns <#{Array(column_name).join(",")}> unique <#{options[:unique] == true}>"
|
149
|
+
end
|
150
|
+
|
146
151
|
def verify #:nodoc:
|
147
152
|
actual_columns = conn.columns(name).map {|c| c.name }
|
148
153
|
assert_equal @columns.sort, actual_columns.sort, "wrong columns for table: <#{name}>"
|
154
|
+
|
155
|
+
actual_indexes = conn.indexes(@name).collect { |i| "name <#{i.name}> columns <#{i.columns.join(",")}> unique <#{i.unique}>" }
|
156
|
+
assert_equal @indexes.sort, actual_indexes.sort, "wrong indexes for table: <#{name}>"
|
149
157
|
end
|
150
158
|
end
|
151
159
|
end
|
data/test/db/schema.rb
CHANGED
data/test/foundry_only_helper.rb
CHANGED
@@ -20,15 +20,17 @@ class MigrationTestGeneratorTest < Test::Unit::TestCase
|
|
20
20
|
# HELPERS
|
21
21
|
#
|
22
22
|
|
23
|
-
def generate_migration(
|
23
|
+
def generate_migration(name)
|
24
24
|
run_in_rails_root "script/generate migration #{name}"
|
25
|
-
|
25
|
+
@output =~ /create db\/migrate\/(\d+)_.*\.rb/
|
26
|
+
migration = $1
|
27
|
+
migration_file = "db/migrate/#{migration}_#{name}.rb"
|
26
28
|
assert File.exists?(migration_file), "Migration not there: #{migration_file}"
|
29
|
+
migration
|
27
30
|
end
|
28
31
|
|
29
32
|
def generate_migration_test(version)
|
30
33
|
run_in_rails_root "script/generate migration_test #{version}"
|
31
|
-
|
32
34
|
end
|
33
35
|
|
34
36
|
def rm_migrations
|
@@ -40,11 +42,11 @@ class MigrationTestGeneratorTest < Test::Unit::TestCase
|
|
40
42
|
#
|
41
43
|
|
42
44
|
in_foundry_should "generate a migration test for schema 1" do
|
43
|
-
generate_migration '
|
45
|
+
migration = generate_migration 'create_the_dogs_table'
|
44
46
|
|
45
|
-
generate_migration_test
|
47
|
+
generate_migration_test migration
|
46
48
|
|
47
|
-
migration_test_file = "test/migration
|
49
|
+
migration_test_file = "test/migration/#{migration}_create_the_dogs_table_test.rb"
|
48
50
|
assert File.exists?(migration_test_file), "Migration test not there: #{migration_test_file}"
|
49
51
|
|
50
52
|
run_in_rails_root "ruby #{migration_test_file}"
|
@@ -55,10 +57,10 @@ class MigrationTestGeneratorTest < Test::Unit::TestCase
|
|
55
57
|
end
|
56
58
|
|
57
59
|
in_foundry_should "generate a migration test for schema 2" do
|
58
|
-
generate_migration '
|
59
|
-
generate_migration '
|
60
|
-
generate_migration_test
|
61
|
-
migration_test_file = "test/migration
|
60
|
+
generate_migration 'create_the_dogs_table'
|
61
|
+
migration = generate_migration 'transfer_cats_data'
|
62
|
+
generate_migration_test migration
|
63
|
+
migration_test_file = "test/migration/#{migration}_transfer_cats_data_test.rb"
|
62
64
|
assert File.exists?(migration_test_file), "Migration test not there: #{migration_test_file}"
|
63
65
|
|
64
66
|
run_in_rails_root "ruby #{migration_test_file}"
|
@@ -69,19 +71,19 @@ class MigrationTestGeneratorTest < Test::Unit::TestCase
|
|
69
71
|
end
|
70
72
|
|
71
73
|
in_foundry_should "fail if no schema version is provided" do
|
72
|
-
generate_migration '
|
74
|
+
generate_migration 'create_the_dogs_table'
|
73
75
|
generate_migration_test ''
|
74
76
|
check_output 'Usage: script/generate migration_test MigrationTestName [options]'
|
75
77
|
end
|
76
78
|
|
77
79
|
in_foundry_should "fail if bad schema version is provided" do
|
78
|
-
generate_migration '
|
80
|
+
generate_migration 'create_the_dogs_table'
|
79
81
|
generate_migration_test 'oops'
|
80
82
|
check_output(/Invalid schema version 'oops'/i)
|
81
83
|
end
|
82
84
|
|
83
85
|
in_foundry_should "fail if schema version does not correspond to existing migration" do
|
84
|
-
generate_migration '
|
86
|
+
migration = generate_migration 'create_the_dogs_table'
|
85
87
|
generate_migration_test '2'
|
86
88
|
check_output "No migration found for schema version 002"
|
87
89
|
end
|
@@ -22,6 +22,11 @@ class MigrationTestHelperTest < Test::Unit::TestCase
|
|
22
22
|
yield
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
def declare_columns_on_table(t)
|
27
|
+
t.column :id, :integer
|
28
|
+
t.column :tail, :string, :default => 'top dog', :limit => 187
|
29
|
+
end
|
25
30
|
|
26
31
|
#
|
27
32
|
# TESTS
|
@@ -30,9 +35,10 @@ class MigrationTestHelperTest < Test::Unit::TestCase
|
|
30
35
|
see_no_failure do
|
31
36
|
assert_schema do |s|
|
32
37
|
s.table :dogs do |t|
|
33
|
-
|
34
|
-
|
38
|
+
declare_columns_on_table(t)
|
39
|
+
t.index :tail, :name => 'index_tail_on_dogs'
|
35
40
|
end
|
41
|
+
|
36
42
|
end
|
37
43
|
end
|
38
44
|
end
|
@@ -88,8 +94,8 @@ class MigrationTestHelperTest < Test::Unit::TestCase
|
|
88
94
|
def test_assert_table_should_not_fail_if_table_is_matched
|
89
95
|
see_no_failure do
|
90
96
|
assert_table :dogs do |t|
|
91
|
-
t
|
92
|
-
|
97
|
+
declare_columns_on_table(t)
|
98
|
+
t.index :tail, :name => 'index_tail_on_dogs'
|
93
99
|
end
|
94
100
|
end
|
95
101
|
end
|
@@ -129,8 +135,39 @@ class MigrationTestHelperTest < Test::Unit::TestCase
|
|
129
135
|
end
|
130
136
|
end
|
131
137
|
|
138
|
+
def test_assert_table_should_fail_if_an_index_is_not_specified
|
139
|
+
see_failure 'wrong indexes for table: <dogs>' do
|
140
|
+
assert_table :dogs do |t|
|
141
|
+
declare_columns_on_table(t)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_assert_schema_should_fail_if_a_column_in_an_index_is_not_found
|
147
|
+
see_failure 'wrong indexes for table: <dogs>' do
|
148
|
+
assert_table :dogs do |t|
|
149
|
+
declare_columns_on_table(t)
|
150
|
+
t.index :legs, :name => 'index_legs_on_dogs'
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_assert_schema_should_fail_if_wrong_options_on_an_index
|
156
|
+
see_failure 'wrong indexes for table: <dogs>' do
|
157
|
+
assert_table :dogs do |t|
|
158
|
+
declare_columns_on_table(t)
|
159
|
+
t.index :tail, :name => 'index_tail_on_dogs', :unique => true
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
132
164
|
def test_should_drop_all_tables
|
133
|
-
|
165
|
+
if Rails::VERSION::MAJOR >= 2 && Rails::VERSION::MINOR >= 1
|
166
|
+
schema_table = 'schema_migrations'
|
167
|
+
else
|
168
|
+
schema_table = 'schema_info'
|
169
|
+
end
|
170
|
+
assert_equal ['dogs', schema_table].sort, ActiveRecord::Base.connection.tables.sort
|
134
171
|
drop_all_tables
|
135
172
|
assert_equal [], ActiveRecord::Base.connection.tables
|
136
173
|
drop_all_tables
|
metadata
CHANGED
@@ -1,77 +1,94 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.0
|
3
|
-
specification_version: 1
|
4
2
|
name: migration_test_helper
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.3.
|
7
|
-
date: 2007-03-31 00:00:00 -04:00
|
8
|
-
summary: A Rails plugin for testing migrations
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: micah@atomicobject.com
|
12
|
-
homepage: http://migrationtest.rubyforge.org
|
13
|
-
rubyforge_project: migrationtest
|
14
|
-
description: migration_test_helper makes testing your migrations easier by adding helper methods to Test::Unit::TestCase for asserting the current state of the schema and executing migrations against the test database.
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 1.3.3
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Micah Alles
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
- test/foundry_only_helper.rb
|
35
|
-
- test/full_migration_test_generator_test.rb
|
36
|
-
- test/helper.rb
|
37
|
-
- test/log
|
38
|
-
- test/migration_test_generator_test.rb
|
39
|
-
- test/migration_test_helper_test.rb
|
40
|
-
- test/config/database.yml
|
41
|
-
- test/db/migrate_bad
|
42
|
-
- test/db/migrate_good
|
43
|
-
- test/db/schema.rb
|
44
|
-
- test/db/migrate_bad/001_create_top_dogs.rb
|
45
|
-
- test/db/migrate_good/001_create_top_dogs.rb
|
46
|
-
- test/db/migrate_good/002_create_bottom_dogs.rb
|
47
|
-
- test/db/migrate_good/003_create_cats.rb
|
48
|
-
- lib/migration_test_helper.rb
|
49
|
-
- tasks/migration_test_helper_tasks.rake
|
50
|
-
- LICENSE
|
51
|
-
- README
|
52
|
-
- Rakefile
|
53
|
-
- init.rb
|
54
|
-
- install.rb
|
55
|
-
- uninstall.rb
|
56
|
-
test_files: []
|
57
|
-
|
58
|
-
rdoc_options: []
|
59
|
-
|
60
|
-
extra_rdoc_files: []
|
61
|
-
|
62
|
-
executables: []
|
63
|
-
|
64
|
-
extensions: []
|
65
|
-
|
66
|
-
requirements: []
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
67
11
|
|
12
|
+
date: 2009-12-04 00:00:00 -05:00
|
13
|
+
default_executable:
|
68
14
|
dependencies:
|
69
15
|
- !ruby/object:Gem::Dependency
|
70
16
|
name: hoe
|
17
|
+
type: :development
|
71
18
|
version_requirement:
|
72
|
-
version_requirements: !ruby/object:Gem::
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
20
|
requirements:
|
74
21
|
- - ">="
|
75
22
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
23
|
+
version: 2.3.3
|
77
24
|
version:
|
25
|
+
description: |
|
26
|
+
migration_test_helper makes testing your migrations easier by
|
27
|
+
adding helper methods to Test::Unit::TestCase for asserting the
|
28
|
+
current state of the schema and executing migrations against the
|
29
|
+
test database.
|
30
|
+
|
31
|
+
email: micah@atomicobject.com
|
32
|
+
executables: []
|
33
|
+
|
34
|
+
extensions: []
|
35
|
+
|
36
|
+
extra_rdoc_files:
|
37
|
+
- ./Manifest.txt
|
38
|
+
files:
|
39
|
+
- ./generators/full_migration_test/full_migration_test_generator.rb
|
40
|
+
- ./generators/full_migration_test/templates/full_migration_test.rb
|
41
|
+
- ./generators/full_migration_test/USAGE
|
42
|
+
- ./generators/migration_test/migration_test_generator.rb
|
43
|
+
- ./generators/migration_test/templates/migration_test.rb
|
44
|
+
- ./init.rb
|
45
|
+
- ./install.rb
|
46
|
+
- ./lib/migration_test_helper.rb
|
47
|
+
- ./LICENSE
|
48
|
+
- ./Manifest.txt
|
49
|
+
- ./Rakefile
|
50
|
+
- ./README
|
51
|
+
- ./tasks/migration_test_helper_tasks.rake
|
52
|
+
- ./test/config/database.yml
|
53
|
+
- ./test/db/migrate_bad/001_create_top_dogs.rb
|
54
|
+
- ./test/db/migrate_good/001_create_top_dogs.rb
|
55
|
+
- ./test/db/migrate_good/002_create_bottom_dogs.rb
|
56
|
+
- ./test/db/migrate_good/003_create_cats.rb
|
57
|
+
- ./test/db/schema.rb
|
58
|
+
- ./test/foundry_only_helper.rb
|
59
|
+
- ./test/full_migration_test_generator_test.rb
|
60
|
+
- ./test/helper.rb
|
61
|
+
- ./test/migration_test_generator_test.rb
|
62
|
+
- ./test/migration_test_helper_test.rb
|
63
|
+
- ./uninstall.rb
|
64
|
+
has_rdoc: true
|
65
|
+
homepage: http://migrationtest.rubyforge.org
|
66
|
+
licenses: []
|
67
|
+
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options:
|
70
|
+
- --main
|
71
|
+
- README.txt
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
version:
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: "0"
|
85
|
+
version:
|
86
|
+
requirements: []
|
87
|
+
|
88
|
+
rubyforge_project: migrationtest
|
89
|
+
rubygems_version: 1.3.5
|
90
|
+
signing_key:
|
91
|
+
specification_version: 3
|
92
|
+
summary: A Rails plugin for testing migrations
|
93
|
+
test_files: []
|
94
|
+
|