roqua-support 0.4.2 → 0.4.5

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/lib/roqua/core_ext/enumerable/sort_by_alphanum.rb +2 -0
  4. data/lib/roqua/probes/base_probe.rb +3 -0
  5. data/lib/roqua/support/errors.rb +1 -1
  6. data/lib/roqua-support/version.rb +1 -1
  7. data/roqua-support.gemspec +1 -1
  8. metadata +4 -72
  9. data/.gitignore +0 -20
  10. data/.gitlab-ci.yml +0 -32
  11. data/.rspec +0 -1
  12. data/.rubocop.yml +0 -2
  13. data/.travis.yml +0 -6
  14. data/Appraisals +0 -15
  15. data/Gemfile +0 -21
  16. data/Gemfile.lock +0 -213
  17. data/Guardfile +0 -8
  18. data/circle.yml +0 -13
  19. data/gemfiles/rails52.gemfile +0 -24
  20. data/gemfiles/rails60.gemfile +0 -23
  21. data/gemfiles/rails61.gemfile +0 -23
  22. data/spec/internal/config/balancer_state +0 -1
  23. data/spec/internal/config/routes.rb +0 -3
  24. data/spec/roqua/core_ext/active_interaction/date_time_as_unix_extension_spec.rb +0 -51
  25. data/spec/roqua/core_ext/active_interaction/duration_filter_spec.rb +0 -90
  26. data/spec/roqua/core_ext/active_interaction/rails_intrumentation_spec.rb +0 -20
  27. data/spec/roqua/core_ext/activerecord/uniq_find_or_create_spec.rb +0 -77
  28. data/spec/roqua/core_ext/delayed_job/activity_monitoring_spec.rb +0 -75
  29. data/spec/roqua/core_ext/enumerable/sort_by_alphanum_spec.rb +0 -28
  30. data/spec/roqua/core_ext/fabrication/singleton_spec.rb +0 -23
  31. data/spec/roqua/logging/roqua_logging_railtie_spec.rb +0 -48
  32. data/spec/roqua/probes/delayed_job_probe_spec.rb +0 -56
  33. data/spec/roqua/probes/monitoring_probe_spec.rb +0 -69
  34. data/spec/roqua/responders/active_interaction_aware_responder_spec.rb +0 -54
  35. data/spec/roqua/responders/api_errors_responder_spec.rb +0 -34
  36. data/spec/roqua/scheduling/scheduler_spec.rb +0 -114
  37. data/spec/roqua/status_checks/check_db_connection_spec.rb +0 -12
  38. data/spec/roqua/status_checks/check_load_balancer_member_spec.rb +0 -22
  39. data/spec/roqua/status_checks/status_controller_spec.rb +0 -63
  40. data/spec/roqua/support/errors_spec.rb +0 -169
  41. data/spec/roqua/support/helpers_spec.rb +0 -50
  42. data/spec/roqua/support/logwrapper_spec.rb +0 -69
  43. data/spec/roqua/support/request_logger_spec.rb +0 -148
  44. data/spec/roqua/support/stats_spec.rb +0 -18
  45. data/spec/roqua/support_spec.rb +0 -19
  46. data/spec/roqua/type/stripped_string_spec.rb +0 -34
  47. data/spec/roqua/validators/subset_validator_spec.rb +0 -39
  48. data/spec/spec_helper.rb +0 -39
  49. data/styleguide/ruby/rubocop.yml +0 -219
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'roqua/type/stripped_string'
5
-
6
- RSpec.describe Roqua::Type::StrippedString do
7
- let(:cls) do
8
- Class.new(ActiveRecord::Base) do
9
- self.table_name = 'delayed_jobs'
10
-
11
- attribute :locked_by, Roqua::Type::StrippedString.new
12
- attribute :queue, Roqua::Type::StrippedString.new(allow_empty: true)
13
- end
14
- end
15
-
16
- it "strips whitespace from outside and not inside" do
17
- expect(described_class.new.cast(" some name \n \t \u180E\u200B\u200C\u200D\u2060\uFEFF ")).to eq "some name"
18
- end
19
-
20
- it "nils empty values by default" do
21
- expect(described_class.new.cast(" \n \t ")).to eq nil
22
- end
23
-
24
- it "keeps value empty if allow_empty is true" do
25
- expect(described_class.new(allow_empty: true).cast(" \n \t ")).to eq ""
26
- end
27
-
28
- it "works on active_record" do
29
- instance = cls.new(locked_by: " \n \t ", queue: " \n \t ", cron: " \n \t ")
30
- expect(instance.locked_by).to be_nil
31
- expect(instance.queue).to eq ""
32
- expect(instance.cron).to eq " \n \t "
33
- end
34
- end
@@ -1,39 +0,0 @@
1
- require 'spec_helper'
2
- require 'roqua/validators/subset_validator'
3
-
4
- describe SubsetValidator do
5
- let(:validatable) do
6
- Class.new do
7
- include ActiveModel::Validations
8
-
9
- attr_accessor :list
10
-
11
- validates :list, subset: {of: [1, 2, 3]}
12
-
13
- def initialize(list)
14
- self.list = list
15
- end
16
- end
17
- end
18
-
19
- it 'allows nil values' do
20
- expect(validatable.new(nil)).to be_valid
21
- end
22
-
23
- it 'allows empty arrays' do
24
- expect(validatable.new([])).to be_valid
25
- end
26
-
27
- it 'allows a subset' do
28
- expect(validatable.new([1])).to be_valid
29
- expect(validatable.new([1, 2])).to be_valid
30
- end
31
-
32
- it 'allows exact match to set' do
33
- expect(validatable.new([1, 2, 3])).to be_valid
34
- end
35
-
36
- it 'does not allow an element not in the set' do
37
- expect(validatable.new([1, 2, 100])).not_to be_valid
38
- end
39
- end
data/spec/spec_helper.rb DELETED
@@ -1,39 +0,0 @@
1
- ENV['RAILS_ENV'] = 'test'
2
-
3
- require 'rubygems'
4
- require 'bundler/setup'
5
-
6
- require 'combustion'
7
-
8
- Combustion.initialize! :action_controller
9
-
10
- require 'appsignal'
11
- require 'rspec/rails'
12
-
13
- require 'delayed_job_active_record'
14
-
15
- Delayed::Worker.logger = Logger.new(Tempfile.new('roqua-support-delayed-job.log'))
16
-
17
- ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'
18
- ActiveRecord::Base.logger = Delayed::Worker.logger
19
- ActiveRecord::Migration.verbose = false
20
-
21
- ActiveRecord::Schema.define do
22
- create_table :delayed_jobs, force: true do |t|
23
- t.integer :priority, default: 0
24
- t.integer :attempts, default: 0
25
- t.text :handler
26
- t.text :last_error
27
- t.datetime :run_at
28
- t.datetime :locked_at
29
- t.datetime :failed_at
30
- t.string :locked_by
31
- t.string :queue
32
- t.string :cron
33
- t.timestamps null: false
34
- end
35
-
36
- add_index :delayed_jobs, [:priority, :run_at], name: 'delayed_jobs_priority'
37
-
38
- Roqua::Scheduling::CronJobTable.create_cron_jobs_table(self)
39
- end
@@ -1,219 +0,0 @@
1
- # We can't start the shared Rubocop file with .rubocop because of a bug in combination with inherit_gem.
2
- # For more details:
3
- # https://github.com/bbatsov/rubocop/issues/4154
4
-
5
- AllCops:
6
- TargetRubyVersion: 2.3
7
- Exclude:
8
- - 'bin/**/*'
9
- - 'config/**/*'
10
- - 'db/schema.rb'
11
- - 'db/seeds/**/*'
12
- - 'local/*'
13
- - 'node_modules/**/*'
14
- - 'script/**/*'
15
- - 'tmp/**/*'
16
- - 'vendor/**/*'
17
-
18
- # ==================================== SECURITY ===========================================================================
19
-
20
- # Never ever use `Kernel#eval`. This however is handy in Guardfile.
21
- Security/Eval:
22
- Enabled: true
23
- Exclude:
24
- - '**/Guardfile'
25
-
26
- # ==================================== LINT ===========================================================================
27
-
28
- # Explicit block alignment
29
- Lint/BlockAlignment:
30
- Enabled: true
31
- Exclude:
32
- - 'spec/**/*'
33
-
34
- # Useless assignments are just useless. In specs however they lead to a better
35
- # understanding of what is being stubbed/factoried.
36
- Lint/UselessAssignment:
37
- Enabled: true
38
- Exclude:
39
- - 'spec/**/*'
40
-
41
- Lint/AmbiguousBlockAssociation:
42
- Enabled: true
43
- Exclude:
44
- - 'spec/**/*'
45
-
46
- # ==================================== METRICS ========================================================================
47
-
48
- # Set this to 10, forcing future methods to be not that complex. Skipping some
49
- # existing helper methods that are better off to be not refactored.
50
- # Note: used comments like
51
- # # rubocop:disable CyclomaticComplexity
52
- # [code]
53
- # # rubocop:enable CyclomaticComplexity
54
- # to skip this check
55
- Metrics/CyclomaticComplexity:
56
- Max: 10
57
-
58
- # Limit lines to 120 characters.
59
- Metrics/LineLength:
60
- Max: 120
61
-
62
- Metrics/ClassLength:
63
- Max: 300 # As long as they're simple.
64
-
65
- Metrics/ModuleLength:
66
- Exclude:
67
- - 'spec/**/*'
68
-
69
- Metrics/BlockLength:
70
- Exclude:
71
- - 'spec/**/*'
72
-
73
- # ==================================== STYLE ==========================================================================
74
-
75
- Style/PercentLiteralDelimiters:
76
- PreferredDelimiters:
77
- '%i': ()
78
- '%I': ()
79
-
80
- # Use do-end for multiline blocks and {} for single lines
81
- # Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
82
- Style/BlockDelimiters:
83
- Exclude:
84
- - 'spec/**/*'
85
-
86
- Style/WordArray:
87
- MinSize: 5
88
- Exclude:
89
- - 'spec/**/*'
90
-
91
- # ==================================== LAYOUT ==============================================
92
-
93
- # defs stick to each other is just unpretty. Turning this on for general code,
94
- # but still allowing testing/mocking one-line exceptions
95
- Layout/EmptyLineBetweenDefs:
96
- Enabled: true
97
- AllowAdjacentOneLineDefs: true
98
-
99
- # Intenting hash properly will provide a better code readablity. However there
100
- # some exceptions. For example defining validations in Rails models or stubbing
101
- # in a new rspec way with allows and expects.
102
- Layout/IndentHash:
103
- Enabled: true
104
- Exclude:
105
- # Cause models can have very long validation definitions which we'd rather
106
- # format in a readable to us manner.
107
- - 'app/models/**/*'
108
- # Also skipping spec files as the new allow/expect syntax of rspec can
109
- # become bulky.
110
- - 'spec/**/*'
111
-
112
- Layout/SpaceInsideHashLiteralBraces:
113
- EnforcedStyle: no_space
114
- Enabled: true
115
-
116
- # ================================ DISABLED COPS ======================================================================
117
-
118
- # These cops are disabled because we think they are a Bad Idea. If you add one
119
- # here, make sure to add a comment describing what the cop does, and why this
120
- # is a bad idea.
121
-
122
- Style/PercentLiteralDelimiters:
123
- Enabled: false
124
-
125
- Style/SymbolArray:
126
- Enabled: false
127
-
128
- # Max 4 of parameters per method seems fair. Don't count keyword arguments though.
129
- Metrics/ParameterLists:
130
- Max: 4
131
- CountKeywordArgs: false
132
-
133
- # Use UTF-8 as the source file encoding.
134
- Style/Encoding:
135
- Enabled: false
136
-
137
- # Avoid methods longer than 16 lines of code
138
- Metrics/MethodLength:
139
- CountComments: false # count full line comments?
140
- Max: 16
141
-
142
- # When using \ for string concatenation line indents cause undesired whitespace in the string
143
- Style/LineEndConcatenation:
144
- Enabled: false
145
-
146
- # Forces the argument names of the block given to #reduce to be `a, e`. Only
147
- # applies on single-line blocks, but why would we want to force people to use
148
- # less descriptive names?
149
- Style/SingleLineBlockParams:
150
- Enabled: false
151
-
152
- # Complains than multiline ternary expressions should be if/else statements
153
- # Ternary are still often more readable.
154
- Style/MultilineTernaryOperator:
155
- Enabled: false
156
-
157
- # disallows `class Quby::Items::Text` style definitions.
158
- # Why waste all that indentation?
159
- Style/ClassAndModuleChildren:
160
- Enabled: false
161
-
162
- # This is not universally a better idea, it depends greatly on whether the
163
- # condition is to handle an edge-case or not. We prefer leaving this up to
164
- # code review instead of Rubocop.
165
- Style/IfUnlessModifier:
166
- Enabled: false
167
-
168
- # Use single quotes for strings that don't do string interpolation. Makes it
169
- # harder to later add an interpolated value.
170
- Style/StringLiterals:
171
- Enabled: false
172
-
173
- # This forces the use of the English library instead of $: etc. We think that some
174
- # of these Perl-vars are quite succinct.
175
- Style/SpecialGlobalVars:
176
- Enabled: false
177
-
178
- # This forces the use of %r{.. } when a regexp contains more than one slash.
179
- # If a regex is unreadable, code review will catch it, otherwise it's not
180
- # a function of how many slashes are in it.
181
- Style/RegexpLiteral:
182
- Enabled: false
183
-
184
- # Do not agree on this one as Block Chains can be used to query/narrow/scope
185
- # the results. As we chain them, the query is easier to read and understand.
186
- Style/MultilineBlockChain:
187
- Enabled: false
188
-
189
- # We do not want to force adding underscores between every 3 digits
190
- Style/NumericLiterals:
191
- Enabled: false
192
-
193
- # Ruby provides a beautiful way to set and get the values. By setting
194
- # `attr_accessor :foo` provides us with `def foo=(foo)` and `def foo` which can
195
- # be used to set and get the value of `foo`. Using get_ and set_ `works around`
196
- # this idiom.
197
- #
198
- # Argumentation: We do not want Rubocop to enforce this style. Sometimes methods
199
- # starting with `get_` or `set_` provide better readability and understanding of code
200
- Naming/AccessorMethodName:
201
- Enabled: false
202
-
203
- # This forces comments to align with the code.
204
- # But like to indent stories to the right and indent multiline comments with the itself.
205
- Layout/CommentIndentation:
206
- Enabled: false
207
-
208
- # This requires having multiline assignment values start on the same indentation level,
209
- # which is inconsistent with out standard for params methods, i.e.:
210
- # params.require(:foo)
211
- # .permit(:bar)
212
- # disabled until https://github.com/bbatsov/rubocop/issues/1633 https://github.com/bbatsov/rubocop/pull/2493 has been fixed
213
- Layout/MultilineOperationIndentation:
214
- Enabled: false
215
-
216
- # There is no good alternative for when you want to explicitly cast
217
- # a value to an actual boolean, which for JSON APIs is desirable.
218
- DoubleNegation:
219
- Enabled: false