ridgepole 0.7.3.beta → 0.7.3.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +38 -0
  3. data/Appraisals +2 -2
  4. data/README.md +3 -9
  5. data/Rakefile +7 -1
  6. data/bin/ridgepole +97 -108
  7. data/gemfiles/activerecord_5.2.gemfile +1 -1
  8. data/lib/ridgepole/cli/config.rb +43 -43
  9. data/lib/ridgepole/client.rb +65 -63
  10. data/lib/ridgepole/default_limit.rb +26 -24
  11. data/lib/ridgepole/delta.rb +367 -369
  12. data/lib/ridgepole/diff.rb +366 -377
  13. data/lib/ridgepole/dsl_parser.rb +22 -20
  14. data/lib/ridgepole/dsl_parser/context.rb +95 -93
  15. data/lib/ridgepole/dsl_parser/table_definition.rb +125 -123
  16. data/lib/ridgepole/dumper.rb +73 -71
  17. data/lib/ridgepole/execute_expander.rb +55 -55
  18. data/lib/ridgepole/ext/abstract_mysql_adapter/dump_auto_increment.rb +3 -3
  19. data/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb +1 -1
  20. data/lib/ridgepole/ext/pp_sort_hash.rb +14 -14
  21. data/lib/ridgepole/ext/schema_dumper.rb +1 -1
  22. data/lib/ridgepole/external_sql_executer.rb +20 -20
  23. data/lib/ridgepole/logger.rb +17 -15
  24. data/lib/ridgepole/migration_ext.rb +6 -8
  25. data/lib/ridgepole/schema_statements_ext.rb +3 -3
  26. data/lib/ridgepole/version.rb +1 -1
  27. data/ridgepole.gemspec +11 -10
  28. data/spec/cli_helper.rb +2 -2
  29. data/spec/erb_helper.rb +6 -2
  30. data/spec/hide_pending_formatter.rb +5 -4
  31. data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +8 -8
  32. data/spec/mysql/bigint_pk/bigint_pk_spec.rb +8 -8
  33. data/spec/mysql/bigint_pk/int_pk_spec.rb +13 -13
  34. data/spec/mysql/cli/config_spec.rb +52 -53
  35. data/spec/mysql/cli/ridgepole_spec.rb +111 -111
  36. data/spec/mysql/collation/collation_spec.rb +39 -39
  37. data/spec/mysql/comment/comment_spec.rb +36 -36
  38. data/spec/mysql/default_lambda/default_lambda_spec.rb +30 -30
  39. data/spec/mysql/diff/diff2_spec.rb +18 -18
  40. data/spec/mysql/diff/diff_spec.rb +11 -11
  41. data/spec/mysql/dump/dump_class_method_spec.rb +2 -2
  42. data/spec/mysql/dump/dump_some_tables_spec.rb +14 -14
  43. data/spec/mysql/dump/dump_spec.rb +2 -2
  44. data/spec/mysql/dump/dump_unknown_column_type_spec.rb +3 -3
  45. data/spec/mysql/dump/dump_without_table_options_spec.rb +8 -8
  46. data/spec/mysql/fk/migrate_change_fk_spec.rb +40 -40
  47. data/spec/mysql/fk/migrate_create_fk_spec.rb +40 -40
  48. data/spec/mysql/fk/migrate_drop_fk_spec.rb +60 -60
  49. data/spec/mysql/migrate/check_orphan_index_spec.rb +6 -6
  50. data/spec/mysql/migrate/migrate_add_column2_spec.rb +43 -43
  51. data/spec/mysql/migrate/migrate_add_column_order_spec.rb +50 -50
  52. data/spec/mysql/migrate/migrate_add_column_spec.rb +11 -11
  53. data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +8 -8
  54. data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +11 -11
  55. data/spec/mysql/migrate/migrate_change_column2_spec.rb +20 -20
  56. data/spec/mysql/migrate/migrate_change_column3_spec.rb +60 -60
  57. data/spec/mysql/migrate/migrate_change_column4_spec.rb +16 -16
  58. data/spec/mysql/migrate/migrate_change_column5_spec.rb +24 -24
  59. data/spec/mysql/migrate/migrate_change_column6_spec.rb +40 -40
  60. data/spec/mysql/migrate/migrate_change_column7_spec.rb +4 -4
  61. data/spec/mysql/migrate/migrate_change_column8_spec.rb +9 -9
  62. data/spec/mysql/migrate/migrate_change_column_default_spec.rb +48 -48
  63. data/spec/mysql/migrate/migrate_change_column_float_spec.rb +16 -16
  64. data/spec/mysql/migrate/migrate_change_column_spec.rb +11 -11
  65. data/spec/mysql/migrate/migrate_change_index2_spec.rb +20 -20
  66. data/spec/mysql/migrate/migrate_change_index3_spec.rb +43 -43
  67. data/spec/mysql/migrate/migrate_change_index4_spec.rb +24 -24
  68. data/spec/mysql/migrate/migrate_change_index5_spec.rb +16 -16
  69. data/spec/mysql/migrate/migrate_change_index6_spec.rb +12 -12
  70. data/spec/mysql/migrate/migrate_change_index7_spec.rb +20 -20
  71. data/spec/mysql/migrate/migrate_change_index8_spec.rb +20 -20
  72. data/spec/mysql/migrate/migrate_change_index_spec.rb +17 -17
  73. data/spec/mysql/migrate/migrate_change_table_comment_spec.rb +10 -10
  74. data/spec/mysql/migrate/migrate_change_table_option_spec.rb +18 -18
  75. data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +37 -37
  76. data/spec/mysql/migrate/migrate_create_index2_spec.rb +12 -12
  77. data/spec/mysql/migrate/migrate_create_index_spec.rb +11 -11
  78. data/spec/mysql/migrate/migrate_create_table_spec.rb +8 -8
  79. data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +6 -6
  80. data/spec/mysql/migrate/migrate_create_table_with_options_spec.rb +12 -12
  81. data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +11 -11
  82. data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +9 -9
  83. data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +12 -12
  84. data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +10 -10
  85. data/spec/mysql/migrate/migrate_drop_column_spec.rb +11 -11
  86. data/spec/mysql/migrate/migrate_drop_index_spec.rb +11 -11
  87. data/spec/mysql/migrate/migrate_drop_table_spec.rb +8 -8
  88. data/spec/mysql/migrate/migrate_duplicate_index_spec.rb +6 -6
  89. data/spec/mysql/migrate/migrate_duplicate_table_spec.rb +6 -6
  90. data/spec/mysql/migrate/migrate_empty_spec.rb +4 -4
  91. data/spec/mysql/migrate/migrate_execute_spec.rb +55 -55
  92. data/spec/mysql/migrate/migrate_log_file_spec.rb +9 -9
  93. data/spec/mysql/migrate/migrate_merge_mode_spec.rb +9 -9
  94. data/spec/mysql/migrate/migrate_noop_spec.rb +19 -19
  95. data/spec/mysql/migrate/migrate_primary_key_spec.rb +18 -18
  96. data/spec/mysql/migrate/migrate_rename_column_spec.rb +17 -17
  97. data/spec/mysql/migrate/migrate_rename_table_spec.rb +26 -26
  98. data/spec/mysql/migrate/migrate_same_default_null_spec.rb +16 -16
  99. data/spec/mysql/migrate/migrate_same_spec.rb +4 -4
  100. data/spec/mysql/migrate/migrate_script_error_spec.rb +8 -8
  101. data/spec/mysql/migrate/migrate_skip_column_comment_change_spec.rb +8 -8
  102. data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +9 -9
  103. data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +8 -8
  104. data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +9 -9
  105. data/spec/mysql/migrate/migrate_with_ignore_tables_spec.rb +64 -64
  106. data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +12 -12
  107. data/spec/mysql/migrate/migrate_with_tables_spec.rb +29 -29
  108. data/spec/mysql/migrate/migrate_with_verbose_log_spec.rb +18 -18
  109. data/spec/mysql/migrate_/migrate_create_index_with_alter_spec.rb +8 -8
  110. data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +8 -8
  111. data/spec/mysql/text_blob_types/text_blob_types_spec.rb +8 -8
  112. data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +12 -12
  113. data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +30 -30
  114. data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +22 -22
  115. data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +7 -7
  116. data/spec/mysql57/json/add_json_column_spec.rb +8 -8
  117. data/spec/mysql57/json/change_json_column_spec.rb +24 -24
  118. data/spec/mysql57/json/drop_json_column_spec.rb +8 -8
  119. data/spec/mysql57/virtual/add_virtual_column_spec.rb +9 -9
  120. data/spec/mysql57/virtual/change_virtual_column_spec.rb +9 -9
  121. data/spec/mysql57/virtual/drop_virtual_column_spec.rb +9 -9
  122. data/spec/postgresql/diff/diff_spec.rb +18 -18
  123. data/spec/postgresql/dump/dump_spec.rb +2 -2
  124. data/spec/postgresql/fk/migrate_change_fk_spec.rb +24 -24
  125. data/spec/postgresql/fk/migrate_create_fk_spec.rb +40 -40
  126. data/spec/postgresql/fk/migrate_drop_fk_spec.rb +44 -44
  127. data/spec/postgresql/migrate/migrate_add_column_spec.rb +21 -21
  128. data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +2 -2
  129. data/spec/postgresql/migrate/migrate_bigint_spec.rb +12 -12
  130. data/spec/postgresql/migrate/migrate_change_column_default_spec.rb +8 -8
  131. data/spec/postgresql/migrate/migrate_change_column_spec.rb +19 -19
  132. data/spec/postgresql/migrate/migrate_change_index_spec.rb +13 -13
  133. data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +19 -19
  134. data/spec/postgresql/migrate/migrate_create_table_spec.rb +8 -8
  135. data/spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb +18 -18
  136. data/spec/postgresql/migrate/migrate_drop_column_spec.rb +11 -11
  137. data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +12 -12
  138. data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +8 -8
  139. data/spec/postgresql/migrate/migrate_drop_index_spec.rb +11 -11
  140. data/spec/postgresql/migrate/migrate_drop_table_spec.rb +8 -8
  141. data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +8 -8
  142. data/spec/postgresql/migrate/migrate_primary_key_spec.rb +97 -0
  143. data/spec/postgresql/migrate/migrate_references_spec.rb +24 -24
  144. data/spec/postgresql/migrate/migrate_rename_column_spec.rb +11 -11
  145. data/spec/postgresql/migrate/migrate_rename_table_spec.rb +16 -16
  146. data/spec/postgresql/migrate/migrate_same_spec.rb +4 -4
  147. data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +12 -12
  148. data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +30 -30
  149. data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +22 -22
  150. data/spec/processing_for_travis.rb +1 -1
  151. data/spec/spec_condition.rb +2 -2
  152. data/spec/spec_const.rb +9 -9
  153. data/spec/spec_helper.rb +21 -23
  154. metadata +54 -37
