avm-tools 0.75.1 → 0.79.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/files/formatter.rb +8 -4
  3. data/lib/avm/git/auto_commit_path.rb +2 -4
  4. data/lib/avm/git/auto_commit_path/ruby.rb +20 -0
  5. data/lib/avm/patches/class/i18n.rb +31 -0
  6. data/lib/avm/patches/object/i18n.rb +2 -10
  7. data/lib/avm/projects/stereotypes/ruby_gem/update.rb +4 -1
  8. data/lib/avm/projects/stereotypes/ruby_gem/version_bump.rb +1 -2
  9. data/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb +7 -16
  10. data/lib/avm/tools/runner/files/format.rb +3 -2
  11. data/lib/avm/tools/runner/git/auto_commit.rb +11 -0
  12. data/lib/avm/tools/runner/git/subrepo/clone.rb +84 -0
  13. data/lib/avm/tools/version.rb +1 -1
  14. data/template/avm/eac_redmine_base0/deploy/config/install.sh.template +12 -0
  15. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  16. data/vendor/eac_cli/lib/eac_cli/definition.rb +49 -22
  17. data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +83 -0
  18. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +17 -1
  19. data/vendor/eac_cli/lib/eac_cli/{parser/options_collection.rb → definition/help_formatter.rb} +20 -49
  20. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +21 -4
  21. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +18 -40
  22. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +50 -0
  23. data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +1 -0
  24. data/vendor/eac_cli/lib/eac_cli/parser.rb +21 -3
  25. data/vendor/eac_cli/lib/eac_cli/parser/alternative.rb +88 -0
  26. data/vendor/eac_cli/lib/eac_cli/parser/alternative/argv.rb +17 -0
  27. data/vendor/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb +24 -0
  28. data/vendor/eac_cli/lib/eac_cli/parser/alternative/options.rb +58 -0
  29. data/vendor/eac_cli/lib/eac_cli/parser/alternative/positionals.rb +30 -0
  30. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +4 -0
  31. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
  32. data/vendor/eac_cli/lib/eac_cli/runner.rb +6 -2
  33. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +1 -1
  34. data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +5 -1
  35. data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +96 -0
  36. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  37. data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +14 -0
  38. data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +35 -0
  39. data/vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +140 -0
  40. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +57 -40
  41. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +53 -0
  42. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +57 -0
  43. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +32 -1
  44. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +1 -1
  45. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  46. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/abstract_methods.rb +60 -0
  47. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb +53 -0
  48. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +4 -69
  49. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/entry_reader.rb +81 -0
  50. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/password_entry_reader.rb +18 -0
  51. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb +7 -2
  52. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/store_passwords_entry_reader.rb +27 -0
  53. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator.rb +4 -0
  54. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/current.rb +9 -0
  55. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/stopped.rb +14 -0
  56. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/abstract_methods.rb +10 -0
  57. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb +17 -0
  58. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  59. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +3 -2
  60. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/abstract_methods_spec.rb +28 -0
  61. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_constructor_spec.rb +66 -8
  62. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/current_spec.rb +26 -0
  63. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/stopped_spec.rb +32 -0
  64. metadata +31 -5
  65. data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +0 -21
  66. data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +0 -49
@@ -61,6 +61,8 @@ module EacRubyUtils
61
61
  setup_class_attr_readers(klass)
62
62
  setup_class_attr_writers(klass)
63
63
  setup_class_initialize(klass)
64
+
65
+ klass
64
66
  end
65
67
 
66
68
  def setup_class_attr_readers(klass)
@@ -79,9 +81,14 @@ module EacRubyUtils
79
81
  klass.define_callbacks :initialize
80
82
  klass.send(:define_method, :initialize) do |*args|
81
83
  Initialize.new(common_constructor, args, self).run
84
+ super(*SuperArgs.new(common_constructor, args, self).result)
82
85
  end
83
86
  end
84
87
 
88
+ def super_args
89
+ options[:super_args]
90
+ end
91
+
85
92
  class Initialize
86
93
  attr_reader :common_constructor, :args, :object
87
94
 
@@ -129,5 +136,51 @@ module EacRubyUtils
129
136
  " (given #{args.count}, expected #{common_constructor.args_count})"
