masamune 0.17.12 → 0.17.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -3
  3. data/bin/masamune-aws-emr +1 -1
  4. data/bin/masamune-dump +1 -1
  5. data/bin/masamune-hive +1 -1
  6. data/bin/masamune-psql +1 -1
  7. data/bin/masamune-shell +1 -1
  8. data/lib/masamune.rb +1 -1
  9. data/lib/masamune/actions/aws_emr.rb +2 -2
  10. data/lib/masamune/actions/data_flow.rb +10 -10
  11. data/lib/masamune/actions/date_parse.rb +4 -6
  12. data/lib/masamune/actions/execute.rb +3 -3
  13. data/lib/masamune/actions/filesystem.rb +1 -1
  14. data/lib/masamune/actions/hadoop_filesystem.rb +2 -2
  15. data/lib/masamune/actions/hive.rb +5 -5
  16. data/lib/masamune/actions/invoke_parallel.rb +5 -5
  17. data/lib/masamune/actions/postgres.rb +6 -6
  18. data/lib/masamune/actions/postgres_admin.rb +1 -1
  19. data/lib/masamune/actions/s3cmd.rb +3 -3
  20. data/lib/masamune/actions/transform.rb +4 -4
  21. data/lib/masamune/after_initialize_callbacks.rb +4 -4
  22. data/lib/masamune/cached_filesystem.rb +7 -11
  23. data/lib/masamune/commands/aws_emr.rb +12 -12
  24. data/lib/masamune/commands/hadoop_filesystem.rb +8 -8
  25. data/lib/masamune/commands/hadoop_streaming.rb +16 -16
  26. data/lib/masamune/commands/hive.rb +31 -35
  27. data/lib/masamune/commands/postgres.rb +30 -32
  28. data/lib/masamune/commands/postgres_admin.rb +17 -16
  29. data/lib/masamune/commands/postgres_common.rb +1 -1
  30. data/lib/masamune/commands/retry_with_backoff.rb +19 -19
  31. data/lib/masamune/commands/s3cmd.rb +7 -7
  32. data/lib/masamune/commands/shell.rb +25 -38
  33. data/lib/masamune/configuration.rb +8 -9
  34. data/lib/masamune/data_plan/builder.rb +5 -5
  35. data/lib/masamune/data_plan/elem.rb +7 -7
  36. data/lib/masamune/data_plan/engine.rb +12 -15
  37. data/lib/masamune/data_plan/rule.rb +14 -12
  38. data/lib/masamune/data_plan/set.rb +13 -13
  39. data/lib/masamune/environment.rb +3 -3
  40. data/lib/masamune/filesystem.rb +29 -28
  41. data/lib/masamune/helpers/postgres.rb +8 -5
  42. data/lib/masamune/io.rb +2 -2
  43. data/lib/masamune/last_element.rb +3 -3
  44. data/lib/masamune/method_logger.rb +1 -1
  45. data/lib/masamune/schema/catalog.rb +9 -12
  46. data/lib/masamune/schema/column.rb +12 -10
  47. data/lib/masamune/schema/dimension.rb +5 -4
  48. data/lib/masamune/schema/fact.rb +2 -2
  49. data/lib/masamune/schema/map.rb +9 -13
  50. data/lib/masamune/schema/row.rb +3 -2
  51. data/lib/masamune/schema/store.rb +13 -14
  52. data/lib/masamune/schema/table.rb +24 -28
  53. data/lib/masamune/schema/table_reference.rb +7 -7
  54. data/lib/masamune/spec_helper.rb +1 -1
  55. data/lib/masamune/string_format.rb +1 -1
  56. data/lib/masamune/tasks/aws_emr_thor.rb +9 -9
  57. data/lib/masamune/tasks/dump_thor.rb +5 -5
  58. data/lib/masamune/tasks/hive_thor.rb +13 -13
  59. data/lib/masamune/tasks/postgres_thor.rb +8 -8
  60. data/lib/masamune/tasks/shell_thor.rb +3 -3
  61. data/lib/masamune/template.rb +4 -4
  62. data/lib/masamune/thor.rb +26 -25
  63. data/lib/masamune/transform/common/denormalize_table.rb +6 -6
  64. data/lib/masamune/transform/define_table.rb +1 -1
  65. data/lib/masamune/transform/hive/define_table.rb +0 -2
  66. data/lib/masamune/transform/insert_reference_values.rb +1 -1
  67. data/lib/masamune/transform/operator.rb +3 -2
  68. data/lib/masamune/transform/postgres/bulk_upsert.rb +0 -3
  69. data/lib/masamune/transform/postgres/deduplicate_dimension.rb +4 -6
  70. data/lib/masamune/transform/postgres/define_table.rb +2 -2
  71. data/lib/masamune/transform/postgres/insert_reference_values.rb +1 -4
  72. data/lib/masamune/transform/postgres/relabel_dimension.rb +1 -3
  73. data/lib/masamune/transform/postgres/rollup_fact.rb +3 -5
  74. data/lib/masamune/transform/postgres/snapshot_dimension.rb +1 -4
  75. data/lib/masamune/transform/postgres/stage_dimension.rb +8 -10
  76. data/lib/masamune/transform/postgres/stage_fact.rb +15 -14
  77. data/lib/masamune/version.rb +1 -1
  78. data/spec/masamune/actions/aws_emr_spec.rb +8 -8
  79. data/spec/masamune/actions/execute_spec.rb +6 -6
  80. data/spec/masamune/actions/hive_spec.rb +20 -15
  81. data/spec/masamune/actions/postgres_spec.rb +17 -10
  82. data/spec/masamune/after_initialization_callbacks_spec.rb +13 -7
  83. data/spec/masamune/commands/aws_emr_spec.rb +10 -10
  84. data/spec/masamune/commands/hadoop_filesystem_spec.rb +3 -3
  85. data/spec/masamune/commands/hadoop_streaming_spec.rb +4 -4
  86. data/spec/masamune/commands/hive_spec.rb +11 -11
  87. data/spec/masamune/commands/postgres_admin_spec.rb +9 -9
  88. data/spec/masamune/commands/postgres_spec.rb +15 -15
  89. data/spec/masamune/commands/retry_with_backoff_spec.rb +10 -7
  90. data/spec/masamune/commands/s3cmd_spec.rb +3 -3
  91. data/spec/masamune/commands/shell_spec.rb +16 -16
  92. data/spec/masamune/data_plan/builder_spec.rb +22 -19
  93. data/spec/masamune/data_plan/elem_spec.rb +20 -20
  94. data/spec/masamune/data_plan/engine_spec.rb +41 -33
  95. data/spec/masamune/data_plan/rule_spec.rb +19 -19
  96. data/spec/masamune/data_plan/set_spec.rb +8 -6
  97. data/spec/masamune/environment_spec.rb +5 -5
  98. data/spec/masamune/filesystem_spec.rb +87 -87
  99. data/spec/masamune/helpers/postgres_spec.rb +1 -1
  100. data/spec/masamune/rspec/job_fixture_spec.rb +0 -1
  101. data/spec/masamune/schema/catalog_spec.rb +16 -16
  102. data/spec/masamune/schema/column_spec.rb +19 -19
  103. data/spec/masamune/schema/dimension_spec.rb +2 -2
  104. data/spec/masamune/schema/fact_spec.rb +3 -3
  105. data/spec/masamune/schema/map_spec.rb +41 -41
  106. data/spec/masamune/schema/table_spec.rb +16 -16
  107. data/spec/masamune/string_format_spec.rb +7 -7
  108. data/spec/masamune/tasks/dump_thor_spec.rb +6 -6
  109. data/spec/masamune/tasks/hive_thor_spec.rb +2 -2
  110. data/spec/masamune/template_spec.rb +3 -2
  111. data/spec/masamune/thor_spec.rb +8 -8
  112. data/spec/masamune/transform/bulk_upsert.dimension_spec.rb +3 -3
  113. data/spec/masamune/transform/define_table.dimension_spec.rb +3 -3
  114. data/spec/masamune/transform/define_table.fact_spec.rb +5 -5
  115. data/spec/masamune/transform/define_table.table_spec.rb +6 -6
  116. data/spec/masamune/transform/denormalize_table_spec.rb +15 -15
  117. data/spec/masamune/transform/insert_reference_values.dimension_spec.rb +1 -1
  118. data/spec/masamune/transform/load_dimension_spec.rb +1 -1
  119. data/spec/masamune/transform/load_fact_spec.rb +1 -1
  120. data/spec/masamune/transform/rollup_fact_spec.rb +4 -4
  121. data/spec/masamune/transform/stage_dimension_spec.rb +3 -3
  122. data/spec/masamune/transform/stage_fact_spec.rb +4 -4
  123. data/spec/spec_helper.rb +1 -1
  124. data/spec/support/masamune/example_group.rb +2 -2
  125. data/spec/support/masamune/job_example_group.rb +3 -3
  126. data/spec/support/masamune/job_fixture.rb +4 -4
  127. data/spec/support/masamune/mock_command.rb +10 -10
  128. data/spec/support/masamune/mock_delegate.rb +2 -2
  129. data/spec/support/masamune/mock_filesystem.rb +3 -3
  130. data/spec/support/masamune/shared_example_group.rb +14 -16
  131. data/spec/support/masamune/step_example_group.rb +4 -4
  132. data/spec/support/masamune/step_fixture.rb +1 -1
  133. data/spec/support/masamune/task_example_group.rb +1 -1
  134. data/spec/support/masamune/thor_mute.rb +3 -2
  135. data/spec/support/rspec/example/action_example_group.rb +1 -1
  136. data/spec/support/rspec/example/task_example_group.rb +7 -4
  137. data/spec/support/rspec/example/transform_example_group.rb +1 -1
  138. data/spec/support/shared_examples/postgres_common_examples.rb +2 -2
  139. metadata +16 -2