@@ -1,7 +1,7 @@
1
1
  describe 'Ridgepole::Client#diff -> migrate' do
2
2
  context 'when add column' do
3
- let(:actual_dsl) {
4
- erbh(<<-EOS)
3
+ let(:actual_dsl) do
4
+ erbh(<<-ERB)
5
5
  create_table "clubs", force: :cascade do |t|
6
6
  t.string "name", default: "", null: false
7
7
  t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
@@ -59,11 +59,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
59
59
  t.date "to_date"
60
60
  t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
61
61
  end
62
- EOS
63
- }
62
+ ERB
63
+ end
64
64
 
65
- let(:expected_dsl) {
66
- erbh(<<-EOS)
65
+ let(:expected_dsl) do
66
+ erbh(<<-ERB)
67
67
  create_table "clubs", force: :cascade do |t|
68
68
  t.string "name", default: "", null: false
69
69
  t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
@@ -124,8 +124,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
124
124
  t.date "to_date"
125
125
  t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
126
126
  end
127
- EOS
128
- }
127
+ ERB
128
+ end
129
129
 
130
130
  before { subject.diff(actual_dsl).migrate }
131
131
  subject { client }
@@ -139,10 +139,10 @@ describe 'Ridgepole::Client#diff -> migrate' do
139
139
  }
