my_enginery 0.2.8

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.
Files changed (118) hide show
  1. data/.gitignore +18 -0
  2. data/.travis.yml +9 -0
  3. data/CHANGELOG.md +14 -0
  4. data/Gemfile +12 -0
  5. data/LICENSE +19 -0
  6. data/README.md +957 -0
  7. data/Rakefile +48 -0
  8. data/app/base/.pryrc +1 -0
  9. data/app/base/Gemfile +25 -0
  10. data/app/base/Rakefile +4 -0
  11. data/app/base/app.rb +8 -0
  12. data/app/base/base/boot.rb +45 -0
  13. data/app/base/base/config.rb +127 -0
  14. data/app/base/base/controllers/rear-controllers/.gitkeep +0 -0
  15. data/app/base/base/database.rb +3 -0
  16. data/app/base/base/helpers/application_helpers.rb +3 -0
  17. data/app/base/base/migrations/.gitkeep +0 -0
  18. data/app/base/base/models/.gitkeep +0 -0
  19. data/app/base/base/specs/.gitkeep +0 -0
  20. data/app/base/base/views/.gitkeep +0 -0
  21. data/app/base/config.ru +4 -0
  22. data/app/base/config/config.yml +17 -0
  23. data/app/base/public/assets/Enginery.png +0 -0
  24. data/app/base/public/assets/Espresso.png +0 -0
  25. data/app/base/public/assets/application.css +13 -0
  26. data/app/base/public/assets/application.js +2 -0
  27. data/app/base/public/assets/bootstrap/css/bootstrap-responsive.min.css +9 -0
  28. data/app/base/public/assets/bootstrap/css/bootstrap.min.css +9 -0
  29. data/app/base/public/assets/bootstrap/img/glyphicons-halflings-white.png +0 -0
  30. data/app/base/public/assets/bootstrap/img/glyphicons-halflings.png +0 -0
  31. data/app/base/public/assets/bootstrap/js/bootstrap.min.js +6 -0
  32. data/app/base/public/assets/jquery.js +6 -0
  33. data/app/base/var/db/.gitkeep +0 -0
  34. data/app/base/var/log/.gitkeep +0 -0
  35. data/app/base/var/pid/.gitkeep +0 -0
  36. data/app/database/ActiveRecord.rb +11 -0
  37. data/app/database/DataMapper.rb +11 -0
  38. data/app/database/Sequel.rb +11 -0
  39. data/app/database/mysql.yml +24 -0
  40. data/app/database/postgres.yml +24 -0
  41. data/app/database/sqlite.yml +24 -0
  42. data/app/gemfiles/ActiveRecord.rb +1 -0
  43. data/app/gemfiles/BlueCloth.rb +1 -0
  44. data/app/gemfiles/DataMapper.rb +1 -0
  45. data/app/gemfiles/FastCGI.rb +1 -0
  46. data/app/gemfiles/Puma.rb +1 -0
  47. data/app/gemfiles/RDiscount.rb +1 -0
  48. data/app/gemfiles/RDoc.rb +1 -0
  49. data/app/gemfiles/RedCloth.rb +1 -0
  50. data/app/gemfiles/WEBrick.rb +1 -0
  51. data/app/gemfiles/WikiCloth.rb +1 -0
  52. data/app/gemfiles/mysql/ActiveRecord.rb +1 -0
  53. data/app/gemfiles/mysql/DataMapper.rb +1 -0
  54. data/app/gemfiles/mysql/Sequel.rb +1 -0
  55. data/app/gemfiles/postgres/ActiveRecord.rb +1 -0
  56. data/app/gemfiles/postgres/DataMapper.rb +1 -0
  57. data/app/gemfiles/postgres/Sequel.rb +1 -0
  58. data/app/gemfiles/sqlite/ActiveRecord.rb +1 -0
  59. data/app/gemfiles/sqlite/DataMapper.rb +1 -0
  60. data/app/gemfiles/sqlite/Sequel.rb +1 -0
  61. data/app/layouts/ERB/layout.erb +56 -0
  62. data/app/layouts/Erubis/layout.erb +56 -0
  63. data/app/layouts/Haml/layout.haml +38 -0
  64. data/app/layouts/Slim/layout.slim +38 -0
  65. data/app/migrations/ActiveRecord.erb +51 -0
  66. data/app/migrations/DataMapper.erb +61 -0
  67. data/app/migrations/Sequel.erb +54 -0
  68. data/app/migrations/tracking_table/ActiveRecord.rb +19 -0
  69. data/app/migrations/tracking_table/DataMapper.rb +26 -0
  70. data/app/migrations/tracking_table/Sequel.rb +18 -0
  71. data/app/rakefiles/ActiveRecord.rb +0 -0
  72. data/app/rakefiles/DataMapper.rb +1 -0
  73. data/app/rakefiles/Sequel.rb +0 -0
  74. data/app/rakefiles/Specular.rb +1 -0
  75. data/app/specfiles/Specular.erb +7 -0
  76. data/bin/my_enginery +235 -0
  77. data/lib/enginery.rb +23 -0
  78. data/lib/enginery/cli.rb +44 -0
  79. data/lib/enginery/configurator.rb +139 -0
  80. data/lib/enginery/delete.rb +116 -0
  81. data/lib/enginery/enginery.rb +41 -0
  82. data/lib/enginery/generator.rb +325 -0
  83. data/lib/enginery/helpers/app.rb +83 -0
  84. data/lib/enginery/helpers/generic.rb +145 -0
  85. data/lib/enginery/helpers/input.rb +123 -0
  86. data/lib/enginery/helpers/orm.rb +86 -0
  87. data/lib/enginery/helpers/validations.rb +101 -0
  88. data/lib/enginery/migrator.rb +371 -0
  89. data/lib/enginery/rake-tasks/data_mapper.rb +49 -0
  90. data/lib/enginery/rake-tasks/specular.rb +41 -0
  91. data/lib/enginery/registry.rb +101 -0
  92. data/lib/enginery/usage.rb +66 -0
  93. data/lib/enginery/version.rb +7 -0
  94. data/logo.png +0 -0
  95. data/my_enginery.gemspec +37 -0
  96. data/test/delete/test__admin.rb +49 -0
  97. data/test/delete/test__controller.rb +37 -0
  98. data/test/delete/test__helper.rb +49 -0
  99. data/test/delete/test__migration.rb +27 -0
  100. data/test/delete/test__model.rb +35 -0
  101. data/test/delete/test__route.rb +35 -0
  102. data/test/delete/test__spec.rb +59 -0
  103. data/test/delete/test__view.rb +51 -0
  104. data/test/generator/test__admin.rb +39 -0
  105. data/test/generator/test__controller.rb +123 -0
  106. data/test/generator/test__helper.rb +56 -0
  107. data/test/generator/test__model.rb +206 -0
  108. data/test/generator/test__project.rb +81 -0
  109. data/test/generator/test__route.rb +110 -0
  110. data/test/generator/test__spec.rb +56 -0
  111. data/test/generator/test__view.rb +85 -0
  112. data/test/migrator/test__auto_generation.rb +41 -0
  113. data/test/migrator/test__manual_generation.rb +59 -0
  114. data/test/migrator/test__migrations.rb +139 -0
  115. data/test/sandbox/.gitkeep +0 -0
  116. data/test/setup.rb +29 -0
  117. data/test/support/spec_helpers.rb +151 -0
  118. metadata +392 -0
