ehbrs-tools 0.16.1 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ehbrs/cooking_book.rb +9 -0
  3. data/lib/ehbrs/cooking_book/build.rb +45 -0
  4. data/lib/ehbrs/cooking_book/build/base_page.rb +43 -0
  5. data/lib/ehbrs/cooking_book/build/index_page.rb +26 -0
  6. data/lib/ehbrs/cooking_book/build/recipe_page.rb +27 -0
  7. data/lib/ehbrs/cooking_book/project.rb +25 -0
  8. data/lib/ehbrs/cooking_book/recipe.rb +37 -0
  9. data/lib/ehbrs/cooking_book/recipe/ingredient.rb +21 -0
  10. data/lib/ehbrs/cooking_book/recipe/measure.rb +60 -0
  11. data/lib/ehbrs/cooking_book/recipe/part.rb +32 -0
  12. data/lib/ehbrs/patches/module/erb_template.rb +11 -0
  13. data/lib/ehbrs/patches/object/erb_template.rb +9 -0
  14. data/lib/ehbrs/patches/object/template.rb +7 -0
  15. data/lib/ehbrs/runner.rb +6 -13
  16. data/lib/ehbrs/runner/cooking_book.rb +30 -0
  17. data/lib/ehbrs/runner/cooking_book/build.rb +32 -0
  18. data/lib/ehbrs/runner/videos/probe.rb +3 -3
  19. data/lib/ehbrs/tools/application.rb +13 -0
  20. data/lib/ehbrs/tools/version.rb +1 -1
  21. data/lib/ehbrs/videos/file.rb +4 -8
  22. data/lib/ehbrs/videos/track.rb +5 -13
  23. data/lib/ehbrs/videos/unsupported/checks/codec_extra_unlisted.rb +3 -1
  24. data/lib/ehbrs/videos/unsupported/checks/codec_extra_unsupported.rb +3 -1
  25. data/lib/ehbrs/videos/unsupported/checks/codec_unlisted.rb +4 -2
  26. data/lib/ehbrs/videos/unsupported/checks/codec_unsupported.rb +3 -1
  27. data/lib/ehbrs/videos/unsupported/checks/invalid_extension.rb +2 -0
  28. data/lib/ehbrs/videos/unsupported/fix_profile.rb +0 -13
  29. data/lib/ehbrs/videos/unsupported/fixes/supported_codec.rb +10 -10
  30. data/lib/ehbrs/videos/unsupported/profiles/base.rb +17 -3
  31. data/lib/ehbrs/videos/unsupported/profiles/philco.rb +5 -4
  32. data/template/ehbrs/cooking_book/build/base_page/layout.html.erb +20 -0
  33. data/template/ehbrs/cooking_book/build/index_page/inner.html.erb +6 -0
  34. data/template/ehbrs/cooking_book/build/recipe_page/inner.html.erb +6 -0
  35. data/template/ehbrs/cooking_book/build/recipe_page/part.html.erb +27 -0
  36. data/vendor/aranha-parsers/lib/aranha/parsers/spec/source_target_fixtures_example.rb +10 -2
  37. data/vendor/aranha-parsers/lib/aranha/parsers/version.rb +1 -1
  38. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  39. data/vendor/eac_cli/lib/eac_cli/definition.rb +34 -39
  40. data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +83 -0
  41. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +18 -40
  42. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +50 -0
  43. data/vendor/eac_cli/lib/eac_cli/parser.rb +23 -3
  44. data/vendor/eac_cli/lib/eac_cli/parser/alternative.rb +92 -0
  45. data/vendor/eac_cli/lib/eac_cli/parser/alternative/argv.rb +17 -0
  46. data/vendor/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb +24 -0
  47. data/vendor/eac_cli/lib/eac_cli/parser/alternative/options.rb +58 -0
  48. data/vendor/eac_cli/lib/eac_cli/parser/alternative/positionals.rb +30 -0
  49. data/vendor/eac_cli/lib/eac_cli/runner.rb +12 -4
  50. data/vendor/eac_cli/lib/eac_cli/runner/exit.rb +13 -0
  51. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +18 -1
  52. data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +5 -1
  53. data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +6 -1
  54. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  55. data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +14 -0
  56. data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +10 -0
  57. data/vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +140 -0
  58. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +17 -5
  59. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +42 -0
  60. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +53 -0
  61. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +29 -1
  62. data/vendor/eac_docker/lib/eac_docker/container.rb +24 -0
  63. data/vendor/eac_docker/lib/eac_docker/images/coded.rb +39 -0
  64. data/vendor/eac_docker/lib/eac_docker/images/templatized.rb +26 -0
  65. data/vendor/eac_docker/lib/eac_docker/registry.rb +17 -0
  66. data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
  67. data/vendor/eac_docker/spec/lib/eac_docker/images/coded_spec.rb +12 -0
  68. data/vendor/eac_docker/spec/lib/eac_docker/images/coded_spec_files/image1/Dockerfile +1 -0
  69. data/vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec.rb +17 -0
  70. data/vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec_files/stub_docker_image/Dockerfile +1 -0
  71. data/vendor/eac_ruby_base0/Gemfile +5 -0
  72. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +20 -0
  73. data/vendor/eac_ruby_base0/lib/eac_ruby_base0.rb +7 -0
  74. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +69 -0
  75. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +54 -0
  76. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner/test_all.rb +27 -0
  77. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +5 -0
  78. data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +7 -0
  79. data/vendor/eac_ruby_base0/spec/spec_helper.rb +100 -0
  80. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/abstract_methods.rb +60 -0
  81. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +2 -50
  82. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/class_setup.rb +52 -0
  83. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/module_setup.rb +41 -0
  84. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb +6 -50
  85. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/class_initialize.rb +29 -0
  86. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/instance_initialize.rb +53 -0
  87. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/super_args.rb +54 -0
  88. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb +10 -1
  89. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +4 -6
  90. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/concat.rb +33 -0
  91. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb +24 -0
  92. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb +0 -21
  93. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/abstract_methods.rb +10 -0
  94. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/template.rb +10 -0
  95. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/template.rb +1 -8
  96. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb +2 -2
  97. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +7 -1
  98. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  99. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +11 -2
  100. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/abstract_methods_spec.rb +28 -0
  101. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_concern_spec.rb +40 -17
  102. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_constructor_spec.rb +96 -8
  103. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb +12 -1
  104. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +1 -1
  105. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container.rb +30 -2
  106. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/convert_job.rb +91 -0
  107. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/stream.rb +51 -0
  108. metadata +89 -13
  109. data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +0 -68
  110. data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +0 -38
  111. data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +0 -77
  112. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container/file.rb +0 -31
  113. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container/info.rb +0 -21
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/common_constructor/instance_initialize'
4
+ require 'eac_ruby_utils/common_constructor/super_args'
5
+
6
+ module EacRubyUtils
7
+ class CommonConstructor
8
+ class ClassInitialize
9
+ attr_reader :common_constructor, :klass
10
+
11
+ def initialize(common_constructor, klass)
12
+ @common_constructor = common_constructor
13
+ @klass = klass
14
+ end
15
+
16
+ def run
17
+ class_initialize = self
18
+ klass.send(:define_method, :initialize) do |*args|
19
+ ::EacRubyUtils::CommonConstructor::InstanceInitialize.new(
20
+ class_initialize.common_constructor, args, self
21
+ ).run
22
+ super(*::EacRubyUtils::CommonConstructor::SuperArgs.new(
23
+ class_initialize, args, self
24
+ ).result)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRubyUtils
4
+ class CommonConstructor
5
+ class InstanceInitialize
6
+ attr_reader :common_constructor, :args, :object
7
+
8
+ def initialize(common_constructor, args, object)
9
+ @common_constructor = common_constructor
10
+ @args = args
11
+ @object = object
12
+ end
13
+
14
+ def run
15
+ validate_args_count
16
+ object.run_callbacks :initialize do
17
+ object_attributes_set
18
+ object_after_callback
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def arg_value(arg_name)
25
+ arg_index = common_constructor.args.index(arg_name)
26
+ if arg_index < args.count
27
+ args[arg_index]
28
+ else
29
+ common_constructor.default_values[arg_index - common_constructor.args_count_min]
30
+ end
31
+ end
32
+
33
+ def object_after_callback
34
+ return unless common_constructor.after_set_block
35
+
36
+ object.instance_eval(&common_constructor.after_set_block)
37
+ end
38
+
39
+ def object_attributes_set
40
+ common_constructor.args.each do |arg_name|
41
+ object.send("#{arg_name}=", arg_value(arg_name))
42
+ end
43
+ end
44
+
45
+ def validate_args_count
46
+ return if common_constructor.args_count.include?(args.count)
47
+
48
+ raise ArgumentError, "#{object.class}.initialize: wrong number of arguments" \
49
+ " (given #{args.count}, expected #{common_constructor.args_count})"
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/module/delegation'
4
+
5
+ module EacRubyUtils
6
+ class CommonConstructor
7
+ class SuperArgs
8
+ attr_reader :class_initialize, :args, :object
9
+ delegate :common_constructor, to: :class_initialize
10
+
11
+ def initialize(class_initialize, args, object)
12
+ @class_initialize = class_initialize
13
+ @args = args
14
+ @object = object
15
+ end
16
+
17
+ def auto_result
18
+ r = []
19
+ sub_args.each do |name, value|
20
+ i = super_arg_index(name)
21
+ r[i] = value if i
22
+ end
23
+ r
24
+ end
25
+
26
+ def result
27
+ result_from_options || auto_result
28
+ end
29
+
30
+ def result_from_options
31
+ return unless common_constructor.super_args
32
+
33
+ object.instance_exec(&common_constructor.super_args)
34
+ end
35
+
36
+ def sub_args
37
+ common_constructor.args.each_with_index.map do |name, index|
38
+ [name, args[index]]
39
+ end.to_h
40
+ end
41
+
42
+ def super_arg_index(name)
43
+ super_method.parameters.each_with_index do |arg, index|
44
+ return index if arg[1] == name
45
+ end
46
+ nil
47
+ end
48
+
49
+ def super_method
50
+ class_initialize.klass.superclass&.instance_method(:initialize)
51
+ end
52
+ end
53
+ end
54
+ end
@@ -38,7 +38,7 @@ module EacRubyUtils
38
38
  def run_with_subcommand