130
137
  end
131
138
  end
139
+
140
+ class SuperArgs
141
+ attr_reader :common_constructor, :args, :object
142
+
143
+ def initialize(common_constructor, args, object)
144
+ @common_constructor = common_constructor
145
+ @args = args
146
+ @object = object
147
+ end
148
+
149
+ def auto_result
150
+ r = []
151
+ sub_args.each do |name, value|
152
+ i = super_arg_index(name)
153
+ r[i] = value if i
154
+ end
155
+ r
156
+ end
157
+
158
+ def result
159
+ result_from_options || auto_result
160
+ end
161
+
162
+ def result_from_options
163
+ return unless common_constructor.super_args
164
+
165
+ object.instance_exec(&common_constructor.super_args)
166
+ end
167
+
168
+ def sub_args
169
+ common_constructor.args.each_with_index.map do |name, index|
170
+ [name, args[index]]
171
+ end.to_h
172
+ end
173
+
174
+ def super_arg_index(name)
175
+ super_method.parameters.each_with_index do |arg, index|
176
+ return index if arg[1] == name
177
+ end
178
+ nil
179
+ end
180
+
181
+ def super_method
182
+ object.class.superclass ? object.class.superclass.instance_method(:initialize) : nil
183
+ end
184
+ end
132
185
  end
133
186
  end
@@ -11,18 +11,10 @@ module EacRubyUtils
11
11
 
12
12
  class << self
13
13
  def entry_key_to_envvar_name(entry_key)
14
- path = if entry_key.is_a?(::Array)
15
- entry_key
16
- else
17
- ::EacRubyUtils::PathsHash.parse_entry_key(entry_key)
18
- end
19
- path.join('_').gsub(/[^a-z0-9_]/i, '').gsub(/\A_+/, '').gsub(/_+\z/, '')
20
- .gsub(/_{2,}/, '_').upcase
14
+ ::EacRubyUtils::Console::Configs::EntryReader.entry_key_to_envvar_name(entry_key)
21
15
  end
22
16
  end
23
17
 
24
- STORE_PASSWORDS_KEY = 'core.store_passwords'
25
-
26
18
  attr_reader :configs
27
19
 
28
20
  def initialize(configs_key, options = {})
@@ -31,72 +23,15 @@ module EacRubyUtils
31
23
  end
32
24
 
33
25
  def read_password(entry_key, options = {})
34
- options = ReadEntryOptions.new(options.merge(noecho: true))
35
- if store_passwords?
36
- read_entry(entry_key, options)
37
- else
38
- looped_entry_value_from_input(entry_key, options)
39
- end
26
+ ::EacRubyUtils::Console::Configs::PasswordEntryReader.new(self, entry_key, options).read
40
27
  end
41
28
 
42
29
  def read_entry(entry_key, options = {})
43
- options = ReadEntryOptions.new(options)
44
- unless options[:noenv]
45
- envvar_value = envvar_read_entry(entry_key)
46
- return envvar_value if envvar_value.present?
47
- end
48
- stored_value = configs.read_entry(entry_key)
49
- return stored_value if stored_value
50
- return read_entry_from_console(entry_key, options) unless options[:noinput]
51
-
52
- raise "No value found for entry \"#{entry_key}\"" if options[:required]
30
+ ::EacRubyUtils::Console::Configs::EntryReader.new(self, entry_key, options).read
53
31
  end
54
32
 
55
33
  def store_passwords?