@@ -70,8 +70,8 @@ describe Masamune::Schema::Table do
70
70
  let(:table) do
71
71
  described_class.new id: 'user',
72
72
  columns: [
73
- Masamune::Schema::Column.new(id: 'tenant_id', index: ['tenant_id', 'shared']),
74
- Masamune::Schema::Column.new(id: 'user_id', index: ['user_id', 'shared'])
73
+ Masamune::Schema::Column.new(id: 'tenant_id', index: %w(tenant_id shared)),
74
+ Masamune::Schema::Column.new(id: 'user_id', index: %w(user_id shared))
75
75
  ]
76
76
  end
77
77
 
@@ -83,7 +83,7 @@ describe Masamune::Schema::Table do
83
83
  described_class.new id: 'user',
84
84
  columns: [
85
85
  Masamune::Schema::Column.new(id: 'tenant_id', unique: ['shared']),
86
- Masamune::Schema::Column.new(id: 'user_id', unique: ['user_id', 'shared'])
86
+ Masamune::Schema::Column.new(id: 'user_id', unique: %w(user_id shared))
87
87
  ]
88
88
  end
89
89
 
@@ -135,7 +135,7 @@ describe Masamune::Schema::Table do
135
135
  ]
136
136
  end
137
137
 
138
- it { expect { table }.to raise_error /contains undefined columns/ }
138
+ it { expect { table }.to raise_error(/contains undefined columns/) }
139
139
  end