140
140
 
141
141
  it {
142
- delta = client(:bulk_change => true).diff(expected_dsl)
142
+ delta = client(bulk_change: true).diff(expected_dsl)
143
143
  expect(delta.differ?).to be_truthy
144
144
  expect(subject.dump).to match_ruby actual_dsl
145
- expect(delta.script).to match_fuzzy erbh(<<-EOS)
145
+ expect(delta.script).to match_fuzzy erbh(<<-ERB)
146
146
  change_table("employee_clubs", {:bulk=>true}) do |t|
147
147
  t.column("any_col", :string, {:null=>false, :after=>"club_id", :limit=>255})
148
148
  end
@@ -151,7 +151,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
151
151
  t.column("age", :integer, {:null=>false, :after=>"hire_date", :limit=>4})
152
152
  t.column("updated_at", :date, {:after=>"age"})
153
153
  end
154
- EOS
154
+ ERB
155
155
  delta.migrate
156
156
  expect(subject.dump).to match_ruby expected_dsl
157
157
  }
@@ -1,7 +1,7 @@
1
1
  describe 'Ridgepole::Client#diff -> migrate' do
2
2
  context 'when add column' do
3
- let(:actual_dsl) {
4
- erbh(<<-EOS)
3
+ let(:actual_dsl) do
4
+ erbh(<<-ERB)
5
5
  create_table "clubs", force: :cascade do |t|
6
6
  t.string "name", default: "", null: false
7
7
  t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
@@ -59,11 +59,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
59
59
  t.date "to_date"
60
60
  t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
61
61
  end
62
- EOS
63
- }
62
+ ERB
63
+ end
64
64
 