56
- read_entry(
57
- STORE_PASSWORDS_KEY,
58
- before_input: -> { store_password_banner },
59
- validator: ->(entry_value) { %w[yes no].include?(entry_value) }
60
- ) == 'yes'
61
- end
62
-
63
- protected
64
-
65
- def envvar_read_entry(entry_key)
66
- env_entry_key = self.class.entry_key_to_envvar_name(entry_key)
67
- return nil unless ENV.key?(env_entry_key)
68
-
69
- ENV.fetch(env_entry_key).if_present(::EacRubyUtils::BlankNotBlank.instance)
70
- end
71
-
72
- def read_entry_from_console(entry_key, options)
73
- options[:before_input].call if options[:before_input].present?
74
- entry_value = looped_entry_value_from_input(entry_key, options)
75
- configs.write_entry(entry_key, entry_value)
76
- entry_value
77
- end
78
-
79
- def store_password_banner
80
- infom 'Do you wanna to store passwords?'
81
- infom "Warning: the passwords will be store in clear text in \"#{configs.storage_path}\""
82
- infom 'Enter "yes" or "no"'
83
- end
84
-
85
- def looped_entry_value_from_input(entry_key, options)
86
- loop do
87
- entry_value = entry_value_from_input(entry_key, options)
88
- next if entry_value.blank?
89
- next if options[:validator] && !options[:validator].call(entry_value)
90
-
91
- return entry_value
92
- end
93
- end
94
-
95
- def entry_value_from_input(entry_key, options)
96
- entry_value = request_input("Value for entry \"#{entry_key}\"",
97
- options.request_input_options)
98
- warn('Entered value is blank') if entry_value.blank?
99
- entry_value
34
+ ::EacRubyUtils::Console::Configs::StorePasswordsEntryReader.new(self) == 'yes'
100
35
  end
101
36
  end
102
37
  end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/console/configs/read_entry_options'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module EacRubyUtils
7
+ module Console
8
+ class Configs
9
+ class EntryReader
10
+ enable_console_speaker
11
+
12
+ class << self
13
+ def entry_key_to_envvar_name(entry_key)
14
+ path = if entry_key.is_a?(::Array)
15
+ entry_key
16
+ else
17
+ ::EacRubyUtils::PathsHash.parse_entry_key(entry_key)
18
+ end
19
+ path.join('_').gsub(/[^a-z0-9_]/i, '').gsub(/\A_+/, '').gsub(/_+\z/, '')
20
+ .gsub(/_{2,}/, '_').upcase
21
+ end
22
+ end
23
+
24
+ common_constructor :console_configs, :entry_key, :options do
25
+ self.options = ::EacRubyUtils::Console::Configs::ReadEntryOptions.new(options)
26
+ end
27
+
28
+ def read
29
+ %w[envvars storage console].each do |suffix|
30
+ value = send("read_from_#{suffix}")
31
+ return value if value.present?
32
+ end
33
+ return nil unless options[:required]
34
+
35
+ raise "No value found for entry \"#{entry_key}\""
36
+ end
37
+
38
+ def read_from_storage
39
+ console_configs.configs.read_entry(entry_key)
40
+ end
41
+
42
+ def read_from_envvars
43
+ return if options[:noenv]
44
+
45
+ env_entry_key = self.class.entry_key_to_envvar_name(entry_key)
46
+ return unless ENV.key?(env_entry_key)
47
+
48
+ ENV.fetch(env_entry_key).if_present(::EacRubyUtils::BlankNotBlank.instance)
49
+ end
50
+
51
+ def read_from_console
52
+ return if options[:noinput]
53
+
54
+ options[:before_input].if_present(&:call)
55
+ entry_value = looped_entry_value_from_input
56
+ console_configs.configs.write_entry(entry_key, entry_value) if options[:store]
57
+ entry_value
58
+ end
59
+
60
+ private
61
+
62
+ def looped_entry_value_from_input
63
+ loop do
64
+ entry_value = entry_value_from_input(entry_key, options)
65
+ next if entry_value.blank?
66
+ next if options[:validator] && !options[:validator].call(entry_value)
67
+
68
+ return entry_value
69
+ end
70
+ end
71
+
72
+ def entry_value_from_input(entry_key, options)
73
+ entry_value = request_input("Value for entry \"#{entry_key}\"",
74
+ options.request_input_options)
75
+ warn('Entered value is blank') if entry_value.blank?
76
+ entry_value
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/console/configs/entry_reader'
4
+
5
+ module EacRubyUtils
6
+ module Console
7
+ class Configs
8
+ class PasswordEntryReader < ::EacRubyUtils::Console::Configs::EntryReader
9
+ ENTRY_KEY = 'core.store_passwords'
10
+
11
+ def initialize(console_configs, entry_key, options = {})
12
+ super(console_configs, entry_key, options.merge(noecho: true,
13
+ store: console_configs.store_passwords?))
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -7,13 +7,18 @@ module EacRubyUtils
7
7
  class Configs
