tram-policy 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d61d4df530a82fdee0fffa4c5129421348d60c18
4
- data.tar.gz: e129c65a0019df533cad7e2b90981c332572a6be
3
+ metadata.gz: 2ccc42d16b7d4766a4563edd74c431d7fa4da43e
4
+ data.tar.gz: 0673bfe221190c2b2f4a007b85c9277eb46476ff
5
5
  SHA512:
6
- metadata.gz: 3e11195f58b75868feaacb300a57377dbb5ba1d5955709c6ee589d8729bc7304a685cfe2db9c48f6e0f1a7ffb47c0746def0c9331c262199853662cdf8b6624e
7
- data.tar.gz: f3d07ca8653f883a72052abc0c3430845ad4c1d88177a8f266ca02f0c73a4b0e31e367cd658955ea6a129d0668b1d22695bd249926780080a9b7d3bba1caba95
6
+ metadata.gz: bd205531e5f8c84f2f9de7db3d3cb7249d92804e221e93a2d57f33d4c41b0c39dcdcb731011d03d826ce6a30a9e2a09c8d1fcb2ea6a2cb0bc0566bab24c7476a
7
+ data.tar.gz: 49b6ea096c3faba94755595266f6664e863a9b7895f22861efb4d4a962d0733d95d2627fa8fcc9fbf3bbbfd708fc6a6082340e02db4cd1696220b55f88d1824c
data/CHANGELOG.md CHANGED
@@ -4,7 +4,10 @@ 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
- ## [Unreleased]
7
+ ## [0.0.3] - [2017-05-24]
8
+
9
+ ### Fixed
10
+ - bug in `errors.empty?` with a block (@nepalez with thanks to @gzigzigzeo)
8
11
 
9
12
  ## [0.0.2] - [2017-04-25]
10
13
  The gem is battle-tested for production (in a real commertial project).
@@ -31,3 +34,4 @@ This is a first public release (@nepalez, @charlie-wasp, @JewelSam, @sergey-chec
31
34
  [Unreleased]: https://github.com/tram-rb/tram-policy
32
35
  [0.0.1]: https://github.com/tram-rb/tram-policy/releases/tag/v0.0.1
33
36
  [0.0.2]: https://github.com/tram-rb/tram-policy/compare/v0.0.1...v0.0.2
37
+ [0.0.3]: https://github.com/tram-rb/tram-policy/compare/v0.0.2...v0.0.3
@@ -51,8 +51,8 @@ class Tram::Policy
51
51
  #
52
52
  # @return [Boolean]
53
53
  #
54
- def empty?
55
- !any?
54
+ def empty?(&block)
55
+ block ? !any?(&block) : !any?
56
56
  end
57
57
 
58
58
  # The array of ordered error messages
@@ -23,6 +23,18 @@ RSpec.describe Tram::Policy::Errors do
23
23
  end
24
24
  end
25
25
 
26
+ describe "#empty?" do
27
+ subject { errors.add :omg, level: "info", field: "name" }
28
+
29
+ it "checks whether error present" do
30
+ expect(subject).not_to be_empty
31
+ end
32
+
33
+ it "accepts a block" do
34
+ expect(subject.empty? { |error| error.level != "info" }).to eq true
35
+ end
36
+ end
37
+
26
38
  describe "#merge" do
27
39
  let(:other) { described_class.new(policy) }
28
40
 
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.0.2"
3
+ gem.version = "0.0.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"
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.0.2
4
+ version: 0.0.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-04-25 00:00:00.000000000 Z
12
+ date: 2017-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-initializer