65
- let(:expected_dsl) {
66
- erbh(<<-EOS)
65
+ let(:expected_dsl) do
66
+ erbh(<<-ERB)
67
67
  create_table "clubs", force: :cascade do |t|
68
68
  t.string "name", default: "", null: false
69
69
  t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
@@ -124,8 +124,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
124
124
  t.date "to_date"
125
125
  t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
126
126
  end
127
- EOS
128
- }
127
+ ERB
128
+ end
129
129
 
130
130
  before { subject.diff(actual_dsl).migrate }
131
131
  subject { client }
@@ -1,7 +1,7 @@
1
1
  describe 'Ridgepole::Client#diff -> migrate' do
2
2
  context 'when add column' do
3
- let(:actual_dsl) {
4
- erbh(<<-EOS)
3
+ let(:actual_dsl) do
4
+ erbh(<<-ERB)
5
5
  create_table "clubs", force: :cascade do |t|
6
6
  t.string "name", default: "", null: false
7
7
  t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
@@ -59,11 +59,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
59
59
  t.date "to_date"
60
60
  t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
61
61
  end
62
- EOS
63
- }
62
+ ERB
63
+ end
64
64
 
65
- let(:expected_dsl) {
66
- erbh(<<-EOS)
65
+ let(:expected_dsl) do
66
+ erbh(<<-ERB)
67
67
  create_table "clubs", force: :cascade do |t|
68
68
  t.string "name", default: "", null: false
69
69
  t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
@@ -124,8 +124,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
124
124
  t.date "to_date"
125
125
  t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
126
126
  end
127
- EOS
128
- }
127
+ ERB
128
+ end
129
129
 
130
130
  before { subject.diff(actual_dsl).migrate }
131
131
  subject { client }
@@ -135,12 +135,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
135
135
  expect(delta.differ?).to be_truthy
136
136
  expect(subject.dump).to match_ruby actual_dsl
137
137
 
138
- script = <<-EOS
138
+ script = <<-SHELL
139
139
  echo "$1" | #{MYSQL_CLI} #{TEST_SCHEMA}
140
- EOS
140
+ SHELL
141
141
 
142
142
  tempfile(File.basename(__FILE__), script) do |path|
143
- FileUtils.chmod(0755, path)
143
+ FileUtils.chmod(0o755, path)
144
144
  delta.migrate(external_script: path)
145
145
  end
146
146
 
