rspec-uuid 0.5.0 → 0.6.0

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
  SHA256:
3
- metadata.gz: 01a071e18425a466c1ad901fc015b3f683467d4b77ba7d1a151e57d0bf28b264
4
- data.tar.gz: ee5776d8c999625c67a543bd3ecf40097a0983d9653fbc034505f0542137b51f
3
+ metadata.gz: 182a16e53a65c328fd32f92aef6b5d9bb5d52e92cf08cc67f5799eaaea72f13d
4
+ data.tar.gz: 7cd4ffa9c8e7a7427b32ba1d48ce59a39c81728c4fe54563c05cb604596225b0
5
5
  SHA512:
6
- metadata.gz: c05681f2b05f9c78225f658b99f2fe96032660614cf32611cf1f5596e9d8869346a36d2762e53e0b41846e717ba1d6b0c5457779fc51058fc95f1c1fa8c50f57
7
- data.tar.gz: 26cc496001d14ecb9829b21f1525f20e80ea7a139cfe24386700283946f9716269bb4bfefb86658059f09c59469581a8d3c08c1c4565efde0e897fcf515f355d
6
+ metadata.gz: 7b58fa677009b056653611cf8950e651e89db53229e06fe4d8673a0cfd4f65775b8e26f3d02b0ba97821eed76b255423130e608d3fea00fcc2330058481e8894
7
+ data.tar.gz: fab7586801890f4eef8268690c6568c53afb6fb4a62f2ee2910b1860ad3dfc85917d6bdb2c53a9fc7c94b31432e3e1190dd3c53a119dbb3d61ecfa954923779e
data/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ ### v0.6.0 (2024-04-08)
2
+ - drop ruby 2.7
3
+ - dependabot upgrades
4
+ - uuid_v7
5
+ - gemspec fixup
6
+ - codecov upgrade (#1)
7
+ - add lockfile and dependabot
8
+
9
+ ### v0.5.0 (2022-06-08)
10
+ - move to "rspec/uuid"
11
+ - .of_version chain
12
+ - Update README.md
13
+ - simplify composition spec
14
+
15
+ ### v0.4.0 (2022-05-23)
16
+ - rspec 3
17
+ - Update README.md
18
+
19
+ ### v0.3.0 (2022-05-19)
20
+ - version kwarg
21
+
22
+ ### v0.2.1 (2022-05-16)
23
+ - requirements
24
+ - faker coverage
25
+ - Update README.md
26
+
27
+ ### v0.2.0 (2022-05-13)
28
+ - uuid version support
29
+ - Update README.md
30
+
31
+ ### v0.1.0 (2022-05-12)
32
+ - voila
33
+
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,74 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rspec-uuid (0.6.0)
5
+ rspec-expectations (>= 3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (7.1.3.2)
11
+ base64
12
+ bigdecimal
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ connection_pool (>= 2.2.5)
15
+ drb
16
+ i18n (>= 1.6, < 2)
17
+ minitest (>= 5.1)
18
+ mutex_m
19
+ tzinfo (~> 2.0)
20
+ base64 (0.2.0)
21
+ bigdecimal (3.1.6)
22
+ byebug (11.1.3)
23
+ concurrent-ruby (1.2.3)
24
+ connection_pool (2.4.1)
25
+ diff-lcs (1.5.1)
26
+ docile (1.4.0)
27
+ drb (2.2.0)
28
+ ruby2_keywords
29
+ faker (3.3.0)
30
+ i18n (>= 1.8.11, < 2)
31
+ i18n (1.14.4)
32
+ concurrent-ruby (~> 1.0)
33
+ minitest (5.22.2)
34
+ mutex_m (0.2.0)
35
+ rspec (3.13.0)
36
+ rspec-core (~> 3.13.0)
37
+ rspec-expectations (~> 3.13.0)
38
+ rspec-mocks (~> 3.13.0)
39
+ rspec-core (3.13.0)
40
+ rspec-support (~> 3.13.0)
41
+ rspec-expectations (3.13.0)
42
+ diff-lcs (>= 1.2.0, < 2.0)
43
+ rspec-support (~> 3.13.0)
44
+ rspec-mocks (3.13.0)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.13.0)
47
+ rspec-support (3.13.0)
48
+ ruby2_keywords (0.0.5)
49
+ simplecov (0.22.0)
50
+ docile (~> 1.1)
51
+ simplecov-html (~> 0.11)
52
+ simplecov_json_formatter (~> 0.1)
53
+ simplecov-html (0.12.3)
54
+ simplecov_json_formatter (0.1.4)
55
+ tzinfo (2.0.6)
56
+ concurrent-ruby (~> 1.0)
57
+ uuid7 (0.2.0)
58
+ zeitwerk (~> 2.4)
59
+ zeitwerk (2.6.12)
60
+
61
+ PLATFORMS
62
+ ruby
63
+
64
+ DEPENDENCIES
65
+ activesupport
66
+ byebug
67
+ faker
68
+ rspec
69
+ rspec-uuid!
70
+ simplecov
71
+ uuid7
72
+
73
+ BUNDLED WITH
74
+ 2.4.20
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Daniel Pepper
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ rspec-uuid
2
+ ======
3
+ ![Gem](https://img.shields.io/gem/dt/rspec-uuid?style=plastic)
4
+ [![codecov](https://codecov.io/gh/dpep/rspec-uuid/branch/main/graph/badge.svg)](https://codecov.io/gh/dpep/rspec-uuid)
5
+
6
+
7
+ An RSpec matcher for UUIDs.
8
+
9
+ ```ruby
10
+ require "rspec/uuid"
11
+
12
+
13
+ it { is_expected.to be_a_uuid }
14
+
15
+ # check the version
16
+ it { is_expected.to be_a_uuid(version: 4) }
17
+ it { is_expected.to be_a_uuid.of_version(4) }
18
+
19
+ # compose with other matchers
20
+ it { expect(data).to include(uuid: a_uuid) }
21
+ ```
22
+
23
+
24
+ ----
25
+ ## Contributing
26
+
27
+ Yes please :)
28
+
29
+ 1. Fork it
30
+ 1. Create your feature branch (`git checkout -b my-feature`)
31
+ 1. Ensure the tests pass (`bundle exec rspec`)
32
+ 1. Commit your changes (`git commit -am 'awesome new feature'`)
33
+ 1. Push your branch (`git push origin my-feature`)
34
+ 1. Create a Pull Request
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module UUID
3
- VERSION = "0.5.0"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
data/lib/rspec/uuid.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  require "rspec/expectations"
2
2
 
3
3
  RSpec::Matchers.define :be_a_uuid do |version: nil|
4
+ chain :of_version do |version|
5
+ @version = version
6
+ end
7
+
4
8
  match do |actual|
5
9
  raise ArgumentError if @version && version
6
10
 
@@ -21,10 +25,6 @@ RSpec::Matchers.define :be_a_uuid do |version: nil|
21
25
  end
22
26
  end
23
27
 
24
- chain :of_version do |version|
25
- @version = version
26
- end
27
-
28
28
  description do
29
29
  version ? "a UUID v#{version}" : "a UUID"
30
30
  end
@@ -0,0 +1,25 @@
1
+ require_relative "lib/rspec/uuid/version"
2
+ package = RSpec::UUID
3
+ package_name = "rspec-uuid"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.authors = ["Daniel Pepper"]
7
+ s.description = "RSpec UUID matcher"
8
+ s.files = `git ls-files * ':!:spec'`.split("\n")
9
+ s.homepage = "https://github.com/dpep/#{package_name}"
10
+ s.license = "MIT"
11
+ s.name = package_name
12
+ s.summary = package.to_s
13
+ s.version = package.const_get "VERSION"
14
+
15
+ s.required_ruby_version = ">= 3"
16
+
17
+ s.add_dependency "rspec-expectations", ">= 3"
18
+
19
+ s.add_development_dependency "activesupport"
20
+ s.add_development_dependency "byebug"
21
+ s.add_development_dependency "faker"
22
+ s.add_development_dependency "rspec"
23
+ s.add_development_dependency "simplecov"
24
+ s.add_development_dependency "uuid7"
25
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-uuid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Pepper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-09 00:00:00.000000000 Z
11
+ date: 2024-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-expectations
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: codecov
56
+ name: faker
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: faker
70
+ name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec
84
+ name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: simplecov
98
+ name: uuid7
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -114,10 +114,15 @@ executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
+ - CHANGELOG.md
118
+ - Gemfile
119
+ - Gemfile.lock
120
+ - LICENSE.txt
121
+ - README.md
117
122
  - lib/rspec-uuid.rb
118
123
  - lib/rspec/uuid.rb
119
124
  - lib/rspec/uuid/version.rb
120
- - spec/matchers_spec.rb
125
+ - rspec-uuid.gemspec
121
126
  homepage: https://github.com/dpep/rspec-uuid
122
127
  licenses:
123
128
  - MIT
@@ -130,16 +135,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
135
  requirements:
131
136
  - - ">="
132
137
  - !ruby/object:Gem::Version
133
- version: '0'
138
+ version: '3'
134
139
  required_rubygems_version: !ruby/object:Gem::Requirement
135
140
  requirements:
136
141
  - - ">="
137
142
  - !ruby/object:Gem::Version
138
143
  version: '0'
139
144
  requirements: []
140
- rubygems_version: 3.1.6
145
+ rubygems_version: 3.5.7
141
146
  signing_key:
142
147
  specification_version: 4
143
- summary: Gem::Specification::RSpec::UUID
144
- test_files:
145
- - spec/matchers_spec.rb
148
+ summary: RSpec::UUID
149
+ test_files: []
@@ -1,88 +0,0 @@
1
- describe "be_a_uuid" do
2
- context "with a valid UUID" do
3
- let(:uuid) { "992c94bd-5870-4e02-ad2d-a9435f7fffe6" }
4
-
5
- specify { expect(uuid).to be_a_uuid }
6
- end
7
-
8
- context "with generated UUIDs" do
9
- specify do
10
- 100.times { expect(SecureRandom.uuid).to be_a_uuid }
11
- 100.times { expect(Faker::Internet.uuid).to be_a_uuid }
12
- end
13
- end
14
-
15
- context "with invalid UUIDs" do
16
- specify { expect("abc").not_to be_a_uuid }
17
- specify { expect(:xyz).not_to be_a_uuid }
18
- specify { expect(123).not_to be_a_uuid }
19
- specify { expect(nil).not_to be_a_uuid }
20
-
21
- it "fails with a useful message" do
22
- expect {
23
- expect(nil).to be_a_uuid
24
- }.to fail_including("expected a UUID")
25
- end
26
-
27
- it "fails with a useful negation message" do
28
- expect {
29
- expect(SecureRandom.uuid).not_to be_a_uuid
30
- }.to fail_including("did not expect a UUID")
31
- end
32
- end
33
-
34
- context "with a UUID version" do
35
- let(:namespace) { Digest::UUID::OID_NAMESPACE }
36
- let(:uuid_v3) { Digest::UUID.uuid_v3(namespace, "123") }
37
- let(:uuid_v4) { SecureRandom.uuid }
38
- let(:uuid_v5) { Digest::UUID.uuid_v5(namespace, "123") }
39
-
40
- specify { expect(uuid_v3).to be_a_uuid(version: 3) }
41
- specify { expect(uuid_v3).not_to be_a_uuid(version: 4) }
42
- specify { expect(uuid_v3).not_to be_a_uuid(version: 5) }
43
-
44
- specify { expect(uuid_v4).to be_a_uuid(version: 4) }
45
- specify { expect(uuid_v5).to be_a_uuid(version: 5) }
46
-
47
- it "fails with a useful message" do
48
- expect {
49
- expect(uuid_v3).to be_a_uuid(version: 4)
50
- }.to fail_including("expected a UUID v4, found a UUID v3")
51
- end
52
-
53
- describe ".of_version" do
54
- it { expect(uuid_v3).to be_a_uuid.of_version(3) }
55
-
56
- it { expect(uuid_v4).to be_a_uuid.of_version(4) }
57
- it { expect(uuid_v4).not_to be_a_uuid.of_version(3) }
58
-
59
- it "requires a version argument" do
60
- expect {
61
- expect(uuid_v4).to be_a_uuid.of_version
62
- }.to raise_error(ArgumentError)
63
- end
64
-
65
- it "can not be used simultaneously with kwarg version" do
66
- expect {
67
- expect(uuid_v4).to be_a_uuid(version: 4).of_version(4)
68
- }.to raise_error(ArgumentError)
69
- end
70
- end
71
- end
72
-
73
- it "is composable" do
74
- data = {
75
- abc: { a: 1 },
76
- uuid: SecureRandom.uuid,
77
- uuid_v5: Digest::UUID.uuid_v5(Digest::UUID::OID_NAMESPACE, "123"),
78
- }
79
-
80
- expect(data).to include(uuid: a_uuid)
81
-
82
- expect(data).to match(
83
- abc: a_hash_including(:a),
84
- uuid: a_uuid,
85
- uuid_v5: a_uuid(version: 5),
86
- )
87
- end
88
- end