ehbrs-tools 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- 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/runner/google.rb +19 -0
- data/lib/ehbrs/runner/google/translate.rb +92 -0
- data/lib/ehbrs/tools/version.rb +1 -1
- 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/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/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/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/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/temp/temp_spec.rb +1 -1
- 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/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 +26 -1
@@ -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
|
@@ -27,6 +27,7 @@ RSpec.describe ::EacRubyUtils::CommonConstructor do
|
|
27
27
|
it "attribute \"#{attr}\" equal to \"#{expected_value}\"" do
|
28
28
|
expect(subject.send(attr)).to eq(expected_value)
|
29
29
|
end
|
30
|
+
|
30
31
|
[false, true].each do |include_all|
|
31
32
|
it "respond_to?('#{attr}', #{include_all}) == #{include_all}" do
|
32
33
|
expect(subject.respond_to?("#{attr}=", include_all)).to eq(include_all)
|
@@ -66,7 +66,7 @@ RSpec.describe ::EacRubyUtils::Console::DocoptRunner do
|
|
66
66
|
|
67
67
|
let(:instance) { RunnerWithSubcommands.new }
|
68
68
|
|
69
|
-
|
69
|
+
describe '#subcommands?' do
|
70
70
|
it 'returns true' do
|
71
71
|
expect(instance.subcommands?).to eq(true)
|
72
72
|
end
|
@@ -85,19 +85,19 @@ RSpec.describe ::EacRubyUtils::Console::DocoptRunner do
|
|
85
85
|
it { expect(instance.target_doc).to include('Subcommands:') }
|
86
86
|
end
|
87
87
|
|
88
|
-
|
88
|
+
describe '#subcommand' do
|
89
89
|
it 'is of subcommand class' do
|
90
90
|
expect(instance.subcommand).to be_a(RunnerWithSubcommands::MySubCommand)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
|
94
|
+
describe '#context' do
|
95
95
|
it 'accesses instance methods by subcommand' do
|
96
96
|
expect(instance.subcommand.context(:parent_arg)).to eq('value0')
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
|
100
|
+
describe '#run' do
|
101
101
|
it 'calls subcommand' do
|
102
102
|
instance.run
|
103
103
|
expect(instance.subarg_value).to eq('value1')
|
@@ -109,7 +109,7 @@ RSpec.describe ::EacRubyUtils::Console::DocoptRunner do
|
|
109
109
|
context 'when subcommand is invalid' do
|
110
110
|
let(:instance) { RunnerWithSubcommands.new(argv: %w[value0 invalid-subcommand]) }
|
111
111
|
|
112
|
-
|
112
|
+
describe '#run' do
|
113
113
|
it 'raises Docopt::Exit' do
|
114
114
|
expect { instance.run }.to raise_error(::Docopt::Exit)
|
115
115
|
end
|
@@ -9,7 +9,7 @@ RSpec.describe ::EacRubyUtils::Console::Speaker do
|
|
9
9
|
r
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
describe '#request_input' do
|
13
13
|
it 'recover value from hash list' do
|
14
14
|
allow(instance).to receive(:request_string).and_return('opt1')
|
15
15
|
list = { opt1: 'value1', opt2: 'value2' }
|
@@ -5,6 +5,7 @@ require 'eac_ruby_utils/envs/local_env'
|
|
5
5
|
|
6
6
|
RSpec.describe ::EacRubyUtils::Envs::Executable do
|
7
7
|
let(:env) { ::EacRubyUtils::Envs::LocalEnv.new }
|
8
|
+
|
8
9
|
context 'when program exist' do
|
9
10
|
let(:instance) { described_class.new(env, 'cat', '--version') }
|
10
11
|
|
@@ -18,12 +19,15 @@ RSpec.describe ::EacRubyUtils::Envs::Executable do
|
|
18
19
|
let(:instance) { described_class.new(env, 'this_cannot_exist', '--version') }
|
19
20
|
|
20
21
|
it { expect(instance.exist?).to eq(false) }
|
22
|
+
|
21
23
|
it {
|
22
24
|
expect { instance.validate! }.to raise_error(
|
23
25
|
described_class.const_get('ProgramNotFoundError')
|
24
26
|
)
|
25
27
|
}
|
28
|
+
|
26
29
|
it { expect(instance.validate).to be_present }
|
30
|
+
|
27
31
|
it {
|
28
32
|
expect { instance.command }.to raise_error(
|
29
33
|
described_class.const_get('ProgramNotFoundError')
|
@@ -11,6 +11,8 @@ class Stub
|
|
11
11
|
lists.add_integer :code, 7 => :a, 13 => :b
|
12
12
|
lists.add_string :cadeia, :a, :b, :c
|
13
13
|
lists.add_string :type, 'Namespace::ClazzA' => :a, 'Namespace::ClazzB' => :b
|
14
|
+
lists.add_symbol :simbolo, :a, :b, :c
|
15
|
+
lists.add_symbol :tipado, :tipo_aaa => :a, 'tipo_bbb' => :b
|
14
16
|
end
|
15
17
|
|
16
18
|
RSpec.describe ::EacRubyUtils::Listable do
|
@@ -19,6 +21,8 @@ RSpec.describe ::EacRubyUtils::Listable do
|
|
19
21
|
it { expect(Stub.lists.code.values).to eq([7, 13]) }
|
20
22
|
it { expect(Stub.lists.cadeia.values).to eq(%w[a b c]) }
|
21
23
|
it { expect(Stub.lists.type.values).to eq(%w[Namespace::ClazzA Namespace::ClazzB]) }
|
24
|
+
it { expect(Stub.lists.simbolo.values).to eq(%i[a b c]) }
|
25
|
+
it { expect(Stub.lists.tipado.values).to eq(%i[tipo_aaa tipo_bbb]) }
|
22
26
|
end
|
23
27
|
|
24
28
|
context 'value instance options' do
|
@@ -26,18 +30,31 @@ RSpec.describe ::EacRubyUtils::Listable do
|
|
26
30
|
expect(Stub.lists.inteiro.options)
|
27
31
|
.to eq([['Inteiro A', 1], ['Inteiro BB', 2], ['Inteiro CCC', 3]])
|
28
32
|
}
|
33
|
+
|
29
34
|
it {
|
30
35
|
expect(Stub.lists.code.options)
|
31
36
|
.to eq([['Código A', 7], ['Código B', 13]])
|
32
37
|
}
|
38
|
+
|
33
39
|
it {
|
34
40
|
expect(Stub.lists.cadeia.options)
|
35
41
|
.to eq([['Cadeia AAA', 'a'], ['Cadeia BB', 'b'], ['Cadeia C', 'c']])
|
36
42
|
}
|
43
|
+
|
37
44
|
it {
|
38
45
|
expect(Stub.lists.type.options)
|
39
46
|
.to eq([['Tipo A', 'Namespace::ClazzA'], ['Tipo B', 'Namespace::ClazzB']])
|
40
47
|
}
|
48
|
+
|
49
|
+
it {
|
50
|
+
expect(Stub.lists.simbolo.options)
|
51
|
+
.to eq([['Simbolo A', :a], ['Simbolo B', :b], ['Simbolo C', :c]])
|
52
|
+
}
|
53
|
+
|
54
|
+
it {
|
55
|
+
expect(Stub.lists.tipado.options)
|
56
|
+
.to eq([['Tipado A', :tipo_aaa], ['Tipado B', :tipo_bbb]])
|
57
|
+
}
|
41
58
|
end
|
42
59
|
|
43
60
|
context 'constants' do
|
@@ -50,6 +67,11 @@ RSpec.describe ::EacRubyUtils::Listable do
|
|
50
67
|
it { expect(Stub::CADEIA_C).to eq('c') }
|
51
68
|
it { expect(Stub::TYPE_A).to eq('Namespace::ClazzA') }
|
52
69
|
it { expect(Stub::TYPE_B).to eq('Namespace::ClazzB') }
|
70
|
+
it { expect(Stub::SIMBOLO_A).to eq(:a) }
|
71
|
+
it { expect(Stub::SIMBOLO_B).to eq(:b) }
|
72
|
+
it { expect(Stub::SIMBOLO_C).to eq(:c) }
|
73
|
+
it { expect(Stub::TIPADO_A).to eq(:tipo_aaa) }
|
74
|
+
it { expect(Stub::TIPADO_B).to eq(:tipo_bbb) }
|
53
75
|
end
|
54
76
|
|
55
77
|
context 'values instances' do
|
@@ -110,60 +132,70 @@ RSpec.describe ::EacRubyUtils::Listable do
|
|
110
132
|
|
111
133
|
context 'when inteiro value is A' do
|
112
134
|
before { instance.inteiro = Stub::INTEIRO_A }
|
135
|
+
|
113
136
|
it { expect(instance.inteiro_label).to eq('Inteiro A') }
|
114
137
|
it { expect(instance.inteiro_description).to eq('Inteiro A Descr.') }
|
115
138
|
end
|
116
139
|
|
117
140
|
context 'when inteiro value is A' do
|
118
141
|
before { instance.inteiro = Stub::INTEIRO_B }
|
142
|
+
|
119
143
|
it { expect(instance.inteiro_label).to eq('Inteiro BB') }
|
120
144
|
it { expect(instance.inteiro_description).to eq('Inteiro BB Descr.') }
|
121
145
|
end
|
122
146
|
|
123
147
|
context 'when inteiro value is C' do
|
124
148
|
before { instance.inteiro = Stub::INTEIRO_C }
|
149
|
+
|
125
150
|
it { expect(instance.inteiro_label).to eq('Inteiro CCC') }
|
126
151
|
it { expect(instance.inteiro_description).to eq('Inteiro CCC Descr.') }
|
127
152
|
end
|
128
153
|
|
129
154
|
context 'when code value is A' do
|
130
155
|
before { instance.code = Stub::CODE_A }
|
156
|
+
|
131
157
|
it { expect(instance.code_label).to eq('Código A') }
|
132
158
|
it { expect(instance.code_description).to eq('Código A Descr.') }
|
133
159
|
end
|
134
160
|
|
135
161
|
context 'when code value is B' do
|
136
162
|
before { instance.code = Stub::CODE_B }
|
163
|
+
|
137
164
|
it { expect(instance.code_label).to eq('Código B') }
|
138
165
|
it { expect(instance.code_description).to eq('Código B Descr.') }
|
139
166
|
end
|
140
167
|
|
141
168
|
context 'when cadeia value is A' do
|
142
169
|
before { instance.cadeia = Stub::CADEIA_A }
|
170
|
+
|
143
171
|
it { expect(instance.cadeia_label).to eq('Cadeia AAA') }
|
144
172
|
it { expect(instance.cadeia_description).to eq('Cadeia AAA Descr.') }
|
145
173
|
end
|
146
174
|
|
147
175
|
context 'when cadeia value is B' do
|
148
176
|
before { instance.cadeia = Stub::CADEIA_B }
|
177
|
+
|
149
178
|
it { expect(instance.cadeia_label).to eq('Cadeia BB') }
|
150
179
|
it { expect(instance.cadeia_description).to eq('Cadeia BB Descr.') }
|
151
180
|
end
|
152
181
|
|
153
182
|
context 'when cadeia value is C' do
|
154
183
|
before { instance.cadeia = Stub::CADEIA_C }
|
184
|
+
|
155
185
|
it { expect(instance.cadeia_label).to eq('Cadeia C') }
|
156
186
|
it { expect(instance.cadeia_description).to eq('Cadeia C Descr.') }
|
157
187
|
end
|
158
188
|
|
159
189
|
context 'when type value is A' do
|
160
190
|
before { instance.type = Stub::TYPE_A }
|
191
|
+
|
161
192
|
it { expect(instance.type_label).to eq('Tipo A') }
|
162
193
|
it { expect(instance.type_description).to eq('Tipo A Descr.') }
|
163
194
|
end
|
164
195
|
|
165
196
|
context 'when type value is B' do
|
166
197
|
before { instance.type = Stub::TYPE_B }
|
198
|
+
|
167
199
|
it { expect(instance.type_label).to eq('Tipo B') }
|
168
200
|
it { expect(instance.type_description).to eq('Tipo B Descr.') }
|
169
201
|
end
|
@@ -5,7 +5,7 @@ require 'eac_ruby_utils/patches/hash/sym_keys_hash'
|
|
5
5
|
RSpec.describe ::Hash do
|
6
6
|
let(:a_hash) { { 'a' => 'a_value', 1 => '1_value', s: 's_value' } }
|
7
7
|
|
8
|
-
|
8
|
+
describe '#to_sym_keys_hash' do
|
9
9
|
it 'converts all keys to symbols' do
|
10
10
|
expect(a_hash.to_sym_keys_hash).to eq(a: 'a_value', '1': '1_value', s: 's_value')
|
11
11
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'eac_ruby_utils/patches/object/if_present'
|
4
4
|
|
5
5
|
RSpec.describe ::Object do
|
6
|
-
|
6
|
+
describe '#if_present' do
|
7
7
|
it { expect(nil.if_present).to eq(nil) }
|
8
8
|
it { expect(nil.if_present('default')) .to eq('default') }
|
9
9
|
it { expect(nil.if_present('default') { |_v| 'calculated' }).to eq('default') }
|