39
39
  if subcommand_name
40
40
  check_valid_subcommand
41
- subcommand.run
41
+ subcommand_run
42
42
  else
43
43
  run_without_subcommand
44
44
  end
@@ -52,6 +52,15 @@ module EacRubyUtils
52
52
  )
53
53
  end
54
54
 
55
+ def subcommand_run
56
+ if !subcommand.is_a?(::EacRubyUtils::Console::DocoptRunner) &&
57
+ subcommand.respond_to?(:run_run)
58
+ subcommand.run_run
59
+ else
60
+ subcommand.run
61
+ end
62
+ end
63
+
55
64
  def target_doc
56
65
  super.gsub(SUBCOMMANDS_MACRO,
57
66
  "#{target_doc_subcommand_arg} [#{SUBCOMMAND_ARGS_ARG}...]") +
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/core_ext/hash/indifferent_access'
4
- require 'eac_ruby_utils/console/speaker'
5
- require 'eac_ruby_utils/envs/command/extra_options'
3
+ require 'eac_ruby_utils/core_ext'
6
4
  require 'eac_ruby_utils/envs/process'
7
5
  require 'eac_ruby_utils/envs/spawn'
8
6
  require 'pp'
@@ -11,8 +9,8 @@ require 'shellwords'
11
9
  module EacRubyUtils