@@ -1,7 +1,7 @@
1
1
  describe 'Ridgepole::Client#diff -> migrate' do
2
2
  context 'when change column (no change)' do
3
- let(:actual_dsl) {
4
- erbh(<<-EOS)
3
+ let(:actual_dsl) do
4
+ erbh(<<-ERB)
5
5
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
6
6
  t.date "birth_date", null: false
7
7
  t.string "first_name", limit: 14, null: false
@@ -10,11 +10,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
10
10
  t.date "hire_date", null: false
11
11
  t.index ["gender"], name: "gender", <%= i cond(5.0, using: :btree) %>
12
12
  end
13
- EOS
14
- }
13
+ ERB
14
+ end
15
15
 
16
- let(:expected_dsl) {
17
- erbh(<<-EOS)
16
+ let(:expected_dsl) do
17
+ erbh(<<-ERB)
18
18
  create_table :employees, primary_key: :emp_no, force: :cascade do |t|
19
19
  t.date "birth_date", null: false
20
20
  t.string "first_name", limit: 14, null: false
@@ -23,8 +23,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
23
23
  t.date :hire_date, null: false
24
24
  t.index :gender, name: :gender, <%= i cond(5.0, using: :btree) %>
25
25
  end
26
- EOS
27
- }
26
+ ERB
27
+ end
28
28
 
29
29
  before { subject.diff(actual_dsl).migrate }
30
30
  subject { client }
@@ -36,8 +36,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
36
36
  end
37
37
 
38
38
  context 'when change column (change)' do
39
- let(:actual_dsl) {
40
- erbh(<<-EOS)
39
+ let(:actual_dsl) do
40
+ erbh(<<-ERB)
41
41
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
42
42
  t.date "birth_date", null: false
43
43
  t.string "first_name", limit: 14, null: false
@@ -46,11 +46,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
46
46
  t.date "hire_date", null: false
47
47
  t.index ["gender"], name: "gender", <%= i cond(5.0, using: :btree) %>
48
48
  end
49
- EOS
50
- }
49
+ ERB
50
+ end
51
51
 
52
- let(:dsl) {
53
- erbh(<<-EOS)
52
+ let(:dsl) do
53
+ erbh(<<-ERB)
54
54
  create_table :employees, primary_key: :emp_no, force: :cascade do |t|
55
55
  t.date "birth_date", null: false
56
56
  t.string "first_name", limit: 14, null: false
@@ -59,11 +59,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
59
59
  t.date :hire_date2, null: false
60
60
  t.index :last_name, name: :last_name, <%= i cond(5.0, using: :btree) %>
61
61
  end
62
- EOS
63
- }
62
+ ERB
63
+ end
64
64
 
65
- let(:expected_dsl) {
66
- erbh(<<-EOS)
65
+ let(:expected_dsl) do
66
+ erbh(<<-ERB)
67
67
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
68
68
  t.date "birth_date", null: false
69
69
  t.string "first_name", limit: 14, null: false
@@ -72,8 +72,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
72
72
  t.date "hire_date2", null: false
73
73
  t.index ["last_name"], name: "last_name", <%= i cond(5.0, using: :btree) %>
74
74
  end
75
- EOS
76
- }
75
+ ERB
76
+ end
77
77
 
78
78
  before { subject.diff(actual_dsl).migrate }
79
79
  subject { client }
@@ -1,7 +1,7 @@
1
1
  describe 'Ridgepole::Client#diff -> migrate' do
2
2
  context 'when use timestamps (no change)' do
3
- let(:actual_dsl) {
4
- <<-EOS
3
+ let(:actual_dsl) do
4
+ <<-RUBY
5
5
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
6
6
  t.date "birth_date", null: false
7
7
  t.string "first_name", limit: 14, null: false
@@ -11,11 +11,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
11
11
  t.datetime "created_at", null: false
12
12
  t.datetime "updated_at", null: false
13
13
  end
14
- EOS
15
- }
14
+ RUBY
15
+ end
16
16
 