8
8
  class ReadEntryOptions
9
9
  enable_simple_cache
10
- common_constructor :options
10
+ common_constructor :options do
11
+ self.options = options.to_h.symbolize_keys
12
+ .assert_valid_keys(DEFAULT_VALUES.keys).freeze
13
+ end
11
14
 
12
15
  DEFAULT_VALUES = {
13
16
  before_input: nil, bool: false, list: false, noecho: false, noenv: false, noinput: false,
14
- required: true, validator: nil
17
+ required: true, store: true, validator: nil
15
18
  }.freeze
16
19
 
20
+ delegate :to_h, to: :options
21
+
17
22
  def [](key)
18
23
  values.fetch(key.to_sym)
19
24
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/console/configs/entry_reader'
4
+
5
+ module EacRubyUtils
6
+ module Console
7
+ class Configs
8
+ class StorePasswordsEntryReader < ::EacRubyUtils::Console::Configs::EntryReader
9
+ ENTRY_KEY = 'core.store_passwords'
10
+
11
+ def initialize(console_configs)
12
+ super(console_configs, ENTRY_KEY,
13
+ before_input: -> { banner },
14
+ validator: ->(entry_value) { %w[yes no].include?(entry_value) }
15
+ )
16
+ end
17
+
18
+ def banner
19
+ infom 'Do you wanna to store passwords?'
20
+ infom 'Warning: the passwords will be store in clear text in ' \
21
+ "\"#{console_configs.configs.storage_path}\""
22
+ infom 'Enter "yes" or "no"'
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub __FILE__
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Enumerator
4
+ def current(default_value = nil)
5
+ peek
6
+ rescue ::StopIteration
7
+ default_value
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Enumerator
4
+ def ongoing?
5
+ !stopped?
6
+ end
7
+
8
+ def stopped?
9
+ peek
10
+ false
11
+ rescue ::StopIteration
12
+ true
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/abstract_methods'
4
+
5
+ class Module
6
+ def enable_abstract_methods(*methods)
7
+ include ::EacRubyUtils::AbstractMethods
8
+ abstract_methods(*methods)
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Object
4
+ def print_debug
5
+ STDERR.write(to_debug + "\n")
6
+
7
+ self
8
+ end
9
+
10
+ def to_debug
11
+ "|#{self.class}|#{self}|"
12
+ end
13
+
14
+ def raise_debug
15
+ raise to_debug
16
+ end
17
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.49.1'
4
+ VERSION = '0.54.0'
5
5
  end
@@ -1,13 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'date'
3
4
  require 'yaml'
4
5
 
5
6
  module EacRubyUtils
6
7
  # A safe YAML loader/dumper with common types included.
7
8
  class Yaml
8
9
  class << self
9
- DEFAULT_PERMITTED_CLASSES = [::Array, ::Date, ::FalseClass, ::Hash, ::NilClass, ::Numeric,
10
- ::String, ::Symbol, ::Time, ::TrueClass].freeze
10
+ DEFAULT_PERMITTED_CLASSES = [::Array, ::Date, ::DateTime, ::FalseClass, ::Hash, ::NilClass,
11
+ ::Numeric, ::String, ::Symbol, ::Time, ::TrueClass].freeze
11
12
 
12
13
  def dump(object)
13
14
  ::YAML.dump(sanitize(object))
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/abstract_methods'
4
+
5
+ RSpec.describe(::EacRubyUtils::AbstractMethods) do
6
+ let(:base_class) do
7
+ the_module = described_class
8
+ ::Class.new do
9
+ include the_module
10
+
11
+ abstract_methods :method1, :method2
12
+ end
13
+ end
14
+ let(:base_instance) { base_class.new }
15
+ let(:sub_class) do
16
+ ::Class.new(base_class) do
17
+ def method1
18
+ 'a result'
19
+ end
20
+ end
21
+ end
22
+ let(:sub_instance) { sub_class.new }
23
+
24
+ it { expect { base_instance.method1 }.to raise_error(::NoMethodError) }
25
+ it { expect { base_instance.method2 }.to raise_error(::NoMethodError) }
26
+ it { expect(sub_instance.method1).to eq('a result') }
27
+ it { expect { sub_instance.method2 }.to raise_error(::NoMethodError) }
28
+ end
@@ -3,34 +3,92 @@
3
3
  require 'eac_ruby_utils/common_constructor'