12
10
  module Envs
13
11
  class Command
14
- include EacRubyUtils::Console::Speaker
15
- include EacRubyUtils::Envs::Command::ExtraOptions
12
+ require_sub __FILE__, include_modules: true
13
+ enable_console_speaker
16
14
 
17
15
  def initialize(env, command, extra_options = {})
18
16
  @env = env
@@ -47,7 +45,7 @@ module EacRubyUtils
47
45
  c = c.map { |x| escape(x) }.join(' ') if c.is_a?(Enumerable)
48
46
  append_command_options(
49
47
  @env.command_line(
50
- append_chdir(append_pipe(append_envvars(c)))
48
+ append_chdir(append_concat(append_envvars(c)))
51
49
  ),
52
50
  options
53
51
  )
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/struct'
4
+
5
+ module EacRubyUtils
6
+ module Envs
7
+ class Command
8
+ module Concat
9
+ def concat(operator, other_command)
10
+ duplicate_by_extra_options(concat: ::EacRubyUtils::Struct.new(
11
+ operator: operator, command: other_command
12
+ ))
13
+ end
14
+
15
+ def or(other_command)
16
+ concat('||', other_command)
17
+ end
18
+
19
+ def pipe(other_command)
20
+ concat('|', other_command)
21
+ end
22
+
23
+ private
24
+
25
+ def append_concat(command)
26
+ extra_options[:concat].if_present(command) do |v|
27
+ "#{command} #{v.operator} #{v.command.command}"
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRubyUtils
4
+ module Envs
5
+ class Command
6
+ module Envvars
7
+ def envvar(name, value)
8
+ duplicate_by_extra_options(envvars: envvars.merge(name => value))
9
+ end
10
+
11
+ private
12
+
13
+ def append_envvars(command)
14
+ e = envvars.map { |k, v| "#{Shellwords.escape(k)}=#{Shellwords.escape(v)}" }.join(' ')
15
+ e.present? ? "#{e} #{command}" : command
16
+ end
17
+
18
+ def envvars
19
+ extra_options[:envvars] ||= {}.with_indifferent_access
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -12,39 +12,18 @@ module EacRubyUtils
12
12
  duplicate_by_extra_options(chdir: dir)