17
- let(:expected_dsl) {
18
- <<-EOS
17
+ let(:expected_dsl) do
18
+ <<-RUBY
19
19
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
20
20
  t.date "birth_date", null: false
21
21
  t.string "first_name", limit: 14, null: false
@@ -24,8 +24,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
24
24
  t.date "hire_date", null: false
25
25
  t.timestamps
26
26
  end
27
- EOS
28
- }
27
+ RUBY
28
+ end
29
29
 
30
30
  before { subject.diff(actual_dsl).migrate }
31
31
  subject { client }
@@ -37,8 +37,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
37
37
  end
38
38
 
39
39
  context 'when use timestamps (change)' do
40
- let(:actual_dsl) {
41
- erbh(<<-EOS)
40
+ let(:actual_dsl) do
41
+ erbh(<<-ERB)
42
42
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
43
43
  t.date "birth_date", null: false
44
44
  t.string "first_name", limit: 14, null: false
@@ -46,11 +46,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
46
46
  t.string "gender", limit: 1, null: false
47
47
  t.date "hire_date", null: false
48
48
  end
49
- EOS
50
- }
49
+ ERB
50
+ end
51
51
 
52
- let(:dsl) {
53
- <<-EOS
52
+ let(:dsl) do
53
+ <<-RUBY
54
54
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
55
55
  t.date "birth_date", null: false
56
56
  t.string "first_name", limit: 14, null: false
@@ -59,11 +59,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
59
59
  t.date "hire_date", null: false
60
60
  t.timestamps
61
61
  end
62
- EOS
63
- }
62
+ RUBY
63
+ end
64
64
 
65
- let(:expected_dsl) {
66
- erbh(<<-EOS)
65
+ let(:expected_dsl) do
66
+ erbh(<<-ERB)
67
67
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
68
68
  t.date "birth_date", null: false
69
69
  t.string "first_name", limit: 14, null: false
@@ -73,8 +73,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
73
73
  t.datetime "created_at", null: false
74
74
  t.datetime "updated_at", null: false
75
75
  end
76
- EOS
77
- }
76
+ ERB
77
+ end
78
78
 
79
79
  before { subject.diff(actual_dsl).migrate }
80
80
  subject { client }
@@ -89,8 +89,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
89
89
  end
90
90
 
91
91
  context 'when use references (no change)' do
92
- let(:actual_dsl) {
93
- erbh(<<-EOS)
92
+ let(:actual_dsl) do
93
+ erbh(<<-ERB)
94
94
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
95
95
  t.date "birth_date", null: false
96
96
  t.string "first_name", limit: 14, null: false
@@ -102,11 +102,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
102
102
  t.index "products_id"
103
103
  t.index "user_id"
104
104
  end
105
- EOS
106
- }
105
+ ERB
106
+ end
107
107
 
108
- let(:expected_dsl) {
109
- <<-EOS
108
+ let(:expected_dsl) do
109
+ <<-RUBY
110
110
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
111
111
  t.date "birth_date", null: false
112
112
  t.string "first_name", limit: 14, null: false
@@ -115,8 +115,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
115
115
  t.date "hire_date", null: false
116
116
  t.references :products, :user
117
117
  end
118
- EOS
119
- }
118
+ RUBY
119
+ end
120
120
 
121
121
  before { subject.diff(actual_dsl).migrate }
122
122
  subject { client }
@@ -128,8 +128,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
128
128
  end
129
129
 
130
130
  context 'when use references with polymorphic (no change)' do
131
- let(:actual_dsl) {
132
- erbh(<<-EOS)
131
+ let(:actual_dsl) do
132
+ erbh(<<-ERB)
133
133
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
134
134
  t.date "birth_date", null: false
135
135
  t.string "first_name", limit: 14, null: false
@@ -143,11 +143,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
143
143
  t.index ["products_type", "products_id"]
144
144
  t.index ["user_type", "user_id"]
145
145
  end
146
- EOS
147
- }
146
+ ERB
147
+ end
148
148
 