140
140
 
141
141
  context 'with partial values' do
@@ -182,11 +182,11 @@ describe Masamune::Schema::Table do
182
182
  rows: [
183
183
  Masamune::Schema::Row.new(values: {
184
184
  tenant_id: 'default_tenant_id()',
185
- user_id: -1,
185
+ user_id: -1
186
186
  }, default: true),
187
187
  Masamune::Schema::Row.new(values: {
188
188
  tenant_id: 'default_tenant_id()',
189
- user_id: -2,
189
+ user_id: -2
190
190
  }, id: 'unknown')
191
191
  ]
192
192
  end
@@ -208,7 +208,7 @@ describe Masamune::Schema::Table do
208
208
  }),
209
209
  Masamune::Schema::Row.new(values: {
210
210
  name: 'active',
211
- description: 'Active',
211
+ description: 'Active'
212
212
  }, default: true),
213
213
  Masamune::Schema::Row.new(values: {
214
214
  name: 'inactive',
@@ -236,15 +236,15 @@ describe Masamune::Schema::Table do
236
236
  Masamune::Schema::Column.new(id: 'description', type: :string)
237
237
  ],
238
238
  rows: [
239
- Masamune::Schema::Row.new(values: {name: 'active'}, default: true)
239
+ Masamune::Schema::Row.new(values: { name: 'active' }, default: true)
240
240
  ]
241
241
  end
242
242
 
243
243
  let(:table) do
244
244
  described_class.new id: 'user', references: [
245
- Masamune::Schema::TableReference.new(mini_table),
246
- Masamune::Schema::TableReference.new(mini_table, label: 'actor', null: true, default: :null)
247
- ],
245
+ Masamune::Schema::TableReference.new(mini_table),
246
+ Masamune::Schema::TableReference.new(mini_table, label: 'actor', null: true, default: :null)
247
+ ],
248
248
  columns: [
249
249
  Masamune::Schema::Column.new(id: 'name', type: :string)
250
250
  ]
