ehbrs-tools 0.6.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ehbrs/executables.rb +7 -1
- data/lib/ehbrs/fs.rb +9 -0
- data/lib/ehbrs/fs/compressed_package.rb +48 -0
- data/lib/ehbrs/gems.rb +37 -0
- data/lib/ehbrs/google.rb +9 -0
- data/lib/ehbrs/google/translate.rb +11 -0
- data/lib/ehbrs/google/translate/session.rb +61 -0
- data/lib/ehbrs/observers.rb +11 -0
- data/lib/ehbrs/observers/base.rb +64 -0
- data/lib/ehbrs/observers/with_persistence.rb +34 -0
- data/lib/ehbrs/runner/fs.rb +19 -0
- data/lib/ehbrs/runner/fs/used_space.rb +161 -0
- data/lib/ehbrs/runner/google.rb +19 -0
- data/lib/ehbrs/runner/google/translate.rb +92 -0
- data/lib/ehbrs/runner/self.rb +19 -0
- data/lib/ehbrs/runner/self/test.rb +30 -0
- data/lib/ehbrs/runner/videos/extract.rb +71 -0
- data/lib/ehbrs/runner/videos/series.rb +21 -0
- data/lib/ehbrs/runner/videos/series/rename.rb +75 -0
- data/lib/ehbrs/self.rb +9 -0
- data/lib/ehbrs/self/observers/used_space.rb +22 -0
- data/lib/ehbrs/self/observers/with_persistence.rb +38 -0
- data/lib/ehbrs/tools/version.rb +1 -1
- data/lib/ehbrs/user_dirs.rb +34 -0
- data/lib/ehbrs/vg/wii/game_file.rb +13 -0
- data/lib/ehbrs/videos/extract.rb +11 -0
- data/lib/ehbrs/videos/extract/package.rb +75 -0
- data/lib/ehbrs/videos/extract/package_file.rb +54 -0
- data/lib/ehbrs/videos/series.rb +11 -0
- data/lib/ehbrs/videos/series/rename.rb +13 -0
- data/lib/ehbrs/videos/series/rename/directory_group.rb +28 -0
- data/lib/ehbrs/videos/series/rename/file.rb +114 -0
- data/lib/ehbrs/videos/series/rename/file/basename_parser.rb +44 -0
- data/lib/ehbrs/videos/series/rename/file/options.rb +30 -0
- data/lib/ehbrs/videos/series/rename/line_result.rb +26 -0
- data/lib/ehbrs/videos/series/rename/line_result_group.rb +39 -0
- data/lib/ehbrs/videos/series/rename/results_builder.rb +32 -0
- data/lib/ehbrs/videos/series/rename/season_group.rb +39 -0
- data/vendor/aranha-selenium/Gemfile +5 -0
- data/vendor/aranha-selenium/aranha-selenium.gemspec +19 -0
- data/vendor/aranha-selenium/lib/aranha/selenium.rb +8 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory.rb +47 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/base.rb +76 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/chrome.rb +28 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/firefox.rb +54 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/firefox_auto_download_mime_types +685 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/session.rb +78 -0
- data/vendor/aranha-selenium/lib/aranha/selenium/version.rb +7 -0
- data/vendor/aranha-selenium/spec/rubocop_check_spec.rb +7 -0
- data/vendor/aranha-selenium/spec/spec_helper.rb +100 -0
- data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +68 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs.rb +4 -12
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb +2 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/extname.rb +30 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/temp.rb +27 -8
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/temp/directory.rb +16 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/temp/file.rb +34 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/lists.rb +10 -12
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/symbol_list.rb +19 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerable.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerable/boolean_combinations.rb +45 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/common_concern.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/patch.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/require_sub.rb +2 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_present.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/if_match.rb +16 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/default_time_zone_set.rb +5 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/local_time_zone.rb +25 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash.rb +1 -3
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +45 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +85 -2
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_concern_spec.rb +42 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_constructor_spec.rb +1 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/console/docopt_runner_spec.rb +5 -5
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/console/speaker_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb +4 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/extname_spec.rb +18 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp/temp_spec.rb +12 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/{temp.rb → temp_spec.rb} +22 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb +32 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/options_consumer_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerable/boolean_combinations_spec.rb +39 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/hash/sym_keys_hash_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/template_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/basename_sub_spec.rb +4 -4
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub_spec.rb +19 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub_spec/stubbed_module_a.rb +6 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub_spec/stubbed_not_module.rb +6 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/yaml_spec.rb +75 -0
- data/vendor/eac_ruby_utils/spec/locales/pt-BR.yml +17 -0
- metadata +105 -3
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
require 'tempfile'
|
5
|
+
|
6
|
+
module EacRubyUtils
|
7
|
+
module Fs
|
8
|
+
module Temp
|
9
|
+
class File < Pathname
|
10
|
+
# Temporary file
|
11
|
+
def initialize(*tempfile_args)
|
12
|
+
file = Tempfile.new(*tempfile_args)
|
13
|
+
path = file.path
|
14
|
+
file.close
|
15
|
+
file.unlink
|
16
|
+
super(path)
|
17
|
+
end
|
18
|
+
|
19
|
+
def remove
|
20
|
+
if directory?
|
21
|
+
rmtree
|
22
|
+
elsif file?
|
23
|
+
unlink
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def remove!
|
28
|
+
remove
|
29
|
+
raise "Tried to remove \"#{self}\", but it yet exists" if exist?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -4,6 +4,7 @@ require 'active_support/hash_with_indifferent_access'
|
|
4
4
|
require 'active_support/core_ext/string/inflections'
|
5
5
|
require_relative 'integer_list'
|
6
6
|
require_relative 'string_list'
|
7
|
+
require_relative 'symbol_list'
|
7
8
|
|
8
9
|
module EacRubyUtils
|
9
10
|
module Listable
|
@@ -14,18 +15,10 @@ module EacRubyUtils
|
|
14
15
|
@source = source
|
15
16
|
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
)
|
22
|
-
end
|
23
|
-
|
24
|
-
def add_string(item, *labels)
|
25
|
-
check_acts_as_listable_new_item(item)
|
26
|
-
acts_as_listable_items[item] = ::EacRubyUtils::Listable::StringList.new(
|
27
|
-
self, item, labels
|
28
|
-
)
|
18
|
+
%w[integer string symbol].each do |list_type|
|
19
|
+
define_method "add_#{list_type}" do |item, *labels|
|
20
|
+
add(::EacRubyUtils::Listable.const_get("#{list_type}_list".camelize), item, labels)
|
21
|
+
end
|
29
22
|
end
|
30
23
|
|
31
24
|
def method_missing(name, *args, &block)
|
@@ -43,6 +36,11 @@ module EacRubyUtils
|
|
43
36
|
|
44
37
|
private
|
45
38
|
|
39
|
+
def add(list_class, item, labels)
|
40
|
+
check_acts_as_listable_new_item(item)
|
41
|
+
acts_as_listable_items[item] = list_class.new(self, item, labels)
|
42
|
+
end
|
43
|
+
|
46
44
|
def check_acts_as_listable_new_item(item)
|
47
45
|
return unless acts_as_listable_items.key?(item)
|
48
46
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'list'
|
4
|
+
|
5
|
+
module EacRubyUtils
|
6
|
+
module Listable
|
7
|
+
class SymbolList < ::EacRubyUtils::Listable::List
|
8
|
+
protected
|
9
|
+
|
10
|
+
def parse_labels(labels)
|
11
|
+
if labels.first.is_a?(Hash)
|
12
|
+
Hash[labels.first.map { |k, v| [k.to_sym, v.to_sym] }]
|
13
|
+
else
|
14
|
+
Hash[labels.map { |v| [v.to_sym, v.to_sym] }]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Enumerable
|
4
|
+
# Produces a array with values's all combinations.
|
5
|
+
#
|
6
|
+
# Example:
|
7
|
+
# %i[a b].boolean_combinations
|
8
|
+
# => [[], [:a], [:b], [:a, :b]]
|
9
|
+
#
|
10
|
+
# @return [Array]
|
11
|
+
def bool_array_combs
|
12
|
+
bool_combs([], method(:bool_array_combs_new_comb))
|
13
|
+
end
|
14
|
+
|
15
|
+
# Produces a hash with values's all combinations.
|
16
|
+
#
|
17
|
+
# Example:
|
18
|
+
# %i[a b].boolean_combinations
|
19
|
+
# => [{a: false, b: false}, {a: false, b: true}, {a: true, b: false}, {a: true, b: true}]
|
20
|
+
#
|
21
|
+
# @return [Hash]
|
22
|
+
def bool_hash_combs
|
23
|
+
bool_combs({}, method(:bool_hash_combs_new_comb))
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def bool_combs(empty_value, new_comb_method)
|
29
|
+
head = [empty_value]
|
30
|
+
r = inject(head) do |a, value|
|
31
|
+
new_comb_method.call(value, a)
|
32
|
+
end
|
33
|
+
r == head ? [] : r
|
34
|
+
end
|
35
|
+
|
36
|
+
def bool_array_combs_new_comb(value, combs)
|
37
|
+
combs + combs.map { |c| c + [value] }
|
38
|
+
end
|
39
|
+
|
40
|
+
def bool_hash_combs_new_comb(value, combs)
|
41
|
+
combs.flat_map do |comb|
|
42
|
+
[false, true].map { |bool_value| comb.dup.merge(value => bool_value) }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -5,7 +5,7 @@ require 'active_support/core_ext/object/blank'
|
|
5
5
|
class Object
|
6
6
|
# @return +block.call(self)+ if +self+ is present, +default_value+ otherwise.
|
7
7
|
def if_present(default_value = nil)
|
8
|
-
return default_value
|
8
|
+
return default_value if blank?
|
9
9
|
|
10
10
|
block_given? ? yield(self) : self
|
11
11
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Regexp
|
4
|
+
# If +self+ matches +string+ returns +block.call(Match result) or only Match result if block is
|
5
|
+
# not provided.
|
6
|
+
# If +self+ does not match +string+ raises a +ArgumentError+ if +required+ is truthy or return
|
7
|
+
# +nil+ otherwise.
|
8
|
+
def if_match(string, required = true, &block)
|
9
|
+
m = match(string)
|
10
|
+
if m
|
11
|
+
block ? block.call(m) : m
|
12
|
+
elsif required
|
13
|
+
raise(::ArgumentError, "Pattern \"#{self}\" does not match string \"#{string}\"")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/time/zones'
|
4
|
+
require 'eac_ruby_utils/envs'
|
5
|
+
|
6
|
+
class Time
|
7
|
+
class << self
|
8
|
+
TIMEDATECTL_TIMEZONE_LINE_PATTERN = %r{\s*Time zone:\s*(\S+/\S+)\s}.freeze
|
9
|
+
|
10
|
+
def local_time_zone
|
11
|
+
local_time_zone_by_timedatectl || local_time_zone_by_offset
|
12
|
+
end
|
13
|
+
|
14
|
+
def local_time_zone_by_timedatectl
|
15
|
+
executable = ::EacRubyUtils::Envs.local.executable('timedatectl', '--version')
|
16
|
+
return nil unless executable.exist?
|
17
|
+
|
18
|
+
TIMEDATECTL_TIMEZONE_LINE_PATTERN.if_match(executable.command.execute!) { |m| m[1] }
|
19
|
+
end
|
20
|
+
|
21
|
+
def local_time_zone_by_offset
|
22
|
+
::ActiveSupport::TimeZone[::Time.now.getlocal.gmt_offset].name
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -2,9 +2,52 @@
|
|
2
2
|
|
3
3
|
module EacRubyUtils
|
4
4
|
class << self
|
5
|
-
def require_sub(file)
|
5
|
+
def require_sub(file, options = {})
|
6
|
+
::EacRubyUtils::RequireSub.new(file, options).apply
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class RequireSub
|
11
|
+
BASE_OPTION_KEY = :base
|
12
|
+
INCLUDE_MODULES_OPTION_KEY = :include_modules
|
13
|
+
REQUIRE_DEPENDENCY_OPTION_KEY = :require_dependency
|
14
|
+
|
15
|
+
attr_reader :file, :options
|
16
|
+
|
17
|
+
def initialize(file, options = {})
|
18
|
+
@file = file
|
19
|
+
@options = options
|
20
|
+
end
|
21
|
+
|
22
|
+
def apply
|
23
|
+
require_sub_files
|
24
|
+
include_modules
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def include_modules
|
30
|
+
return unless options[INCLUDE_MODULES_OPTION_KEY]
|
31
|
+
|
32
|
+
base.constants.each do |constant_name|
|
33
|
+
constant = base.const_get(constant_name)
|
34
|
+
next unless constant.is_a?(::Module) && !constant.is_a?(::Class)
|
35
|
+
|
36
|
+
base.include(constant)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def base
|
41
|
+
options[BASE_OPTION_KEY] || raise('Option :base not setted')
|
42
|
+
end
|
43
|
+
|
44
|
+
def require_sub_files
|
6
45
|
Dir["#{File.dirname(file)}/#{::File.basename(file, '.*')}/*.rb"].sort.each do |path|
|
7
|
-
|
46
|
+
if options[REQUIRE_DEPENDENCY_OPTION_KEY]
|
47
|
+
require_dependency path
|
48
|
+
else
|
49
|
+
require path
|
50
|
+
end
|
8
51
|
end
|
9
52
|
end
|
10
53
|
end
|
@@ -3,10 +3,93 @@
|
|
3
3
|
require 'yaml'
|
4
4
|
|
5
5
|
module EacRubyUtils
|
6
|
+
# A safe YAML loader/dumper with common types included.
|
6
7
|
class Yaml
|
7
8
|
class << self
|
8
|
-
|
9
|
-
|
9
|
+
DEFAULT_PERMITTED_CLASSES = [::Array, ::Date, ::FalseClass, ::Hash, ::NilClass, ::Numeric,
|
10
|
+
::String, ::Symbol, ::Time, ::TrueClass].freeze
|
11
|
+
|
12
|
+
def dump(object)
|
13
|
+
::YAML.dump(sanitize(object))
|
14
|
+
end
|
15
|
+
|
16
|
+
def load(string)
|
17
|
+
::YAML.safe_load(string, permitted_classes)
|
18
|
+
end
|
19
|
+
|
20
|
+
def permitted_classes
|
21
|
+
DEFAULT_PERMITTED_CLASSES
|
22
|
+
end
|
23
|
+
|
24
|
+
def sanitize(object)
|
25
|
+
Sanitizer.new(object).result
|
26
|
+
end
|
27
|
+
|
28
|
+
def yaml?(object)
|
29
|
+
return false unless object.is_a?(::String)
|
30
|
+
return false unless object.start_with?('---')
|
31
|
+
|
32
|
+
load(object)
|
33
|
+
true
|
34
|
+
rescue ::Psych::SyntaxError
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
38
|
+
class Sanitizer
|
39
|
+
attr_reader :source
|
40
|
+
|
41
|
+
RESULT_TYPES = %w[permitted enumerableable hashable].freeze
|
42
|
+
|
43
|
+
def initialize(source)
|
44
|
+
@source = source
|
45
|
+
end
|
46
|
+
|
47
|
+
def result
|
48
|
+
RESULT_TYPES.each do |type|
|
49
|
+
return send("result_#{type}") if send("result_#{type}?")
|
50
|
+
end
|
51
|
+
|
52
|
+
source.to_s
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def result_enumerableable?
|
58
|
+
source.respond_to?(:to_a) && !source.is_a?(::Hash)
|
59
|
+
end
|
60
|
+
|
61
|
+
def result_enumerableable
|
62
|
+
source.to_a.map { |child| sanitize_value(child) }
|
63
|
+
end
|
64
|
+
|
65
|
+
def result_hashable?
|
66
|
+
source.respond_to?(:to_h)
|
67
|
+
end
|
68
|
+
|
69
|
+
def result_hashable
|
70
|
+
source.to_h.map { |k, v| [k.to_sym, sanitize_value(v)] }.to_h
|
71
|
+
end
|
72
|
+
|
73
|
+
def result_nil?
|
74
|
+
source.nil?
|
75
|
+
end
|
76
|
+
|
77
|
+
def result_nil
|
78
|
+
nil
|
79
|
+
end
|
80
|
+
|
81
|
+
def result_permitted?
|
82
|
+
(::EacRubyUtils::Yaml.permitted_classes - [::Array, ::Hash])
|
83
|
+
.any? { |klass| source.is_a?(klass) }
|
84
|
+
end
|
85
|
+
|
86
|
+
def result_permitted
|
87
|
+
source
|
88
|
+
end
|
89
|
+
|
90
|
+
def sanitize_value(value)
|
91
|
+
self.class.new(value).result
|
92
|
+
end
|
10
93
|
end
|
11
94
|
end
|
12
95
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/common_concern'
|
4
|
+
|
5
|
+
RSpec.describe ::EacRubyUtils::CommonConcern do
|
6
|
+
let(:instance) do
|
7
|
+
described_class.new do
|
8
|
+
self.valor = 'changed'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module MyModule
|
13
|
+
module ClassMethods
|
14
|
+
def my_class_method
|
15
|
+
'class'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module InstanceMethods
|
20
|
+
def my_instance_method
|
21
|
+
'instance'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class MyClass
|
27
|
+
class << self
|
28
|
+
attr_accessor :valor
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
let(:subject) { MyClass.new }
|
33
|
+
|
34
|
+
before do
|
35
|
+
instance.setup(MyModule)
|
36
|
+
MyClass.include MyModule
|
37
|
+
end
|
38
|
+
|
39
|
+
it { expect(subject.my_instance_method).to eq('instance') }
|
40
|
+
it { expect(subject.class.my_class_method).to eq('class') }
|
41
|
+
it { expect(subject.class.valor).to eq('changed') }
|
42
|
+
end
|