tram-policy 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +7 -0
- data/lib/tram/policy/rspec.rb +13 -4
- data/lib/tram/policy/validator.rb +0 -2
- data/tram-policy.gemspec +2 -2
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22af5024252d8e51fc4147c26998ea99f3131cbc
|
4
|
+
data.tar.gz: e5ed607e1ffa5fabb805f611b0f227592c09ead4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0c48d928ca99dc24d290121d557177c395dd994886b519f51b518b04d99bac2f6324e4257a26171d01e54df9b4d253c42f20d3b643c51ac8c9538d324aabdac
|
7
|
+
data.tar.gz: d93356f5f5e2feb002dad6915f27c90d3094dd2f887b76c4414c08b6b3a0e09d9b2253fdd2a72497dbc5af8a677af827218bc661a9293408bd39a6b3251c9a75
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
6
|
|
7
|
+
## [0.2.3] - [2017-11-21]
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
- RSpec matcher `:be_invalid_at` checks all the available locales (nepalez)
|
11
|
+
- Security vulnerability from old version of rubocop (update to 0.49) (nepalez)
|
12
|
+
|
7
13
|
## [0.2.2] - [2017-09-12]
|
8
14
|
|
9
15
|
### Changed
|
@@ -108,3 +114,4 @@ This is a first public release (@nepalez, @charlie-wasp, @JewelSam, @sergey-chec
|
|
108
114
|
[0.2.0]: https://github.com/tram-rb/tram-policy/compare/v0.1.1...v0.2.0
|
109
115
|
[0.2.1]: https://github.com/tram-rb/tram-policy/compare/v0.2.0...v0.2.1
|
110
116
|
[0.2.2]: https://github.com/tram-rb/tram-policy/compare/v0.2.1...v0.2.2
|
117
|
+
[0.2.3]: https://github.com/tram-rb/tram-policy/compare/v0.2.2...v0.2.3
|
data/lib/tram/policy/rspec.rb
CHANGED
@@ -45,8 +45,7 @@ RSpec::Matchers.define :be_invalid_at do |**tags|
|
|
45
45
|
locales.flat_map { |locale| I18n.with_locale(locale) { yield } }
|
46
46
|
end
|
47
47
|
|
48
|
-
|
49
|
-
def prepare_results(policy_block, tags, locale = I18n.locale)
|
48
|
+
def prepare_localized_results(policy_block, tags, locale)
|
50
49
|
localized_policy = policy_block.call
|
51
50
|
localized_errors = localized_policy&.errors || []
|
52
51
|
self.policy = localized_policy.inspect
|
@@ -54,6 +53,16 @@ RSpec::Matchers.define :be_invalid_at do |**tags|
|
|
54
53
|
messages[locale] = localized_errors.full_messages
|
55
54
|
end
|
56
55
|
|
56
|
+
def prepare_results(policy_block, tags)
|
57
|
+
original = I18n.locale
|
58
|
+
I18n.available_locales.each do |locale|
|
59
|
+
I18n.locale = locale
|
60
|
+
prepare_localized_results(policy_block, tags, locale)
|
61
|
+
end
|
62
|
+
ensure
|
63
|
+
I18n.locale = original
|
64
|
+
end
|
65
|
+
|
57
66
|
# ****************************************************************************
|
58
67
|
# Checkers for collected results
|
59
68
|
# ****************************************************************************
|
@@ -88,7 +97,7 @@ RSpec::Matchers.define :be_invalid_at do |**tags|
|
|
88
97
|
# ****************************************************************************
|
89
98
|
|
90
99
|
match do |policy_block|
|
91
|
-
|
100
|
+
prepare_results(policy_block, tags)
|
92
101
|
errored? && translated?
|
93
102
|
end
|
94
103
|
|
@@ -105,7 +114,7 @@ RSpec::Matchers.define :be_invalid_at do |**tags|
|
|
105
114
|
# ****************************************************************************
|
106
115
|
|
107
116
|
match_when_negated do |policy_block|
|
108
|
-
|
117
|
+
prepare_results(policy_block, tags)
|
109
118
|
not_errored?
|
110
119
|
end
|
111
120
|
|
data/tram-policy.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "tram-policy"
|
3
|
-
gem.version = "0.2.
|
3
|
+
gem.version = "0.2.3"
|
4
4
|
gem.author = ["Viktor Sokolov (gzigzigzeo)", "Andrew Kozin (nepalez)"]
|
5
5
|
gem.email = "andrew.kozin@gmail.com"
|
6
6
|
gem.homepage = "https://github.com/tram/tram-policy"
|
@@ -20,6 +20,6 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.add_development_dependency "rake", "> 10"
|
21
21
|
gem.add_development_dependency "rspec", "~> 3.0"
|
22
22
|
gem.add_development_dependency "rspec-its", "~> 1.2"
|
23
|
-
gem.add_development_dependency "rubocop", "~> 0.
|
23
|
+
gem.add_development_dependency "rubocop", "~> 0.49"
|
24
24
|
gem.add_development_dependency "thor", "~> 0.19"
|
25
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tram-policy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Viktor Sokolov (gzigzigzeo)
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dry-initializer
|
@@ -87,14 +87,14 @@ dependencies:
|
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '0.
|
90
|
+
version: '0.49'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '0.
|
97
|
+
version: '0.49'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: thor
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
173
|
version: '0'
|
174
174
|
requirements: []
|
175
175
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.6.
|
176
|
+
rubygems_version: 2.6.14
|
177
177
|
signing_key:
|
178
178
|
specification_version: 4
|
179
179
|
summary: Policy Object Pattern
|
@@ -190,4 +190,3 @@ test_files:
|
|
190
190
|
- spec/tram/policy/rspec_spec.rb
|
191
191
|
- spec/tram/policy/validation_error_spec.rb
|
192
192
|
- spec/tram/policy_spec.rb
|
193
|
-
has_rdoc:
|