13
13
  end
14
14
 
15
- def envvar(name, value)
16
- duplicate_by_extra_options(envvars: envvars.merge(name => value))
17
- end
18
-
19
15
  def status_result(status_code, result)
20
16
  duplicate_by_extra_options(status_results: status_results.merge(status_code => result))
21
17
  end
22
18
 
23
- def pipe(other_command)
24
- duplicate_by_extra_options(pipe: other_command)
25
- end
26
-
27
19
  private
28
20
 
29
21
  attr_reader :extra_options
30
22
 
31
- def envvars
32
- extra_options[:envvars] ||= {}.with_indifferent_access
33
- end
34
-
35
23
  def status_results
36
24
  extra_options[:status_results] ||= {}.with_indifferent_access
37
25
  end
38
26
 
39
- def append_envvars(command)
40
- e = envvars.map { |k, v| "#{Shellwords.escape(k)}=#{Shellwords.escape(v)}" }.join(' ')
41
- e.present? ? "#{e} #{command}" : command
42
- end
43
-
44
- def append_pipe(command)
45
- extra_options[:pipe].present? ? "#{command} | #{extra_options[:pipe].command}" : command
46
- end
47
-
48
27
  def append_chdir(command)
49
28
  extra_options[:chdir].present? ? "(cd '#{extra_options[:chdir]}' ; #{command} )" : command
50
29
  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,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/string/inflections'
4
+ require 'eac_ruby_utils/templates/searcher'
5
+
6
+ class Module
7
+ def template
8
+ @template ||= ::EacRubyUtils::Templates::Searcher.default.template(name.underscore)
9
+ end
10
+ end
@@ -1,15 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/core_ext/string/inflections'
4
- require 'eac_ruby_utils/templates/searcher'
3
+ require 'eac_ruby_utils/patches/module/template'
5
4
 
6
5
  class Object
7
- class << self
8
- def template
9
- @template ||= ::EacRubyUtils::Templates::Searcher.default.template(name.underscore)
10
- end
11
- end
12
-
13
6
  def template
14
7
  self.class.template
15
8
  end
@@ -3,7 +3,7 @@
3
3
  require 'pathname'
4
4
 
5
5
  class Pathname
6
- def basename_sub
7
- parent.join(yield(basename))
6
+ def basename_sub(suffix = '')
7
+ parent.join(yield(basename(suffix)))
8
8
  end
9
9
  end
@@ -1,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support/hash_with_indifferent_access'
4
+ require 'active_support/core_ext/module/delegation'
4
5
  require 'active_support/core_ext/object/blank'
5
6
 
6
7
  module EacRubyUtils
7
8
  class Struct
8
9
  def initialize(initial_data = {})
9
- self.data = ::ActiveSupport::HashWithIndifferentAccess.new(initial_data)
10
+ self.data = initial_data.symbolize_keys
10
11
  end
11
12
 
12
13
  def [](key)
@@ -19,6 +20,11 @@ module EacRubyUtils
19
20
  bool ? fetch(key).present? : data.fetch(key)
20
21
  end
21
22
 
23
+ def merge(other)
24
+ other = self.class.new(other) unless other.is_a?(self.class)
25
+ self.class.new(to_h.merge(other.to_h))
26
+ end
27
+
22
28
  def method_missing(method_name, *arguments, &block)
23
29
  property_method?(method_name) ? fetch(method_name) : super
24
30
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.51.1'
4
+ VERSION = '0.57.0'
5
5
  end
@@ -1,22 +1,31 @@
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))
14
15
  end
15
16
 
17
+ def dump_file(path, object)
18
+ ::File.write(path.to_s, dump(object))
19
+ end
20
+
16
21
  def load(string)
17
22
  ::YAML.safe_load(string, permitted_classes)
18
23
  end
19
24
 
25
+ def load_file(path)
26
+ load(::File.read(path.to_s))
27
+ end
28
+
20
29
  def permitted_classes
21
30
  DEFAULT_PERMITTED_CLASSES
22
31
  end
@@ -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