4
4
 
5
5
  RSpec.describe ::EacRubyUtils::CommonConstructor do
6
- ARG_LIST = %i[a b c d].freeze
6
+ ARG_LIST = %i[a b c d].freeze # rubocop:disable RSpec/LeakyConstantDeclaration
7
+
7
8
  let(:instance) do
8
9
  described_class.new(*ARG_LIST, default: %w[Vcc Vd]) do
9
10
  @z = 'Vz'
10
11
  end
11
12
  end
12
13
 
13
- class MyClass
14
- attr_reader :z
14
+ let(:a_class) do
15
+ ::Class.new do
16
+ attr_reader :z
17
+ end
15
18
  end
16
19
 
17
- let(:subject) { MyClass.new('Va', 'Vb', 'Vc') }
20
+ let(:a_class_instance) { a_class.new('Va', 'Vb', 'Vc') }
18
21
 
19
22
  before do
20
- instance.setup_class(::MyClass)
23
+ instance.setup_class(a_class)
21
24
  end
22
25
 
23
- it { expect(subject.z).to eq('Vz') }
26
+ it { expect(a_class_instance.z).to eq('Vz') }
24
27
 
25
28
  ARG_LIST.each do |attr|
26
29
  expected_value = "V#{attr}"
27
30
  it "attribute \"#{attr}\" equal to \"#{expected_value}\"" do
28
- expect(subject.send(attr)).to eq(expected_value)
31
+ expect(a_class_instance.send(attr)).to eq(expected_value)
29
32
  end
30
33
 
31
34
  [false, true].each do |include_all|
32
35
  it "respond_to?('#{attr}', #{include_all}) == #{include_all}" do
33
- expect(subject.respond_to?("#{attr}=", include_all)).to eq(include_all)
36
+ expect(a_class_instance.respond_to?("#{attr}=", include_all)).to eq(include_all)
37
+ end
38
+ end
39
+ end
40
+
41
+ context 'with super class' do
42
+ let(:super_class) do
43
+ ::Class.new do
44
+ attr_reader :super_a, :super_b
45
+
46
+ def initialize(a, b) # rubocop:disable Naming/MethodParameterName
47
+ @super_a = a
48
+ @super_b = b
49
+ end
50
+ end
51
+ end
52
+
53
+ let(:sub_class) do
54
+ sub_constructor.setup_class(::Class.new(super_class))
55
+ end
56
+
57
+ let(:sub_object) { sub_class.new(1, 2, 3, 4) }
58
+
59
+ context 'with super_args parameter' do
60
+ let(:sub_constructor) do
61
+ described_class.new(:c, :a, :b, :d, super_args: -> { [c, a] })
62
+ end
63
+
64
+ it { expect(sub_object.a).to eq(2) }
65
+ it { expect(sub_object.b).to eq(3) }
66
+ it { expect(sub_object.c).to eq(1) }
67
+ it { expect(sub_object.d).to eq(4) }
68
+ it { expect(sub_object.super_a).to eq(1) }
69
+ it { expect(sub_object.super_b).to eq(2) }
70
+ end
71
+
72
+ context 'without super_args parameter' do
73
+ let(:sub_constructor) do
74
+ described_class.new(:c, :a, :b, :d)
75
+ end
76
+
77
+ it { expect(sub_object.a).to eq(2) }
78
+ it { expect(sub_object.b).to eq(3) }
79
+ it { expect(sub_object.c).to eq(1) }
80
+ it { expect(sub_object.d).to eq(4) }
81
+ it { expect(sub_object.super_a).to eq(2) }
82
+ it { expect(sub_object.super_b).to eq(3) }
83
+ end
84
+
85
+ context 'with undefined super arguments' do
86
+ let(:sub_constructor) do
87
+ described_class.new(:x, :y, :w, :a)
88
+ end
89
+
90
+ it do
91
+ expect { sub_object }.to raise_error(::ArgumentError)
34
92
  end
35
93
  end
36
94
  end