migration_tools 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -17,9 +17,13 @@ module MigrationTools
17
17
  @group
18
18
  end
19
19
 
20
+ def migrator
21
+ @migrator ||= ActiveRecord::Migrator.new(:up, 'db/migrate')
22
+ end
23
+
20
24
  def pending_migrations
21
25
  return @pending_migrations if @pending_migrations
22
- @pending_migrations = ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations
26
+ @pending_migrations = migrator.pending_migrations
23
27
  @pending_migrations = @pending_migrations.select { |proxy| group.empty? || proxy.migration_group == group }
24
28
 
25
29
  @pending_migrations
@@ -55,6 +59,7 @@ module MigrationTools
55
59
  else
56
60
  pending_migrations.each do |migration|
57
61
  migration.migrate(:up)
62
+ migrator.send(:record_version_state_after_migrating, migration.version)
58
63
  end
59
64
  end
60
65
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{migration_tools}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Morten Primdahl"]
@@ -117,9 +117,11 @@ class TestMigrationTools < Test::Unit::TestCase
117
117
 
118
118
  def test_migrate_group_with_pending
119
119
  ENV['GROUP'] = 'before'
120
- ActiveRecord::Migrator.expects(:new).returns(stub(:pending_migrations => proxies))
120
+ migrator = stub(:pending_migrations => proxies)
121
+ ActiveRecord::Migrator.expects(:new).returns(migrator)
121
122
  proxies.select { |p| p.migration_group == 'before' }.each do |p|
122
123
  p.expects(:migrate).with(:up).once
124
+ migrator.expects(:record_version_state_after_migrating).with(p.version).once
123
125
  end
124
126
 
125
127
  Rake::Task["db:migrate:group"].invoke
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: migration_tools
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
  - Morten Primdahl