@@ -286,9 +286,9 @@ describe Masamune::Schema::Table do
286
286
 
287
287
  let(:table) do
288
288
  described_class.new id: 'user', references: [
289
- Masamune::Schema::TableReference.new(mini_table),
290
- Masamune::Schema::TableReference.new(mini_table, label: 'hr')
291
- ],
289
+ Masamune::Schema::TableReference.new(mini_table),
290
+ Masamune::Schema::TableReference.new(mini_table, label: 'hr')
291
+ ],
292
292
  columns: [
293
293
  Masamune::Schema::Column.new(id: 'user_id', type: :integer),
294
294
  Masamune::Schema::Column.new(id: 'name', type: :string),
@@ -384,8 +384,8 @@ describe Masamune::Schema::Table do
384
384
  context 'with specified target table (referenced tables)' do
385
385
  let(:target) do
386
386
  described_class.new id: 'user_data', references: [
387
- Masamune::Schema::TableReference.new(mini_table, label: 'hr')
388
- ],
387
+ Masamune::Schema::TableReference.new(mini_table, label: 'hr')
388
+ ],
389
389
  columns: [
390
390
  Masamune::Schema::Column.new(id: 'user_id', type: :integer),
391
391
  Masamune::Schema::Column.new(id: 'name', type: :string)
@@ -27,13 +27,13 @@ describe Masamune::StringFormat do
27
27
  subject { instance.strip_sql(input) }
28
28
 
29
29
  context 'with quoted sql' do
30
- let(:input) { %q('SELECT * FROM table;') }
31
- it { is_expected.to eq(%q(SELECT * FROM table;)) }
30
+ let(:input) { "'SELECT * FROM table;'" }
31
+ it { is_expected.to eq('SELECT * FROM table;') }
32
32
  end
33
33
 
34
34
  context 'with ; terminated sql' do
35
- let(:input) { %q(SELECT * FROM table;;) }
36
- it { is_expected.to eq(%q(SELECT * FROM table;)) }
35
+ let(:input) { 'SELECT * FROM table;;' }
36
+ it { is_expected.to eq('SELECT * FROM table;') }
37
37
  end
38
38
 
39
39
  context 'with multi line sql' do
@@ -47,12 +47,12 @@ describe Masamune::StringFormat do
47
47
 
48
48
  EOS
49
49
  end
50
- it { is_expected.to eq(%q(SELECT * FROM table;)) }
50
+ it { is_expected.to eq('SELECT * FROM table;') }
51
51
  end
52
52
 
53
53
  context 'with un-quoted sql' do
54
- let(:input) { %q(SELECT * FROM table) }
55
- it { is_expected.to eq(%q(SELECT * FROM table;)) }
54
+ let(:input) { 'SELECT * FROM table' }
55
+ it { is_expected.to eq('SELECT * FROM table;') }
56
56
  end
57
57
  end
58
58
  end
@@ -44,7 +44,7 @@ describe Masamune::Tasks::DumpThor do
44
44
 
45
45
  context 'with --type=unknown' do
46
46
  let(:options) { ['--type=unknown'] }
47
- it_behaves_like 'raises Thor::MalformattedArgumentError', %q{Expected '--type' to be one of psql, hql; got unknown}
47
+ it_behaves_like 'raises Thor::MalformattedArgumentError', "Expected '--type' to be one of psql, hql; got unknown"
48
48
  end
49
49
 
50
50
  context 'with --section=pre' do
@@ -64,7 +64,7 @@ describe Masamune::Tasks::DumpThor do
64
64
 
65
65
  context 'with --section=unknown' do
66
66
  let(:options) { ['--section=unknown'] }
67
- it_behaves_like 'raises Thor::MalformattedArgumentError', %q{Expected '--section' to be one of pre, post, all; got unknown}
67
+ it_behaves_like 'raises Thor::MalformattedArgumentError', "Expected '--section' to be one of pre, post, all; got unknown"
68
68
  end
69
69
 
70
70
  context 'with --skip-indexes' do
@@ -77,13 +77,13 @@ describe Masamune::Tasks::DumpThor do
77
77
  it_behaves_like 'executes with success'
78
78
  end
79
79
 
80
- context %q{with --exclude='.*dimension'} do
81
- let(:options) { [%q{--exclude='.*dimension'}] }
80
+ context "with --exclude='.*dimension'" do
81
+ let(:options) { ["--exclude='.*dimension'"] }
82
82
  it_behaves_like 'executes with success'
83
83
  end
84
84
 
85
- context %q{with --exclude='.*dimension' '.*fact'} do
86
- let(:options) { [%q{--exclude='.*dimension' '.*fact'}] }
85
+ context "with --exclude='.*dimension' '.*fact'" do
86
+ let(:options) { ["--exclude='.*dimension' '.*fact'"] }
87
87
  it_behaves_like 'executes with success'
88
88
  end
89
89
 
@@ -69,7 +69,7 @@ describe Masamune::Tasks::HiveThor do
69
69
  context 'with --variables=YEAR:2015 MONTH:1' do
70
70
  let(:options) { ['--variables=YEAR:2015', 'MONTH:1'] }
71
71
  it do
72
- expect_any_instance_of(described_class).to receive(:hive).with(hash_including(variables: { 'YEAR' => '2015', 'MONTH' => '1'})).once.and_return(mock_success)
72
+ expect_any_instance_of(described_class).to receive(:hive).with(hash_including(variables: { 'YEAR' => '2015', 'MONTH' => '1' })).once.and_return(mock_success)
73
73
  cli_invocation
74
74
  end
75
75
  end
@@ -77,7 +77,7 @@ describe Masamune::Tasks::HiveThor do
77
77
  context 'with -X YEAR:2015 MONTH:1' do
78
78
  let(:options) { ['-X', 'YEAR:2015', 'MONTH:1'] }
79
79
  it do
80
- expect_any_instance_of(described_class).to receive(:hive).with(hash_including(variables: { 'YEAR' => '2015', 'MONTH' => '1'})).once.and_return(mock_success)
80
+ expect_any_instance_of(described_class).to receive(:hive).with(hash_including(variables: { 'YEAR' => '2015', 'MONTH' => '1' })).once.and_return(mock_success)
81
81
  cli_invocation
82
82
  end
83
83
  end
@@ -40,7 +40,7 @@ describe Masamune::Template do
40
40
 
41
41
  context 'with simple template' do
42
42
  let(:template) { File.expand_path('../../fixtures/simple.sql.erb', __FILE__) }
43
- let(:parameters) { {table: 'zombo'} }
43
+ let(:parameters) { { table: 'zombo' } }
44
44
 
45
45
  it { is_expected.to eq("SELECT * FROM zombo;\n") }
46
46
  end
@@ -59,7 +59,8 @@ describe Masamune::Template do
59
59
  context 'with aggregate template' do
60
60
  let(:template) { File.expand_path('../../fixtures/aggregate.sql.erb', __FILE__) }
61
61
 
62
- it do is_expected.to eq <<-EOS.gsub(/^\s*/,'')
62
+ it do
63
+ is_expected.to eq <<-EOS.gsub(/^\s*/, '')
63
64
  SHOW TABLES;
64
65
  SELECT * FROM foo;
65
66
  SELECT * FROM bar;
@@ -29,8 +29,8 @@ describe Masamune::Thor do
29
29
  namespace :example
30
30
 
31
31
  desc 'command', 'command'
32
- target path: fs.path(:tmp_dir, "target/%Y-%m-%d")
33
- source path: fs.path(:tmp_dir, "source/%Y%m%d*.log")
32
+ target path: fs.path(:tmp_dir, 'target/%Y-%m-%d')
33
+ source path: fs.path(:tmp_dir, 'source/%Y%m%d*.log')
34
34
  def command_task
35
35
  # NOP
36
36
  end
@@ -48,8 +48,8 @@ describe Masamune::Thor do
48
48
  end
49
49
 
50
50
  desc 'unknown', 'unknown'
51
- target path: fs.path(:unknown_dir, "target/%Y-%m-%d")
52
- source path: fs.path(:unknown_dir, "source/%Y%m%d*.log")
51
+ target path: fs.path(:unknown_dir, 'target/%Y-%m-%d')
52
+ source path: fs.path(:unknown_dir, 'source/%Y%m%d*.log')
53
53
  def unknown_task
54
54
  # NOP
55
55
  end
@@ -188,7 +188,7 @@ describe Masamune::Thor do
188
188
  expect_any_instance_of(Logger).to receive(:error).with(/random exception/)
189
189
  allow(thor_class).to receive(:dispatch).and_raise('random exception')
190
190
  end
191
- it { expect { cli_invocation }.to raise_error /random exception/ }
191
+ it { expect { cli_invocation }.to raise_error(/random exception/) }
192
192
  end
193
193
 
194
194
  context 'with command that raises exception after initialization' do
@@ -198,7 +198,7 @@ describe Masamune::Thor do
198
198
  expect_any_instance_of(Logger).to receive(:error).with(/random exception/)
199
199
  allow(thor_class).to receive(:after_initialize_invoke).and_raise('random exception')
200
200
  end
201
- it { expect { cli_invocation }.to raise_error /random exception/ }
201
+ it { expect { cli_invocation }.to raise_error(/random exception/) }
202
202
  end
203
203
 
204
204
  context 'with command that raises exception during execution' do
@@ -243,12 +243,12 @@ describe Masamune::Thor do
243
243
 
244
244
  context 'without --' do
245
245
  let(:argv) { ['--flag', 'true'] }
246
- it { is_expected.to eq([['--flag', 'true'],[]]) }
246
+ it { is_expected.to eq([['--flag', 'true'], []]) }
247
247
  end
248
248
 
249
249
  context 'with -- and no following arguments' do
250
250
  let(:argv) { ['--flag', 'true', '--'] }
251
- it { is_expected.to eq([['--flag', 'true'],[]]) }
251
+ it { is_expected.to eq([['--flag', 'true'], []]) }
252
252
  end
253
253
 
254
254
  context 'with -- and a single extra argument' do
@@ -28,14 +28,14 @@ describe Masamune::Transform::BulkUpsert do
28
28
  dimension 'cluster', type: :mini do
29
29
  column 'id', type: :integer, surrogate_key: true, auto: true
30
30
  column 'name', type: :string, unique: true
31
- row name: 'default', attributes: {default: true}
31
+ row name: 'default', attributes: { default: true }
32
32
  end
33
33
 
34
34
  dimension 'user_account_state', type: :mini do
35
35
  column 'name', type: :string, unique: true
36
36
  column 'description', type: :string
37
37
  row name: 'registered', description: 'Registered'
38
- row name: 'active', description: 'Active', attributes: {default: true}
38
+ row name: 'active', description: 'Active', attributes: { default: true }
39
39
  row name: 'inactive', description: 'Inactive'
40
40
  end
41
41
 
@@ -43,7 +43,7 @@ describe Masamune::Transform::BulkUpsert do
43
43
  references :cluster
44
44
  column 'tenant_id', type: :integer, unique: true, natural_key: true
45
45
  column 'department_id', type: :integer, unique: true, natural_key: true
46
- row tenant_id: -1, department_id: -1, attributes: {default: true}
46
+ row tenant_id: -1, department_id: -1, attributes: { default: true }
47
47
  end
48
48
 
49
49
  dimension 'user', type: :four do
@@ -239,13 +239,13 @@ describe Masamune::Transform::DefineTable do
239
239
  dimension 'cluster', type: :mini do
240
240
  column 'id', type: :integer, surrogate_key: true, auto: true
241
241
  column 'name', type: :string, unique: true
242
- row name: 'default', attributes: {default: true}
242
+ row name: 'default', attributes: { default: true }
243
243
  end
244
244
 
245
245
  dimension 'user_account_state', type: :mini do
246
246
  column 'name', type: :string, unique: true
247
247
  column 'description', type: :string
248
- row name: 'active', description: 'Active', attributes: {default: true}
248
+ row name: 'active', description: 'Active', attributes: { default: true }
249
249
  end
250
250
 
251
251
  dimension 'user', type: :four do
@@ -380,7 +380,7 @@ describe Masamune::Transform::DefineTable do
380
380
  dimension 'user_account_state', type: :mini do
381
381
  column 'name', type: :string, unique: true
382
382
  column 'description', type: :string
383
- row name: 'active', description: 'Active', attributes: {default: true}
383
+ row name: 'active', description: 'Active', attributes: { default: true }
384
384
  end
385
385
 
386
386
  dimension 'user', type: :four do
@@ -27,7 +27,7 @@ describe Masamune::Transform::DefineTable do
27
27
  column 'id', type: :sequence, surrogate_key: true, auto: true
28
28
  column 'name', type: :string
29
29
 
30
- row name: 'current_database()', attributes: {default: true}
30
+ row name: 'current_database()', attributes: { default: true }
31
31
  end
32
32
 
33
33
  dimension 'date', type: :date do
@@ -150,11 +150,11 @@ describe Masamune::Transform::DefineTable do
150
150
  context 'for postgres fact partition with :post' do
151
151
  let(:target) { catalog.postgres.visits_fact.partition_table(Date.civil(2015, 01, 01)) }
152
152
 
153
- let(:options) { {section: :post} }
153
+ let(:options) { { section: :post } }
154
154
 
155
155
  it 'should eq render table template' do
156
- is_expected.to match /ALTER TABLE visits_fact_y2015m01 INHERIT visits_fact;/
157
- is_expected.to match /ALTER TABLE visits_fact_y2015m01 ADD CONSTRAINT visits_fact_y2015m01_time_key_check CHECK \(time_key >= 1420070400 AND time_key < 1422748800\);/
156
+ is_expected.to match(/ALTER TABLE visits_fact_y2015m01 INHERIT visits_fact;/)
157
+ is_expected.to match(/ALTER TABLE visits_fact_y2015m01 ADD CONSTRAINT visits_fact_y2015m01_time_key_check CHECK \(time_key >= 1420070400 AND time_key < 1422748800\);/)
158
158
  end
159
159
  end
160
160
 
@@ -163,7 +163,7 @@ describe Masamune::Transform::DefineTable do
163
163
  let(:intermediate) { catalog.postgres.visits_fact }
164
164
  let(:source) { catalog.postgres.visits_file }
165
165
  let(:target) { source.stage_table(suffix: 'file', table: intermediate, inherit: false) }
166
- let(:options) { { files: files} }
166
+ let(:options) { { files: files } }
167
167
 
168
168
  it 'should eq render table template' do
169
169
  is_expected.to eq <<-EOS.strip_heredoc
@@ -101,8 +101,8 @@ describe Masamune::Transform::DefineTable do
101
101
  before do
102
102
  catalog.schema :postgres do
103
103
  table 'user' do
104
- column 'tenant_id', index: ['tenant_id', 'shared']
105
- column 'user_id', index: ['user_id', 'shared']
104
+ column 'tenant_id', index: %w(tenant_id shared)
105
+ column 'user_id', index: %w(user_id shared)
106
106
  end
107
107
  end
108
108
  end
@@ -146,7 +146,7 @@ describe Masamune::Transform::DefineTable do
146
146
  catalog.schema :postgres do
147
147
  table 'user' do
148
148
  column 'tenant_id', unique: ['shared']
149
- column 'user_id', unique: ['user_id', 'shared']
149
+ column 'user_id', unique: %w(user_id shared)
150
150
  end
151
151
  end
152
152
  end
@@ -525,8 +525,8 @@ describe Masamune::Transform::DefineTable do
525
525
  table 'user' do
526
526
  column 'tenant_id', type: :integer, natural_key: true
527
527
  column 'user_id', type: :integer, natural_key: true
528
- row tenant_id: 'default_tenant_id()', user_id: -1, attributes: {default: true}
529
- row tenant_id: 'default_tenant_id()', user_id: -2, attributes: {id: 'unknown'}
528
+ row tenant_id: 'default_tenant_id()', user_id: -1, attributes: { default: true }
529
+ row tenant_id: 'default_tenant_id()', user_id: -2, attributes: { id: 'unknown' }
530
530
  end
531
531
  end
532
532
  end
@@ -885,7 +885,7 @@ describe Masamune::Transform::DefineTable do
885
885
  column 'name', type: :string, unique: true
886
886
  column 'description', type: :string
887
887
  row name: 'registered', description: 'Registered'
888
- row name: 'active', description: 'Active', attributes: {default: true}
888
+ row name: 'active', description: 'Active', attributes: { default: true }
889
889
  row name: 'inactive', description: 'Inactive'
890
890
  end
891
891
  end
@@ -27,7 +27,7 @@ describe Masamune::Transform::DenormalizeTable do
27
27
  column 'id', type: :sequence, surrogate_key: true, auto: true
28
28
  column 'name', type: :string
29
29
 
30
- row name: 'current_database()', attributes: {default: true}
30
+ row name: 'current_database()', attributes: { default: true }
31
31
  end
32
32
 
33
33
  dimension 'date', type: :date do
@@ -73,7 +73,7 @@ describe Masamune::Transform::DenormalizeTable do
73
73
 
74
74
  context 'with postgres dimension' do
75
75
  let(:target) { catalog.postgres.user_dimension }
76
- let(:options) { { } }
76
+ let(:options) { {} }
77
77
 
78
78
  it 'should eq render denormalize_table template' do
79
79
  is_expected.to eq <<-EOS.strip_heredoc
@@ -106,7 +106,7 @@ describe Masamune::Transform::DenormalizeTable do
106
106
 
107
107
  context 'with postgres fact without :columns' do
108
108
  let(:target) { catalog.postgres.visits_fact }
109
- let(:options) { { } }
109
+ let(:options) { {} }
110
110
 
111
111
  it 'should eq render denormalize_table template' do
112
112
  is_expected.to eq <<-EOS.strip_heredoc
@@ -322,18 +322,18 @@ describe Masamune::Transform::DenormalizeTable do
322
322
 
323
323
  let(:options) do
324
324
  {
325
- columns: [
326
- 'tenant_id',
327
- 'tenant_account_state',
328
- 'tenant_premium_state',
329
- 'preferences',
330
- 'y',
331
- 'm'
332
- ],
333
- order: [
334
- 'tenant_id',
335
- 'start_at'
336
- ]
325
+ columns: %w(
326
+ tenant_id
327
+ tenant_account_state
328
+ tenant_premium_state
329
+ preferences
330
+ y
331
+ m
332
+ ),
333
+ order: %w(
334
+ tenant_id
335
+ start_at
336
+ )
337
337
  }
338
338
  end
339
339
 
@@ -28,7 +28,7 @@ describe Masamune::Transform::InsertReferenceValues do
28
28
  dimension 'department', type: :mini do
29
29
  column 'tenant_id', type: :integer, unique: true, natural_key: true
30
30
  column 'department_id', type: :integer, unique: true, natural_key: true
31
- row tenant_id: -1, department_id: -1, attributes: {default: true}
31
+ row tenant_id: -1, department_id: -1, attributes: { default: true }
32
32
  end
33
33
 
34
34
  dimension 'user', type: :four do
@@ -31,7 +31,7 @@ describe Masamune::Transform::LoadDimension do
31
31
  dimension 'department', type: :mini do
32
32
  column 'tenant_id', type: :integer, unique: true, natural_key: true
33
33
  column 'department_id', type: :integer, unique: true, natural_key: true
34
- row tenant_id: -1, department_id: -1, attributes: {default: true}
34
+ row tenant_id: -1, department_id: -1, attributes: { default: true }
35
35
  end
36
36
 
37
37
  dimension 'user', type: :four do