@@ -0,0 +1,81 @@
1
+ module Enginery
2
+ module Test
3
+ module ProjectGenerator
4
+
5
+ Spec.new self do
6
+
7
+ Dir.chdir DST_ROOT do
8
+
9
+ Should 'create a basic project, without any setups' do
10
+ is(new_app 'App').ok?
11
+ is(File).directory? 'App'
12
+
13
+ Should 'fail cause folder already contain an app' do
14
+ does(new_app 'App').fail_with? /should be a empty folder/
15
+ end
16
+ end
17
+ cleanup
18
+
19
+ [
20
+ ['ActiveRecord', 'activerecord'],
21
+ ['DataMapper', 'data_mapper'],
22
+ ['Sequel', 'sequel']
23
+ ].each do |(o,g)|
24
+ Testing o do
25
+ cleanup
26
+
27
+ is(new_app "App orm:#{o}").ok?
28
+
29
+ Dir.chdir 'App' do
30
+ Ensure 'config.yml updated' do
31
+ expect {
32
+ File.read 'config/config.yml'
33
+ } =~ /orm\W+#{o}/i
34
+ end
35
+
36
+ Ensure 'Gemfile updated' do
37
+ expect {
38
+ File.read 'Gemfile'
39
+ } =~ /gem\W+#{g}/i
40
+ end
41
+
42
+ Ensure 'database.rb updated' do
43
+ expect {
44
+ File.read 'base/database.rb'
45
+ } =~ /#{o}/
46
+ end
47
+ end
48
+ end
49
+ end
50
+ cleanup
51
+
52
+ %w[Haml Slim].each do |engine|
53
+ Testing engine do
54
+ cleanup
55
+ is(new_app "App engine:#{engine} format:#{engine}").ok?
56
+
57
+ Dir.chdir 'App' do
58
+ Ensure 'config.yml updated' do
59
+ cfg = nil
60
+ expect {
61
+ cfg = File.read 'config/config.yml'
62
+ } =~ /engine\W+#{engine}/i
63
+ expect { cfg } =~ /format\W+#{engine}/
64
+ end
65
+
66
+ Ensure 'Gemfile updated' do
67
+ expect {
68
+ File.read 'Gemfile'
69
+ } =~ /gem\W+#{engine}/im
70
+ end
71
+ end
72
+
73
+ end
74
+ end
75
+ cleanup
76
+
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,110 @@
1
+ module Enginery
2
+ module Test
3
+ module RouteGenerator
4
+ Spec.new self do
5
+
6
+ Should 'fail cause not inside Espresso application' do
7
+ does(new_route 'Foo bar').fail_with? /not.*Espresso.*application/im
8
+ end
9
+
10
+ Dir.chdir DST_ROOT do
11
+ Testing do
12
+
13
+ is(new_app 'App').ok?
14
+
15
+ Dir.chdir 'App' do
16
+
17
+ Should 'fail with "controller does not exists"' do
18
+ does(new_route 'Foo bar').fail_with? =~ /controller does not exists/
19
+ end
20
+
21
+ is(new_controller 'Foo').ok?
22
+
23
+ Should 'create a basic route' do
24
+ is(new_route 'Foo bar').ok?
25
+
26
+ file = 'base/controllers/foo/bar.rb'
27
+ is(File).file? file
28
+ expect(File.read file) =~ /def\s+bar\n/
29
+ end
30
+
31
+ Should 'create a route with setups' do
32
+ is(new_route 'Foo setuped engine:Slim format:html').ok?
33
+
34
+ file = 'base/controllers/foo/setuped.rb'
35
+ is(File).file? file
36
+ code = File.read file
37
+ expect(code) =~ /format_for\s+:setuped\,\s+\Whtml/
38
+ expect(code) =~ /before\s+:setuped\s+do[\n|\s]+engine\s+:Slim/
39
+ expect(code) =~ /def\s+setuped/m
40
+ end
41
+
42
+ Should 'correctly convert route into file and method names' do
43
+ {
44
+ 'bar/baz' => 'bar__baz',
45
+ 'bar-baz' => 'bar___baz',
46
+ 'bar.baz' => 'bar____baz',
47
+ }.each_pair do |route, meth|
48
+ Testing "#{route} to #{meth}" do
49
+ is(new_route "Foo #{route}").ok?
50
+
51
+ file = "base/controllers/foo/#{meth}.rb"
52
+ is(File).file? file
53
+ expect(File.read file) =~ /def\s+#{meth}/
54
+ end
55
+ end
56
+ end
57
+
58
+ Should 'inherit engine defined at controller generation' do
59
+ is(new_controller 'Pages e:Slim').ok?
60
+ is(new_route 'Pages edit').ok?
61
+
62
+ is(File).file? 'base/views/pages/edit.slim'
63
+
64
+ And 'override it when explicitly given' do
65
+ is(new_route 'Pages create e:Haml').ok?
66
+
67
+ is(File).file? 'base/views/pages/create.haml'
68
+ end
69
+ end
70
+
71
+ end
72
+ end
73
+ cleanup
74
+
75
+ Should 'inherit engine defined at project generation' do
76
+ is(new_app 'App e:Slim').ok?
77
+
78
+ Dir.chdir 'App' do
79
+ is(new_controller 'Foo').ok?
80
+ is(new_route 'Foo bar').ok?
81
+
82
+ is(File).file? 'base/views/foo/bar.slim'
83
+ end
84
+ end
85
+ cleanup
86
+
87
+ Should 'create multiple routes' do
88
+ is(new_app 'App').ok?
89
+
90
+ Dir.chdir 'App' do
91
+ is(new_controller 'Foo').ok?
92
+ are(new_routes 'Foo a b c e:Slim').ok?
93
+
94
+ %w[a b c].each do |r|
95
+ Testing "#{r} route" do
96
+ file = "base/controllers/foo/#{r}.rb"
97
+ is(File).file? file
98
+ code = File.read file
99
+ expect {code} =~ /class Foo\n/i
100
+ is(File).file? "base/views/foo/#{r}.slim"
101
+ end
102
+ end
103
+ end
104
+ end
105
+ cleanup
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,56 @@
1
+ module Enginery
2
+ module Test
3
+ module SpecGenerator
4
+
5
+ Spec.new self do
6
+
7
+ Dir.chdir DST_ROOT do
8
+ is(new_app 'App').ok?
9
+ Dir.chdir 'App' do
10
+ does(File.read 'Rakefile') =~ /specular/
11
+
12
+ Should 'be created alongside route' do
13
+ is(new_controller 'A').ok?
14
+
15
+ Ensure 'it generated specs for A controller' do
16
+ is(File).file? 'base/specs/a/index%s' % Enginery::SPEC_SUFFIX
17
+ does( new_test ' -D' ) =~ /test\:A/
18
+
19
+ Ensure 'auto-generated spec runs well' do
20
+ are( new_test 'A' ).ok?
21
+ end
22
+ end
23
+
24
+ Should 'play well with namespaced controllers' do
25
+ is(new_controller 'X::Y::Z').ok?
26
+ is(new_route 'X::Y::Z foo').ok?
27
+ is(File).file? 'base/specs/x/y/z/foo%s' % Enginery::SPEC_SUFFIX
28
+ end
29
+
30
+ Ensure 'all specs are detected and runs well' do
31
+ are(all_tests).ok? do |output|
32
+ check( output ) =~ /Specs:\s+4/
33
+ end
34
+ end
35
+
36
+ Should 'be created manually' do
37
+ is(new_controller 'B').ok?
38
+ is(new_route 'B foo').ok?
39
+ spec_file = 'base/specs/b/foo%s' % Enginery::SPEC_SUFFIX
40
+ is(File).file? spec_file
41
+ FileUtils.rm spec_file
42
+ refute(File).file? spec_file
43
+
44
+ is(new_spec 'B foo').ok?
45
+ is(File).file? spec_file
46
+ end
47
+ end
48
+
49
+
50
+ end
51
+ end
52
+ end
53
+
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,85 @@
1
+ module Enginery
2
+ module Test
3
+ module ViewGenerator
4
+ Spec.new self do
5
+
6
+ Should 'fail cause not inside Espresso application' do
7
+ does(new_view 'Foo bar').fail_with? =~ /not.*Espresso.*application/im
8
+ end
9
+
10
+ Dir.chdir DST_ROOT do
11
+ Testing do
12
+
13
+ is(new_app 'App').ok?
14
+
15
+ Dir.chdir 'App' do
16
+ Should 'fail with "controller does not exists"' do
17
+ does(new_view 'Foo bar').fail_with? =~ /controller does not exists/
18
+ end
19
+
20
+ is(new_controller 'Foo').ok?
21
+
22
+ Should 'fail with "action does not exists"' do
23
+ does(new_view 'Foo bar').fail_with? =~ /action does not exists/
24
+ end
25
+
26
+ Ensure 'template automatically created at route generation' do
27
+ is(new_route 'Foo bar').ok?
28
+ is(File).file? 'base/views/foo/bar.erb'
29
+ end
30
+
31
+ Should 'correctly convert route to template name' do
32
+ is(new_route 'Foo bar/baz').ok?
33
+ is(File).file? 'base/views/foo/bar__baz.erb'
34
+ end
35
+
36
+ Should "use controller name for path to templates" do
37
+ is(new_controller 'Bar r:bars_base_addr').ok?
38
+ is(new_route 'Bar some_route').ok?
39
+ is(File).file? 'base/views/bar/some_route.erb'
40
+ end
41
+
42
+ Should 'correctly handle namespaces' do
43
+ is(new_controller 'A::B::C').ok?
44
+ dir = 'base/views/a/b/c'
45
+ is(File).directory? dir
46
+ file = dir + '/index.erb'
47
+ is(File).file? file
48
+ end
49
+ end
50
+ end
51
+ cleanup
52
+
53
+ Ensure 'extension correctly set' do
54
+ is(new_app 'App e:Sass').ok?
55
+
56
+ Dir.chdir 'App' do
57
+ When 'engine are set at project generation' do
58
+ is(new_controller 'ESP').ok?
59
+
60
+ is(new_route 'ESP foo').ok?
61
+ is(File).file? 'base/views/esp/foo.sass'
62
+ end
63
+
64
+ And 'when engine are set at controller generation' do
65
+ is(new_controller 'ESC e:Slim').ok?
66
+
67
+ is(new_route 'ESC foo').ok?
68
+ is(File).file? 'base/views/esc/foo.slim'
69
+
70
+ And 'when engine are set at route generation' do
71
+
72
+ is(new_route 'ESC bar e:Haml').ok?
73
+ is(File).file? 'base/views/esc/bar.haml'
74
+ end
75
+ end
76
+
77
+ end
78
+ end
79
+ cleanup
80
+ end
81
+
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,41 @@
1
+ module Enginery
2
+ module Test
3
+ ORMs.each do |orm|
4
+ Spec.new orm + 'Migrator' do
5
+
6
+ Dir.chdir DST_ROOT do
7
+ Testing do
8
+
9
+ is(new_app "App o:#{orm}").ok?
10
+
11
+ Dir.chdir 'App' do
12
+
13
+ Ensure 'valid migration generated alongside with generated model' do
14
+ is(new_model 'A column:name column:about:text').ok?
15
+ is(migrate_up! 1).ok?
16
+
17
+ Ensure 'all columns are in place' do
18
+ table = table('as')
19
+ check(table).has_column('name', :string)
20
+ check(table).has_column('about', :text)
21
+ end
22
+
23
+ Ensure 'migrator plays well with namespaces' do
24
+ is(new_model 'X::Y::Z column:name').ok?
25
+
26
+ is(migrate_up! 2).ok?
27
+
28
+ table = table(orm == 'DataMapper' ? 'x_y_zs' : 'zs')
29
+ check(table).has_column('name', :string)
30
+ end
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+ cleanup
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,59 @@
1
+ module Enginery
2
+ module Test
3
+ ORMs.each do |orm|
4
+ Spec.new orm + 'Migrator' do
5
+
6
+ Dir.chdir DST_ROOT do
7
+ Testing do
8
+
9
+ is(new_app "App o:#{orm}").ok?
10
+
11
+ Dir.chdir 'App' do
12
+
13
+ Context 'creating model' do
14
+ is(new_model 'A column:name').ok?
15
+
16
+ Context 'adding new column' do
17
+ is(new_migration 'addAboutColumn model:A column:about:text').ok?
18
+
19
+ Context 'running "up" auto-generated migration' do
20
+ is(migrate_up! 1).ok?
21
+
22
+ Context 'running "up" manually added migration' do
23
+ is(migrate_up! 2).ok?
24
+
25
+ Ensure 'all columns are in place' do
26
+ table = table('as')
27
+ check(table).has_column('name', :string)
28
+ check(table).has_column('about', :text)
29
+
30
+ Context 'running "down" manual migration' do
31
+ Should 'drop "about" column' do
32
+ is(migrate_down! 2).ok?
33
+ check(table 'as').has_no_column 'about'
34
+ end
35
+ end
36
+
37
+ Context 'running "down" auto-migration' do
38
+ Should 'drop model table' do
39
+ is(migrate_down! 1).ok?
40
+ expect { table 'as' }.to_raise_error Mysql::Error
41
+ end
42
+ end
43
+
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ end
51
+
52
+ end
53
+ cleanup
54
+ end
55
+
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,139 @@
1
+ module Enginery
2
+ module Test
3
+
4
+ ORMs.each do |orm|
5
+ Spec.new orm + 'Migrator' do
6
+
7
+ Dir.chdir DST_ROOT do
8
+ Testing do
9
+
10
+ is(new_app "App o:#{orm}").ok?
11
+
12
+ Dir.chdir 'App' do
13
+
14
+ Context 'creating model. this will also generate a migration' do
15
+ is(new_model 'A add_column:name').ok?
16
+ is(migrate_up! 1).ok?
17
+
18
+ Should 'skip repetitive "up" migrations' do
19
+ is(migrate_up! 1).skipped?
20
+ end
21
+
22
+ Context 'performing migration down' do
23
+ is(migrate_down! 1).ok?
24
+
25
+ Should 'skip repetitive "down" migrations' do
26
+ is(migrate_down! 1).skipped?
27
+ end
28
+
29
+ Ensure '"up" migration runs ok after "down" migration performed' do
30
+ is(migrate_up! 1).ok?
31
+ end
32
+
33
+ Context 'adding/updating columns' do
34
+ is(new_migration("addEmail model:A add_column:email:string")).ok?
35
+
36
+ Ensure '"up" is adding "email" column and "down" is dropping it' do
37
+ check(table('as')).has_no_column('email')
38
+
39
+ is(migrate_up! 2).ok?
40
+ check(table('as')).has_column('email', :string)
41
+
42
+ is(migrate_down! 2).ok?
43
+ check(table('as')).has_no_column('email')
44
+
45
+ Ensure 'up migration runs ok after down migration performed' do
46
+ is(migrate_up! 2).ok?
47
+ check(table('as')).has_column('email', :string)
48
+
49
+ Ensure '"up" is changing "email" type to "text"' do
50
+ is(new_migration("chEmail model:A update_column:email:text")).ok?
51
+
52
+ is(migrate_up! 3).ok?
53
+ check(table('as')).has_column('email', :text)
54
+
55
+ And '"down" is reverting it to "string"' do
56
+ is(migrate_down! 3).ok?
57
+ check(table('as')).has_column('email', :string)
58
+ end
59
+ end
60
+
61
+ end
62
+ end
63
+ end
64
+ end
65
+
66
+ if orm == 'DataMapper'
67
+ # running this test only on DataMapper
68
+ model_file = 'base/models/a.rb'
69
+
70
+ Should 'update model file by adding/updating properties' do
71
+
72
+ is(new_migration("addFoo model:A column:foo")).ok?
73
+
74
+ refute(File.read(model_file)) =~ /property\W+foo/
75
+ migrate_up!(4)
76
+ does(File.read(model_file)) =~ /property\W+foo/
77
+
78
+ Ensure 'foo type updated' do
79
+ does(File.read(model_file)) =~ /property\W+foo\W+String/
80
+ is(new_migration("updateBAR model:A update_column:foo:text")).ok?
81
+ migrate_up!(5)
82
+ refute(File.read(model_file)) =~ /property\W+foo\W+String/
83
+ does(File.read(model_file)) =~ /property\W+foo\W+Text/
84
+ end
85
+
86
+ Ensure 'foo renamed to bar' do
87
+ is(new_migration("fooTObar model:A rename_column:foo:bar")).ok?
88
+ migrate_up!(6)
89
+ refute(File.read(model_file)) =~ /property\W+foo/
90
+ does(File.read(model_file)) =~ /property\W+bar/
91
+ end
92
+
93
+ end
94
+
95
+ Should 'update model file by removing properties' do
96
+ is(new_migration("addRemoveMe model:A column:removeme")).ok?
97
+ is(migrate_up! 7).ok?
98
+ does(File.read(model_file)) =~ /property\W+removeme/
99
+ delete_migration(7)
100
+ refute(File.read(model_file)) =~ /property\W+removeme/
101
+ end
102
+
103
+ else
104
+ # `rename_column` is broken on DataMapper 1.2.0
105
+ # so skipping renameColumnsTest for DataMapper until fix released.
106
+
107
+ Context 'renaming columns' do
108
+
109
+ is(new_migration("reName model:A rename_column:name:first_name")).ok?
110
+
111
+ table = table('as')
112
+ check(table).has_column('name')
113
+ check(table).has_no_column('first_name')
114
+
115
+ Ensure '"up" section is renaming "name" to "first_name"' do
116
+ is(migrate_up! 4).ok?
117
+ table = table('as')
118
+ check(table).has_column('first_name')
119
+ check(table).has_no_column('name')
120
+ Ensure '"down" section renaming "first_name" to "name"' do
121
+ is(migrate_down! 4).ok?
122
+ table = table('as')
123
+ check(table).has_column('name')
124
+ check(table).has_no_column('first_name')
125
+ end
126
+ end
127
+ end
128
+ end
129
+
130
+ end
131
+
132
+ end
133
+ end
134
+ cleanup
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end