avm-tools 0.116.1 → 0.117.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/launcher/instances/settings.rb +7 -3
- data/lib/avm/projects/stereotypes.rb +2 -2
- data/lib/avm/ruby/bundler/incompatible_parser/depends_on.rb +1 -1
- data/lib/avm/ruby/bundler/incompatible_parser/gem_conflict.rb +1 -1
- data/lib/avm/ruby/bundler/incompatible_parser/in_gemfile.rb +1 -3
- data/lib/avm/ruby/bundler/incompatible_parser/version_requirement.rb +1 -1
- data/lib/avm/ruby/bundler/incompatible_parser.rb +1 -1
- data/lib/avm/tools/runner/app_src/ruby/bundler/gemfile_lock/git.rb +1 -1
- data/lib/avm/tools/runner/app_src/test.rb +2 -2
- data/lib/avm/tools/runner/app_src/version_bump.rb +4 -9
- data/lib/avm/tools/runner/git/deploy.rb +4 -4
- data/lib/avm/tools/runner/git/dirty_files.rb +1 -1
- data/lib/avm/tools/runner/git/revisions_test.rb +1 -1
- data/lib/avm/tools/runner/ruby/rubocop.rb +2 -2
- data/lib/avm/tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +3 -3
- data/sub/avm/lib/avm/instances/base/auto_values/mailer.rb +2 -2
- data/sub/avm/lib/avm/registry/base.rb +2 -2
- data/sub/avm/lib/avm/rspec/shared_examples/not_in_avm_registry.rb +1 -1
- data/sub/avm/lib/avm/scms/base.rb +13 -0
- data/sub/avm/lib/avm/sources/base/configuration.rb +2 -1
- data/sub/avm/lib/avm/sources/base/parent.rb +31 -0
- data/sub/avm/lib/avm/sources/base.rb +4 -6
- data/sub/avm/lib/avm/sources/configuration/{_locale.rb → locale.rb} +5 -3
- data/sub/avm/lib/avm/sources/configuration/rubocop.rb +26 -0
- data/sub/avm/lib/avm/sources/configuration/tests.rb +29 -0
- data/sub/avm/lib/avm/sources/configuration.rb +5 -1
- data/sub/avm/lib/avm/sources/tests/builder.rb +1 -1
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm-eac_generic_base0/avm-eac_generic_base0.gemspec +1 -1
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/sources/base/version_bump.rb +35 -0
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/sources/base.rb +4 -1
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/version.rb +1 -1
- data/sub/avm-eac_generic_base0/locale/en.yaml +6 -0
- data/sub/avm-eac_generic_base0/locale/pt-BR.yaml +6 -0
- data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +1 -1
- data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
- data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.sh +1 -1
- data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +1 -1
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/core_update.rb +3 -3
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb +17 -2
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/Dockerfile.template +2 -8
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/Dockerfile_apache_setup +8 -0
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/start.sh.template +1 -1
- data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile/add_or_replace_gem_line.rb +56 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile/dependency.rb +19 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile.rb +34 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler.rb +11 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/configured.rb +31 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/envvar.rb +17 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb +41 -0
- data/{lib/avm/ruby → sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1}/rubocop.rb +2 -2
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/version_bump.rb +23 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base.rb +11 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tester.rb +1 -1
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb +1 -1
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update.rb +0 -1
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
- data/sub/avm-files/avm-files.gemspec +1 -1
- data/sub/avm-files/lib/avm/files/appendable.rb +1 -1
- data/sub/avm-files/lib/avm/files/formatter/formats/ruby.rb +2 -2
- data/sub/avm-files/lib/avm/files/version.rb +1 -1
- data/sub/avm-git/lib/avm/git/scms/git_subrepo.rb +1 -3
- data/sub/avm-git/lib/avm/git/version.rb +1 -1
- data/sub/eac_cli/eac_cli.gemspec +2 -2
- data/sub/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/old_configs/read_entry_options.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/parser.rb +2 -2
- data/sub/eac_cli/lib/eac_cli/runner/after_class_methods.rb +9 -22
- data/sub/eac_cli/lib/eac_cli/runner/class_runner.rb +50 -0
- data/sub/eac_cli/lib/eac_cli/runner/instance_methods.rb +0 -9
- data/sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/runner_with/help.rb +1 -1
- data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +4 -4
- data/sub/eac_cli/lib/eac_cli/runner_with_set.rb +2 -2
- data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +23 -17
- data/sub/eac_config/eac_config.gemspec +1 -1
- data/sub/eac_config/lib/eac_config/entry.rb +1 -1
- data/sub/eac_config/lib/eac_config/envvars_node/entry.rb +1 -1
- data/sub/eac_config/lib/eac_config/paths_hash/node.rb +1 -1
- data/sub/eac_config/lib/eac_config/version.rb +1 -1
- data/sub/eac_fs/eac_fs.gemspec +1 -1
- data/sub/eac_fs/lib/eac_fs/version.rb +1 -1
- data/sub/eac_git/eac_git.gemspec +1 -1
- data/sub/eac_git/lib/eac_git/local/remote.rb +2 -2
- data/sub/eac_git/lib/eac_git/local.rb +1 -1
- data/sub/eac_git/lib/eac_git/version.rb +1 -1
- data/sub/eac_rest/eac_rest.gemspec +1 -1
- data/sub/eac_rest/lib/eac_rest/api.rb +14 -3
- data/sub/eac_rest/lib/eac_rest/request.rb +22 -1
- data/sub/eac_rest/lib/eac_rest/response.rb +41 -1
- data/sub/eac_rest/lib/eac_rest/version.rb +1 -1
- data/sub/eac_ruby_base0/eac_ruby_base0.gemspec +3 -3
- data/sub/eac_ruby_base0/lib/eac_ruby_base0/application.rb +2 -2
- data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/sub/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +1 -1
- data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +2 -2
- data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
- data/sub/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb +2 -2
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/core_ext.rb +1 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/custom_format.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/gems_registry/gem.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +16 -4
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb +12 -2
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales/from_all_gems.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales/from_gem.rb +47 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales/module_i18n_translate.rb +74 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb +35 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/i18n_translate.rb +2 -25
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/method_class.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb +6 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +86 -33
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_clean_environment.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp/{temp_spec.rb → directory_spec.rb} +0 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb +4 -4
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb +169 -106
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/method_class_spec.rb +46 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/options_consumer_spec.rb +52 -17
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/listable_spec.rb +5 -3
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/method_class_spec.rb +20 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/simple_cache_spec.rb +5 -3
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub_spec.rb +3 -3
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +21 -18
- data/sub/eac_ruby_utils/spec/locales/pt-BR.yml +3 -0
- data/sub/eac_templates/eac_templates.gemspec +1 -1
- data/sub/eac_templates/lib/eac_templates/directory.rb +1 -1
- data/sub/eac_templates/lib/eac_templates/version.rb +1 -1
- metadata +45 -18
- data/lib/avm/projects/stereotypes/rails_application/update.rb +0 -14
- data/lib/avm/projects/stereotypes/ruby_gem/version_bump.rb +0 -60
- data/lib/avm/ruby/rubocop/_configured.rb +0 -29
- data/lib/avm/ruby/rubocop/_envvar.rb +0 -15
- data/lib/avm/ruby/rubocop/_gemfile.rb +0 -39
- data/sub/avm/lib/avm/sources/configuration/_rubocop.rb +0 -24
- data/sub/avm/lib/avm/sources/configuration/_tests.rb +0 -27
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/patches/i18n.rb +0 -7
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/patches.rb +0 -4
@@ -2,199 +2,262 @@
|
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/listable'
|
4
4
|
|
5
|
-
class Stub
|
6
|
-
include ::EacRubyUtils::Listable
|
7
|
-
|
8
|
-
attr_accessor :inteiro, :code, :cadeia, :type
|
9
|
-
|
10
|
-
lists.add_integer :inteiro, :a, :b, :c
|
11
|
-
lists.add_integer :code, 7 => :a, 13 => :b
|
12
|
-
lists.add_string :cadeia, :a, :b, :c
|
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
|
16
|
-
end
|
17
|
-
|
18
5
|
RSpec.describe ::EacRubyUtils::Listable do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
6
|
+
let(:stub_class) do
|
7
|
+
the_described_class = described_class
|
8
|
+
::Class.new do
|
9
|
+
class << self
|
10
|
+
def name
|
11
|
+
'Stub'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
include the_described_class
|
16
|
+
|
17
|
+
attr_accessor :inteiro, :code, :cadeia, :type
|
18
|
+
|
19
|
+
lists.add_integer :inteiro, :a, :b, :c
|
20
|
+
lists.add_integer :code, 7 => :a, 13 => :b
|
21
|
+
lists.add_string :cadeia, :a, :b, :c
|
22
|
+
lists.add_string :type, 'Namespace::ClazzA' => :a, 'Namespace::ClazzB' => :b
|
23
|
+
lists.add_symbol :simbolo, :a, :b, :c
|
24
|
+
lists.add_symbol :tipado, :tipo_aaa => :a, 'tipo_bbb' => :b
|
25
|
+
end
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
describe 'attribute values' do
|
29
|
+
it { expect(stub_class.lists.inteiro.values).to eq([1, 2, 3]) }
|
30
|
+
it { expect(stub_class.lists.code.values).to eq([7, 13]) }
|
31
|
+
it { expect(stub_class.lists.cadeia.values).to eq(%w[a b c]) }
|
32
|
+
it { expect(stub_class.lists.type.values).to eq(%w[Namespace::ClazzA Namespace::ClazzB]) }
|
33
|
+
it { expect(stub_class.lists.simbolo.values).to eq(%i[a b c]) }
|
34
|
+
it { expect(stub_class.lists.tipado.values).to eq(%i[tipo_aaa tipo_bbb]) }
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'value instance options' do
|
29
38
|
it {
|
30
|
-
expect(
|
39
|
+
expect(stub_class.lists.inteiro.options)
|
31
40
|
.to eq([['Inteiro A', 1], ['Inteiro BB', 2], ['Inteiro CCC', 3]])
|
32
41
|
}
|
33
42
|
|
34
43
|
it {
|
35
|
-
expect(
|
44
|
+
expect(stub_class.lists.code.options)
|
36
45
|
.to eq([['Código A', 7], ['Código B', 13]])
|
37
46
|
}
|
38
47
|
|
39
48
|
it {
|
40
|
-
expect(
|
49
|
+
expect(stub_class.lists.cadeia.options)
|
41
50
|
.to eq([['Cadeia AAA', 'a'], ['Cadeia BB', 'b'], ['Cadeia C', 'c']])
|
42
51
|
}
|
43
52
|
|
44
53
|
it {
|
45
|
-
expect(
|
54
|
+
expect(stub_class.lists.type.options)
|
46
55
|
.to eq([['Tipo A', 'Namespace::ClazzA'], ['Tipo B', 'Namespace::ClazzB']])
|
47
56
|
}
|
48
57
|
|
49
58
|
it {
|
50
|
-
expect(
|
59
|
+
expect(stub_class.lists.simbolo.options)
|
51
60
|
.to eq([['Simbolo A', :a], ['Simbolo B', :b], ['Simbolo C', :c]])
|
52
61
|
}
|
53
62
|
|
54
63
|
it {
|
55
|
-
expect(
|
64
|
+
expect(stub_class.lists.tipado.options)
|
56
65
|
.to eq([['Tipado A', :tipo_aaa], ['Tipado B', :tipo_bbb]])
|
57
66
|
}
|
58
67
|
end
|
59
68
|
|
60
|
-
|
61
|
-
it { expect(
|
62
|
-
it { expect(
|
63
|
-
it { expect(
|
64
|
-
it { expect(
|
65
|
-
it { expect(
|
66
|
-
it { expect(
|
67
|
-
it { expect(
|
68
|
-
it { expect(
|
69
|
-
it { expect(
|
70
|
-
it { expect(
|
71
|
-
it { expect(
|
72
|
-
it { expect(
|
73
|
-
it { expect(
|
74
|
-
it { expect(
|
69
|
+
describe 'constants' do
|
70
|
+
it { expect(stub_class::INTEIRO_A).to eq(1) }
|
71
|
+
it { expect(stub_class::INTEIRO_B).to eq(2) }
|
72
|
+
it { expect(stub_class::INTEIRO_C).to eq(3) }
|
73
|
+
it { expect(stub_class::CODE_A).to eq(7) }
|
74
|
+
it { expect(stub_class::CODE_B).to eq(13) }
|
75
|
+
it { expect(stub_class::CADEIA_A).to eq('a') }
|
76
|
+
it { expect(stub_class::CADEIA_C).to eq('c') }
|
77
|
+
it { expect(stub_class::TYPE_A).to eq('Namespace::ClazzA') }
|
78
|
+
it { expect(stub_class::TYPE_B).to eq('Namespace::ClazzB') }
|
79
|
+
it { expect(stub_class::SIMBOLO_A).to eq(:a) }
|
80
|
+
it { expect(stub_class::SIMBOLO_B).to eq(:b) }
|
81
|
+
it { expect(stub_class::SIMBOLO_C).to eq(:c) }
|
82
|
+
it { expect(stub_class::TIPADO_A).to eq(:tipo_aaa) }
|
83
|
+
it { expect(stub_class::TIPADO_B).to eq(:tipo_bbb) }
|
75
84
|
end
|
76
85
|
|
77
|
-
|
78
|
-
it { expect(
|
79
|
-
|
80
|
-
it {
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
it {
|
86
|
-
|
87
|
-
|
88
|
-
|
86
|
+
describe 'values instances' do
|
87
|
+
it { expect(stub_class.lists.is_a?(::EacRubyUtils::Listable::Lists)).to eq(true) }
|
88
|
+
|
89
|
+
it {
|
90
|
+
expect(stub_class.lists.inteiro.value_a.is_a?(::EacRubyUtils::Listable::Value))
|
91
|
+
.to eq(true)
|
92
|
+
}
|
93
|
+
|
94
|
+
it {
|
95
|
+
expect(stub_class.lists.inteiro.value_b.is_a?(::EacRubyUtils::Listable::Value))
|
96
|
+
.to eq(true)
|
97
|
+
}
|
98
|
+
|
99
|
+
it {
|
100
|
+
expect(stub_class.lists.inteiro.value_c.is_a?(::EacRubyUtils::Listable::Value))
|
101
|
+
.to eq(true)
|
102
|
+
}
|
103
|
+
|
104
|
+
it {
|
105
|
+
expect(stub_class.lists.code.value_a.is_a?(::EacRubyUtils::Listable::Value))
|
106
|
+
.to eq(true)
|
107
|
+
}
|
108
|
+
|
109
|
+
it {
|
110
|
+
expect(stub_class.lists.code.value_b.is_a?(::EacRubyUtils::Listable::Value))
|
111
|
+
.to eq(true)
|
112
|
+
}
|
113
|
+
|
114
|
+
it {
|
115
|
+
expect(stub_class.lists.cadeia.value_a.is_a?(::EacRubyUtils::Listable::Value))
|
116
|
+
.to eq(true)
|
117
|
+
}
|
118
|
+
|
119
|
+
it {
|
120
|
+
expect(stub_class.lists.cadeia.value_b.is_a?(::EacRubyUtils::Listable::Value))
|
121
|
+
.to eq(true)
|
122
|
+
}
|
123
|
+
|
124
|
+
it {
|
125
|
+
expect(stub_class.lists.cadeia.value_c.is_a?(::EacRubyUtils::Listable::Value))
|
126
|
+
.to eq(true)
|
127
|
+
}
|
128
|
+
|
129
|
+
it {
|
130
|
+
expect(stub_class.lists.type.value_a.is_a?(::EacRubyUtils::Listable::Value))
|
131
|
+
.to eq(true)
|
132
|
+
}
|
133
|
+
|
134
|
+
it {
|
135
|
+
expect(stub_class.lists.type.value_b.is_a?(::EacRubyUtils::Listable::Value))
|
136
|
+
.to eq(true)
|
137
|
+
}
|
89
138
|
end
|
90
139
|
|
91
|
-
|
92
|
-
it { expect(
|
93
|
-
it { expect(
|
94
|
-
it { expect(
|
95
|
-
it { expect(
|
96
|
-
it { expect(
|
97
|
-
it { expect(
|
98
|
-
it { expect(
|
99
|
-
it { expect(
|
100
|
-
it { expect(
|
101
|
-
it { expect(
|
140
|
+
describe 'value instance label' do
|
141
|
+
it { expect(stub_class.lists.inteiro.value_a.label).to eq('Inteiro A') }
|
142
|
+
it { expect(stub_class.lists.inteiro.value_b.label).to eq('Inteiro BB') }
|
143
|
+
it { expect(stub_class.lists.inteiro.value_c.label).to eq('Inteiro CCC') }
|
144
|
+
it { expect(stub_class.lists.code.value_a.label).to eq('Código A') }
|
145
|
+
it { expect(stub_class.lists.code.value_b.label).to eq('Código B') }
|
146
|
+
it { expect(stub_class.lists.cadeia.value_a.label).to eq('Cadeia AAA') }
|
147
|
+
it { expect(stub_class.lists.cadeia.value_b.label).to eq('Cadeia BB') }
|
148
|
+
it { expect(stub_class.lists.cadeia.value_c.label).to eq('Cadeia C') }
|
149
|
+
it { expect(stub_class.lists.type.value_a.label).to eq('Tipo A') }
|
150
|
+
it { expect(stub_class.lists.type.value_b.label).to eq('Tipo B') }
|
102
151
|
end
|
103
152
|
|
104
|
-
|
105
|
-
it { expect(
|
106
|
-
it { expect(
|
107
|
-
it { expect(
|
108
|
-
it { expect(
|
109
|
-
it { expect(
|
110
|
-
it { expect(
|
111
|
-
it { expect(
|
112
|
-
it { expect(
|
113
|
-
it { expect(
|
114
|
-
it { expect(
|
153
|
+
describe 'value instance description' do
|
154
|
+
it { expect(stub_class.lists.inteiro.value_a.description).to eq('Inteiro A Descr.') }
|
155
|
+
it { expect(stub_class.lists.inteiro.value_b.description).to eq('Inteiro BB Descr.') }
|
156
|
+
it { expect(stub_class.lists.inteiro.value_c.description).to eq('Inteiro CCC Descr.') }
|
157
|
+
it { expect(stub_class.lists.code.value_a.description).to eq('Código A Descr.') }
|
158
|
+
it { expect(stub_class.lists.code.value_b.description).to eq('Código B Descr.') }
|
159
|
+
it { expect(stub_class.lists.cadeia.value_a.description).to eq('Cadeia AAA Descr.') }
|
160
|
+
it { expect(stub_class.lists.cadeia.value_b.description).to eq('Cadeia BB Descr.') }
|
161
|
+
it { expect(stub_class.lists.cadeia.value_c.description).to eq('Cadeia C Descr.') }
|
162
|
+
it { expect(stub_class.lists.type.value_a.description).to eq('Tipo A Descr.') }
|
163
|
+
it { expect(stub_class.lists.type.value_b.description).to eq('Tipo B Descr.') }
|
115
164
|
end
|
116
165
|
|
117
|
-
|
118
|
-
it { expect(
|
119
|
-
it { expect(
|
120
|
-
it { expect(
|
121
|
-
it { expect(
|
122
|
-
it { expect(
|
123
|
-
it { expect(
|
124
|
-
it { expect(
|
125
|
-
it { expect(
|
126
|
-
it { expect(
|
127
|
-
it { expect(
|
166
|
+
describe 'value instance constant name' do
|
167
|
+
it { expect(stub_class.lists.inteiro.value_a.constant_name).to eq('INTEIRO_A') }
|
168
|
+
it { expect(stub_class.lists.inteiro.value_b.constant_name).to eq('INTEIRO_B') }
|
169
|
+
it { expect(stub_class.lists.inteiro.value_c.constant_name).to eq('INTEIRO_C') }
|
170
|
+
it { expect(stub_class.lists.code.value_a.constant_name).to eq('CODE_A') }
|
171
|
+
it { expect(stub_class.lists.code.value_b.constant_name).to eq('CODE_B') }
|
172
|
+
it { expect(stub_class.lists.cadeia.value_a.constant_name).to eq('CADEIA_A') }
|
173
|
+
it { expect(stub_class.lists.cadeia.value_b.constant_name).to eq('CADEIA_B') }
|
174
|
+
it { expect(stub_class.lists.cadeia.value_c.constant_name).to eq('CADEIA_C') }
|
175
|
+
it { expect(stub_class.lists.type.value_a.constant_name).to eq('TYPE_A') }
|
176
|
+
it { expect(stub_class.lists.type.value_b.constant_name).to eq('TYPE_B') }
|
128
177
|
end
|
129
178
|
|
130
|
-
|
131
|
-
let(:instance) {
|
179
|
+
describe 'instance label and descriptions' do
|
180
|
+
let(:instance) { stub_class.new }
|
132
181
|
|
133
182
|
context 'when inteiro value is A' do
|
134
|
-
before { instance.inteiro =
|
183
|
+
before { instance.inteiro = stub_class::INTEIRO_A }
|
135
184
|
|
136
185
|
it { expect(instance.inteiro_label).to eq('Inteiro A') }
|
137
186
|
it { expect(instance.inteiro_description).to eq('Inteiro A Descr.') }
|
138
187
|
end
|
139
188
|
|
140
|
-
context 'when inteiro value is
|
141
|
-
before { instance.inteiro =
|
189
|
+
context 'when inteiro value is B' do
|
190
|
+
before { instance.inteiro = stub_class::INTEIRO_B }
|
142
191
|
|
143
192
|
it { expect(instance.inteiro_label).to eq('Inteiro BB') }
|
144
193
|
it { expect(instance.inteiro_description).to eq('Inteiro BB Descr.') }
|
145
194
|
end
|
146
195
|
|
147
196
|
context 'when inteiro value is C' do
|
148
|
-
before { instance.inteiro =
|
197
|
+
before { instance.inteiro = stub_class::INTEIRO_C }
|
149
198
|
|
150
199
|
it { expect(instance.inteiro_label).to eq('Inteiro CCC') }
|
151
200
|
it { expect(instance.inteiro_description).to eq('Inteiro CCC Descr.') }
|
152
201
|
end
|
153
202
|
|
203
|
+
context 'when inteiro value is blank' do
|
204
|
+
before { instance.inteiro = nil }
|
205
|
+
|
206
|
+
it { expect(instance.inteiro_label).to eq('Inteiro em branco') }
|
207
|
+
it { expect(instance.inteiro_description).to eq('Inteiro em branco Descr.') }
|
208
|
+
end
|
209
|
+
|
154
210
|
context 'when code value is A' do
|
155
|
-
before { instance.code =
|
211
|
+
before { instance.code = stub_class::CODE_A }
|
156
212
|
|
157
213
|
it { expect(instance.code_label).to eq('Código A') }
|
158
214
|
it { expect(instance.code_description).to eq('Código A Descr.') }
|
159
215
|
end
|
160
216
|
|
161
217
|
context 'when code value is B' do
|
162
|
-
before { instance.code =
|
218
|
+
before { instance.code = stub_class::CODE_B }
|
163
219
|
|
164
220
|
it { expect(instance.code_label).to eq('Código B') }
|
165
221
|
it { expect(instance.code_description).to eq('Código B Descr.') }
|
166
222
|
end
|
167
223
|
|
224
|
+
context 'when code value is blank' do
|
225
|
+
before { instance.code = nil }
|
226
|
+
|
227
|
+
it { expect(instance.code_label).to eq('') }
|
228
|
+
it { expect(instance.code_description).to eq('') }
|
229
|
+
end
|
230
|
+
|
168
231
|
context 'when cadeia value is A' do
|
169
|
-
before { instance.cadeia =
|
232
|
+
before { instance.cadeia = stub_class::CADEIA_A }
|
170
233
|
|
171
234
|
it { expect(instance.cadeia_label).to eq('Cadeia AAA') }
|
172
235
|
it { expect(instance.cadeia_description).to eq('Cadeia AAA Descr.') }
|
173
236
|
end
|
174
237
|
|
175
238
|
context 'when cadeia value is B' do
|
176
|
-
before { instance.cadeia =
|
239
|
+
before { instance.cadeia = stub_class::CADEIA_B }
|
177
240
|
|
178
241
|
it { expect(instance.cadeia_label).to eq('Cadeia BB') }
|
179
242
|
it { expect(instance.cadeia_description).to eq('Cadeia BB Descr.') }
|
180
243
|
end
|
181
244
|
|
182
245
|
context 'when cadeia value is C' do
|
183
|
-
before { instance.cadeia =
|
246
|
+
before { instance.cadeia = stub_class::CADEIA_C }
|
184
247
|
|
185
248
|
it { expect(instance.cadeia_label).to eq('Cadeia C') }
|
186
249
|
it { expect(instance.cadeia_description).to eq('Cadeia C Descr.') }
|
187
250
|
end
|
188
251
|
|
189
252
|
context 'when type value is A' do
|
190
|
-
before { instance.type =
|
253
|
+
before { instance.type = stub_class::TYPE_A }
|
191
254
|
|
192
255
|
it { expect(instance.type_label).to eq('Tipo A') }
|
193
256
|
it { expect(instance.type_description).to eq('Tipo A Descr.') }
|
194
257
|
end
|
195
258
|
|
196
259
|
context 'when type value is B' do
|
197
|
-
before { instance.type =
|
260
|
+
before { instance.type = stub_class::TYPE_B }
|
198
261
|
|
199
262
|
it { expect(instance.type_label).to eq('Tipo B') }
|
200
263
|
it { expect(instance.type_description).to eq('Tipo B Descr.') }
|
@@ -202,11 +265,11 @@ RSpec.describe ::EacRubyUtils::Listable do
|
|
202
265
|
end
|
203
266
|
|
204
267
|
describe '#value_validate!' do
|
205
|
-
it { expect {
|
206
|
-
it { expect {
|
207
|
-
it { expect {
|
208
|
-
it { expect {
|
209
|
-
it { expect {
|
210
|
-
it { expect {
|
268
|
+
it { expect { stub_class.lists.inteiro.value_validate!(1) }.not_to raise_error }
|
269
|
+
it { expect { stub_class.lists.inteiro.value_validate!('1') }.to raise_error(::StandardError) }
|
270
|
+
it { expect { stub_class.lists.inteiro.value_validate!(10) }.to raise_error(::StandardError) }
|
271
|
+
it { expect { stub_class.lists.cadeia.value_validate!(:a) }.to raise_error(::StandardError) }
|
272
|
+
it { expect { stub_class.lists.cadeia.value_validate!('a') }.not_to raise_error }
|
273
|
+
it { expect { stub_class.lists.cadeia.value_validate!(:z) }.to raise_error(::StandardError) }
|
211
274
|
end
|
212
275
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/method_class'
|
4
|
+
|
5
|
+
::RSpec.describe ::EacRubyUtils::MethodClass do
|
6
|
+
let(:sender_class) do
|
7
|
+
::Class.new do
|
8
|
+
attr_accessor :sender_value
|
9
|
+
|
10
|
+
def initialize(sender_value)
|
11
|
+
self.sender_value = sender_value
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:method_class) do
|
17
|
+
the_described_class = described_class
|
18
|
+
::Class.new do
|
19
|
+
def self.name
|
20
|
+
'TheSender::PerformX'
|
21
|
+
end
|
22
|
+
|
23
|
+
include the_described_class
|
24
|
+
attr_accessor :sender, :method_param
|
25
|
+
|
26
|
+
def initialize(sender, method_param)
|
27
|
+
self.sender = sender
|
28
|
+
self.method_param = method_param
|
29
|
+
end
|
30
|
+
|
31
|
+
def result
|
32
|
+
"#{sender.sender_value},#{method_param}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
let(:sender_instance) { sender_class.new('AAA') }
|
38
|
+
|
39
|
+
before do
|
40
|
+
::Object.const_set('TheSender', sender_class)
|
41
|
+
sender_class.const_set('PerformX', method_class)
|
42
|
+
end
|
43
|
+
|
44
|
+
it { expect(sender_instance).to respond_to(:perform_x) }
|
45
|
+
it { expect(sender_instance.perform_x('BBB')).to eq('AAA,BBB') }
|
46
|
+
end
|
@@ -3,9 +3,13 @@
|
|
3
3
|
require 'eac_ruby_utils/options_consumer'
|
4
4
|
|
5
5
|
RSpec.describe ::EacRubyUtils::OptionsConsumer do
|
6
|
-
context 'instance created with some data' do
|
6
|
+
context 'with instance created with some data' do
|
7
7
|
subject(:instance) { described_class.new(a: 'a_value', b: 'b_value', c: 'c_value') }
|
8
8
|
|
9
|
+
let(:consumed_a) { instance.consume(:a) }
|
10
|
+
let(:consumed_b) { instance.consume(:b) }
|
11
|
+
let(:consumed_c) { instance.consume(:c) }
|
12
|
+
|
9
13
|
it 'left data should be Hash' do
|
10
14
|
expect(instance.left_data).to be_a(::Hash)
|
11
15
|
end
|
@@ -14,16 +18,48 @@ RSpec.describe ::EacRubyUtils::OptionsConsumer do
|
|
14
18
|
expect { instance.validate }.to raise_error(::StandardError)
|
15
19
|
end
|
16
20
|
|
17
|
-
|
18
|
-
|
21
|
+
context 'when no data is consumed' do
|
22
|
+
it do
|
23
|
+
expect(instance.left_data).to eq({ a: 'a_value', b: 'b_value', c: 'c_value' }
|
19
24
|
.with_indifferent_access)
|
20
|
-
|
21
|
-
|
22
|
-
expect(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
end
|
26
|
+
|
27
|
+
it { expect(consumed_a).to eq('a_value') }
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'when A value is consumed' do
|
31
|
+
before { consumed_a }
|
32
|
+
|
33
|
+
it do
|
34
|
+
expect(instance.left_data).to eq({ b: 'b_value', c: 'c_value' }.with_indifferent_access)
|
35
|
+
end
|
36
|
+
|
37
|
+
it { expect(instance.consume(:c)).to eq('c_value') }
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'when A and C values are consumed' do
|
41
|
+
before do
|
42
|
+
consumed_a
|
43
|
+
consumed_c
|
44
|
+
end
|
45
|
+
|
46
|
+
it { expect(instance.left_data).to eq({ b: 'b_value' }.with_indifferent_access) }
|
47
|
+
|
48
|
+
it { expect(consumed_b).to eq('b_value') }
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when all values are consumed' do
|
52
|
+
before do
|
53
|
+
consumed_a
|
54
|
+
consumed_b
|
55
|
+
consumed_c
|
56
|
+
end
|
57
|
+
|
58
|
+
it { expect(instance.left_data).to eq({}.with_indifferent_access) }
|
59
|
+
|
60
|
+
it do
|
61
|
+
expect { instance.validate }.not_to raise_error
|
62
|
+
end
|
27
63
|
end
|
28
64
|
|
29
65
|
it 'raises if validate has left data' do
|
@@ -34,12 +70,11 @@ RSpec.describe ::EacRubyUtils::OptionsConsumer do
|
|
34
70
|
describe '#consume_all' do
|
35
71
|
subject(:instance) { described_class.new(a: 'a_value', b: 'b_value', c: 'c_value') }
|
36
72
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
73
|
+
let(:all_consumed) { instance.consume_all(:a, :b, :c, :d) }
|
74
|
+
|
75
|
+
it { expect(all_consumed[0]).to eq('a_value') }
|
76
|
+
it { expect(all_consumed[1]).to eq('b_value') }
|
77
|
+
it { expect(all_consumed[2]).to eq('c_value') }
|
78
|
+
it { expect(all_consumed[3]).to eq(nil) }
|
44
79
|
end
|
45
80
|
end
|
@@ -3,11 +3,13 @@
|
|
3
3
|
require 'eac_ruby_utils/patches/module/listable'
|
4
4
|
|
5
5
|
RSpec.describe ::Module do
|
6
|
-
|
7
|
-
|
6
|
+
let(:stub_class) do
|
7
|
+
::Class.new do
|
8
|
+
enable_listable
|
9
|
+
end
|
8
10
|
end
|
9
11
|
|
10
12
|
describe '#enable_listable' do
|
11
|
-
it { expect(
|
13
|
+
it { expect(stub_class.included_modules).to include(::EacRubyUtils::Listable) }
|
12
14
|
end
|
13
15
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/method_class'
|
4
|
+
require 'eac_ruby_utils/patches/module/method_class'
|
5
|
+
|
6
|
+
RSpec.describe ::Class do
|
7
|
+
let(:stub_method_class) do
|
8
|
+
described_class.new do
|
9
|
+
def self.name
|
10
|
+
'StubMethodClass'
|
11
|
+
end
|
12
|
+
|
13
|
+
enable_method_class
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#enable_simple_cache' do
|
18
|
+
it { expect(stub_method_class.included_modules).to include(::EacRubyUtils::MethodClass) }
|
19
|
+
end
|
20
|
+
end
|
@@ -3,11 +3,13 @@
|
|
3
3
|
require 'eac_ruby_utils/patches/module/simple_cache'
|
4
4
|
|
5
5
|
RSpec.describe ::Module do
|
6
|
-
|
7
|
-
|
6
|
+
let(:stub_class) do
|
7
|
+
::Class.new do
|
8
|
+
enable_simple_cache
|
9
|
+
end
|
8
10
|
end
|
9
11
|
|
10
12
|
describe '#enable_simple_cache' do
|
11
|
-
it { expect(
|
13
|
+
it { expect(stub_class.included_modules).to include(::EacRubyUtils::SimpleCache) }
|
12
14
|
end
|
13
15
|
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/require_sub'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
end
|
5
|
+
class RequireSubStubClass
|
6
|
+
end
|
8
7
|
|
8
|
+
RSpec.describe ::EacRubyUtils::RequireSub do
|
9
9
|
let(:instance) { described_class.new(__FILE__, base: RequireSubStubClass, include_modules: true) }
|
10
10
|
|
11
11
|
before do
|
@@ -3,26 +3,29 @@
|
|
3
3
|
require 'eac_ruby_utils/settings_provider'
|
4
4
|
|
5
5
|
RSpec.describe ::EacRubyUtils::SettingsProvider do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
6
|
+
let(:stub_class) do
|
7
|
+
the_described_class = described_class
|
8
|
+
r = ::Class.new do
|
9
|
+
include the_described_class
|
10
|
+
|
11
|
+
def key_a
|
12
|
+
'method_a'
|
13
|
+
end
|
14
|
+
|
15
|
+
def key_b
|
16
|
+
'method_b'
|
17
|
+
end
|
18
|
+
|
19
|
+
def settings
|
20
|
+
{ 'key_b' => 'setting_b', key_c: 'setting_c' }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
r.const_set(:KEY_A, 'constant_a')
|
24
|
+
r.const_set(:KEY_D, 'constant_d')
|
25
|
+
r
|
23
26
|
end
|
24
27
|
|
25
|
-
let(:stub) {
|
28
|
+
let(:stub) { stub_class.new }
|
26
29
|
|
27
30
|
describe '#setting_value' do
|
28
31
|
{
|