statesman 11.0.0 → 12.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +7 -3
- data/.gitignore +0 -3
- data/.rspec +1 -0
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +174 -43
- data/CONTRIBUTING.md +14 -13
- data/README.md +120 -62
- data/docs/COMPATIBILITY.md +2 -2
- data/lib/generators/statesman/generator_helpers.rb +1 -1
- data/lib/statesman/adapters/active_record.rb +24 -26
- data/lib/statesman/adapters/active_record_queries.rb +2 -2
- data/lib/statesman/callback.rb +2 -2
- data/lib/statesman/config.rb +3 -10
- data/lib/statesman/machine.rb +8 -0
- data/lib/statesman/version.rb +1 -1
- data/lib/statesman.rb +3 -5
- data/lib/tasks/statesman.rake +2 -2
- data/spec/generators/statesman/active_record_transition_generator_spec.rb +7 -1
- data/spec/generators/statesman/migration_generator_spec.rb +5 -1
- data/spec/spec_helper.rb +33 -5
- data/spec/statesman/adapters/active_record_queries_spec.rb +0 -2
- data/spec/statesman/adapters/active_record_spec.rb +48 -13
- data/spec/statesman/adapters/active_record_transition_spec.rb +0 -1
- data/spec/statesman/adapters/memory_spec.rb +0 -1
- data/spec/statesman/adapters/memory_transition_spec.rb +0 -1
- data/spec/statesman/adapters/shared_examples.rb +0 -2
- data/spec/statesman/adapters/type_safe_active_record_queries_spec.rb +0 -2
- data/spec/statesman/callback_spec.rb +0 -2
- data/spec/statesman/config_spec.rb +0 -2
- data/spec/statesman/exceptions_spec.rb +0 -2
- data/spec/statesman/guard_spec.rb +0 -2
- data/spec/statesman/machine_spec.rb +71 -2
- data/spec/statesman/utils_spec.rb +0 -2
- data/spec/support/active_record.rb +50 -8
- data/spec/support/exactly_query_databases.rb +35 -0
- data/statesman.gemspec +4 -4
- metadata +11 -9
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# `expected_dbs` should be a Hash of the form:
|
4
|
+
# {
|
5
|
+
# primary: [:writing, :reading],
|
6
|
+
# replica: [:reading],
|
7
|
+
# }
|
8
|
+
RSpec::Matchers.define :exactly_query_databases do |expected_dbs|
|
9
|
+
match do |block|
|
10
|
+
@expected_dbs = expected_dbs.transform_values(&:to_set).with_indifferent_access
|
11
|
+
@actual_dbs = Hash.new { |h, k| h[k] = Set.new }.with_indifferent_access
|
12
|
+
|
13
|
+
ActiveSupport::Notifications.
|
14
|
+
subscribe("sql.active_record") do |_name, _start, _finish, _id, payload|
|
15
|
+
pool = payload.fetch(:connection).pool
|
16
|
+
|
17
|
+
next if pool.is_a?(ActiveRecord::ConnectionAdapters::NullPool)
|
18
|
+
|
19
|
+
name = pool.db_config.name
|
20
|
+
role = pool.role
|
21
|
+
|
22
|
+
@actual_dbs[name] << role
|
23
|
+
end
|
24
|
+
|
25
|
+
block.call
|
26
|
+
|
27
|
+
@actual_dbs == @expected_dbs
|
28
|
+
end
|
29
|
+
|
30
|
+
failure_message do |_block|
|
31
|
+
"expected to query exactly #{@expected_dbs}, but queried #{@actual_dbs}"
|
32
|
+
end
|
33
|
+
|
34
|
+
supports_block_expectations
|
35
|
+
end
|
data/statesman.gemspec
CHANGED
@@ -20,20 +20,20 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.required_ruby_version = ">=
|
23
|
+
spec.required_ruby_version = ">= 3.0"
|
24
24
|
|
25
25
|
spec.add_development_dependency "ammeter", "~> 1.1"
|
26
26
|
spec.add_development_dependency "bundler", "~> 2"
|
27
|
-
spec.add_development_dependency "gc_ruboconfig", "~> 4.
|
27
|
+
spec.add_development_dependency "gc_ruboconfig", "~> 4.4.1"
|
28
28
|
spec.add_development_dependency "mysql2", ">= 0.4", "< 0.6"
|
29
29
|
spec.add_development_dependency "pg", ">= 0.18", "<= 1.6"
|
30
30
|
spec.add_development_dependency "rails", ">= 5.2"
|
31
|
-
spec.add_development_dependency "rake", "~> 13.
|
31
|
+
spec.add_development_dependency "rake", "~> 13.1.0"
|
32
32
|
spec.add_development_dependency "rspec", "~> 3.1"
|
33
33
|
spec.add_development_dependency "rspec-github", "~> 2.4.0"
|
34
34
|
spec.add_development_dependency "rspec-its", "~> 1.1"
|
35
35
|
spec.add_development_dependency "rspec-rails", "~> 6.0"
|
36
|
-
spec.add_development_dependency "sqlite3", "~> 1.
|
36
|
+
spec.add_development_dependency "sqlite3", "~> 1.7.0"
|
37
37
|
spec.add_development_dependency "timecop", "~> 0.9.1"
|
38
38
|
|
39
39
|
spec.metadata = {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statesman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 12.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GoCardless
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ammeter
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.
|
47
|
+
version: 4.4.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.
|
54
|
+
version: 4.4.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mysql2
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,14 +112,14 @@ dependencies:
|
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: 13.
|
115
|
+
version: 13.1.0
|
116
116
|
type: :development
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: 13.
|
122
|
+
version: 13.1.0
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: rspec
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,14 +182,14 @@ dependencies:
|
|
182
182
|
requirements:
|
183
183
|
- - "~>"
|
184
184
|
- !ruby/object:Gem::Version
|
185
|
-
version: 1.
|
185
|
+
version: 1.7.0
|
186
186
|
type: :development
|
187
187
|
prerelease: false
|
188
188
|
version_requirements: !ruby/object:Gem::Requirement
|
189
189
|
requirements:
|
190
190
|
- - "~>"
|
191
191
|
- !ruby/object:Gem::Version
|
192
|
-
version: 1.
|
192
|
+
version: 1.7.0
|
193
193
|
- !ruby/object:Gem::Dependency
|
194
194
|
name: timecop
|
195
195
|
requirement: !ruby/object:Gem::Requirement
|
@@ -214,6 +214,7 @@ files:
|
|
214
214
|
- ".github/dependabot.yml"
|
215
215
|
- ".github/workflows/tests.yml"
|
216
216
|
- ".gitignore"
|
217
|
+
- ".rspec"
|
217
218
|
- ".rubocop.yml"
|
218
219
|
- ".rubocop_todo.yml"
|
219
220
|
- ".ruby-version"
|
@@ -267,6 +268,7 @@ files:
|
|
267
268
|
- spec/statesman/machine_spec.rb
|
268
269
|
- spec/statesman/utils_spec.rb
|
269
270
|
- spec/support/active_record.rb
|
271
|
+
- spec/support/exactly_query_databases.rb
|
270
272
|
- spec/support/generators_shared_examples.rb
|
271
273
|
- statesman.gemspec
|
272
274
|
homepage: https://github.com/gocardless/statesman
|
@@ -287,7 +289,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
287
289
|
requirements:
|
288
290
|
- - ">="
|
289
291
|
- !ruby/object:Gem::Version
|
290
|
-
version: '
|
292
|
+
version: '3.0'
|
291
293
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
292
294
|
requirements:
|
293
295
|
- - ">="
|