149
- let(:expected_dsl) {
150
- <<-EOS
149
+ let(:expected_dsl) do
150
+ <<-RUBY
151
151
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
152
152
  t.date "birth_date", null: false
153
153
  t.string "first_name", limit: 14, null: false
@@ -156,8 +156,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
156
156
  t.date "hire_date", null: false
157
157
  t.references :products, :user, polymorphic: true
158
158
  end
159
- EOS
160
- }
159
+ RUBY
160
+ end
161
161
 
162
162
  before { subject.diff(actual_dsl).migrate }
163
163
  subject { client }
@@ -169,8 +169,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
169
169
  end
170
170
 
171
171
  context 'when use references (change)' do
172
- let(:actual_dsl) {
173
- erbh(<<-EOS)
172
+ let(:actual_dsl) do
173
+ erbh(<<-ERB)
174
174
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
175
175
  t.date "birth_date", null: false
176
176
  t.string "first_name", limit: 14, null: false
@@ -178,11 +178,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
178
178
  t.string "gender", limit: 1, null: false
179
179
  t.date "hire_date", null: false
180
180
  end
181
- EOS
182
- }
181
+ ERB
182
+ end
183
183
 
184
- let(:dsl) {
185
- <<-EOS
184
+ let(:dsl) do
185
+ <<-RUBY
186
186
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
187
187
  t.date "birth_date", null: false
188
188
  t.string "first_name", limit: 14, null: false
@@ -191,11 +191,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
191
191
  t.date "hire_date", null: false
192
192
  t.references :products, :user
193
193
  end
194
- EOS
195
- }
194
+ RUBY
195
+ end
196
196
 
197
- let(:expected_dsl) {
198
- erbh(<<-EOS)
197
+ let(:expected_dsl) do
198
+ erbh(<<-ERB)
199
199
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
200
200
  t.date "birth_date", null: false
201
201
  t.string "first_name", limit: 14, null: false
@@ -207,8 +207,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
207
207
  t.index ["products_id"], name: "index_employees_on_products_id", <%= i cond(5.0, using: :btree) %>
208
208
  t.index ["user_id"], name: "index_employees_on_user_id", <%= i cond(5.0, using: :btree) %>
209
209
  end
210
- EOS
211
- }
210
+ ERB
211
+ end
212
212
 
213
213
  before { subject.diff(actual_dsl).migrate }
214
214
  subject { client }
@@ -223,8 +223,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
223
223
  end
224
224
 
225
225
  context 'when use references with polymorphic (change)' do
226
- let(:actual_dsl) {
227
- erbh(<<-EOS)
226
+ let(:actual_dsl) do
227
+ erbh(<<-ERB)
228
228
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
229
229
  t.date "birth_date", null: false
230
230
  t.string "first_name", limit: 14, null: false
@@ -232,11 +232,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
232
232
  t.string "gender", limit: 1, null: false
233
233
  t.date "hire_date", null: false
234
234
  end
235
- EOS
236
- }
235
+ ERB
236
+ end
237
237
 
238
- let(:dsl) {
239
- <<-EOS
238
+ let(:dsl) do
239
+ <<-RUBY
240
240
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
241
241
  t.date "birth_date", null: false
242
242
  t.string "first_name", limit: 14, null: false
@@ -245,11 +245,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
245
245
  t.date "hire_date", null: false
246
246
  t.references :products, :user, polymorphic: true
247
247
  end
248
- EOS
249
- }
248
+ RUBY
249
+ end
250
250
 
251
- let(:expected_dsl) {
252
- erbh(<<-EOS)
251
+ let(:expected_dsl) do
252
+ erbh(<<-ERB)
253
253
  create_table "employees", primary_key: "emp_no", force: :cascade do |t|
254
254
  t.date "birth_date", null: false
255
255
  t.string "first_name", limit: 14, null: false
@@ -263,8 +263,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
263
263
  t.index ["products_type", "products_id"], name: "index_employees_on_products_type_and_products_id", <%= i cond(5.0, using: :btree) %>
264
264
  t.index ["user_type", "user_id"], name: "index_employees_on_user_type_and_user_id", <%= i cond(5.0, using: :btree) %>
265
265
  end
266
- EOS
267
- }
266
+ ERB
267
+ end
268
268
 
269
269
  before { subject.diff(actual_dsl).migrate }
270
270
  subject { client }