mbrcode 0.1.0 → 0.1.3
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.
- checksums.yaml +4 -4
- data/.gitignore +9 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +35 -0
- data/README.md +170 -17
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/lib/mbrcode/version.rb +1 -1
- data/lib/mbrcode.rb +26 -36
- data/mbrcode.gemspec +31 -0
- data/spec/mbrcode_spec.rb +70 -0
- data/spec/spec_helper.rb +98 -0
- metadata +10 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5b2670d625de2bba07d5b5afa0269157130be5a2a7d74bbf1ea0f2bffce8184d
|
|
4
|
+
data.tar.gz: d96b32461b1496e390ea898d5b635af1eb7b54a60e52e0b0c8654cd73b90914e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff082cf39523d587ddddd917dbd0f43b44d68ec189c3200f07cc964a2bfdbd3aa87ad760d1fbf656663c3006f3bd172bf8df74521b2f5e9a742a0bcf92f4b6bf
|
|
7
|
+
data.tar.gz: d01ad2e07c5c25f6ed3089d268497242b12ae0f734334d6df8e728868ffd11d81a8632ccd84168f42ec23919f62e7f2b5df63cb0105797e449458dfa063f1344
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
mbrcode (0.1.3)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
diff-lcs (1.6.2)
|
|
10
|
+
rake (13.0.3)
|
|
11
|
+
rspec (3.13.2)
|
|
12
|
+
rspec-core (~> 3.13.0)
|
|
13
|
+
rspec-expectations (~> 3.13.0)
|
|
14
|
+
rspec-mocks (~> 3.13.0)
|
|
15
|
+
rspec-core (3.13.6)
|
|
16
|
+
rspec-support (~> 3.13.0)
|
|
17
|
+
rspec-expectations (3.13.5)
|
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
19
|
+
rspec-support (~> 3.13.0)
|
|
20
|
+
rspec-mocks (3.13.7)
|
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
22
|
+
rspec-support (~> 3.13.0)
|
|
23
|
+
rspec-support (3.13.6)
|
|
24
|
+
|
|
25
|
+
PLATFORMS
|
|
26
|
+
arm64-darwin-22
|
|
27
|
+
ruby
|
|
28
|
+
|
|
29
|
+
DEPENDENCIES
|
|
30
|
+
mbrcode!
|
|
31
|
+
rake (~> 13.0)
|
|
32
|
+
rspec (~> 3.12)
|
|
33
|
+
|
|
34
|
+
BUNDLED WITH
|
|
35
|
+
2.5.18
|
data/README.md
CHANGED
|
@@ -1,35 +1,188 @@
|
|
|
1
1
|
# Mbrcode
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Mbrcode** is a lightweight, deterministic, and clean **membership code generator** for Ruby applications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
It produces stable, structured IDs using the format:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
PREFIX + SHARD + "-" + DIGITS
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Where:
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- **PREFIX** → normalized to exactly 4 characters
|
|
12
|
+
- **SHARD** → numeric grouping/version number
|
|
13
|
+
- **DIGITS** → auto-incrementing sequence
|
|
14
|
+
- **Raw length before dashes** = **EXACTLY 16 characters**
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
Example output:
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
MBR1-0000-0000-000
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
Mbrcode is ideal for membership systems, gyms, schools, apps, organizations, ERPs, identity platforms, and anything requiring clean, compact, and consistent codes.
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
---
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
## ✨ Features
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
- 🔒 Thread-safe incremental counter
|
|
27
|
+
- 🧩 Smart prefix normalization rules
|
|
28
|
+
- 📏 Always 16 raw characters before dash grouping
|
|
29
|
+
- 🔣 Groups digits into 4-4-4 format when possible
|
|
30
|
+
- ⚙️ Configurable prefix and shard
|
|
31
|
+
- 💎 Zero external dependencies
|
|
32
|
+
- 🚀 Fast, simple, production-ready
|
|
24
33
|
|
|
25
|
-
|
|
34
|
+
---
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
## 📦 Installation
|
|
28
37
|
|
|
29
|
-
|
|
38
|
+
Add to your Gemfile:
|
|
30
39
|
|
|
31
|
-
|
|
40
|
+
```ruby
|
|
41
|
+
gem "mbrcode"
|
|
42
|
+
```
|
|
32
43
|
|
|
33
|
-
|
|
44
|
+
Install:
|
|
34
45
|
|
|
35
|
-
|
|
46
|
+
```bash
|
|
47
|
+
bundle install
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Or install manually:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
gem install mbrcode
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🚀 Usage
|
|
59
|
+
|
|
60
|
+
### Default generation
|
|
61
|
+
|
|
62
|
+
```ruby
|
|
63
|
+
Mbrcode.generate
|
|
64
|
+
# => "MBR1-0000-0000-000"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Custom prefix
|
|
68
|
+
|
|
69
|
+
```ruby
|
|
70
|
+
Mbrcode.generate(prefix: "user")
|
|
71
|
+
# => "USER1-0000-0000-000"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Multi-word prefix → initials
|
|
75
|
+
|
|
76
|
+
```ruby
|
|
77
|
+
Mbrcode.generate(prefix: "karate membership")
|
|
78
|
+
# => "KM00-0000-0000-000"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Prefix shorter than 4 chars → padded
|
|
82
|
+
|
|
83
|
+
```ruby
|
|
84
|
+
Mbrcode.generate(prefix: "ab")
|
|
85
|
+
# => "AB00-0000-0000-000"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Long prefix → first 4 characters
|
|
89
|
+
|
|
90
|
+
```ruby
|
|
91
|
+
Mbrcode.generate(prefix: "customer")
|
|
92
|
+
# => "CUST1-0000-0000-000"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Custom shard
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
Mbrcode.generate(prefix: "mbr", shard: 2)
|
|
99
|
+
# => "MBR2-0000-0000-000"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 🧠 Prefix Normalization Rules
|
|
105
|
+
|
|
106
|
+
| Input Prefix | Output Prefix | Rule Applied |
|
|
107
|
+
|---------------------|---------------|-------------------------|
|
|
108
|
+
| "m" | "M000" | padded to 4 characters |
|
|
109
|
+
| "ab" | "AB00" | padded to 4 characters |
|
|
110
|
+
| "karate membership" | "KM00" | initials + padded |
|
|
111
|
+
| "ruby on rails" | "ROR0" | initials + padded |
|
|
112
|
+
| "customer" | "CUST" | first 4 characters |
|
|
113
|
+
| "USER" | "USER" | unchanged (4 chars) |
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 🔢 16-Character Enforcement
|
|
118
|
+
|
|
119
|
+
Before grouping and adding dashes, the ID ALWAYS equals:
|
|
120
|
+
|
|
121
|
+
PREFIX(4) + SHARD(N) + DIGITS(M) = 16 characters
|
|
122
|
+
|
|
123
|
+
If the shard leaves no space for digits:
|
|
124
|
+
|
|
125
|
+
```ruby
|
|
126
|
+
Mbrcode.generate(prefix: "abcd", shard: 999999999)
|
|
127
|
+
# => raises "Shard too long"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
This ensures consistent, predictable, compact membership IDs.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 🧪 Testing
|
|
135
|
+
|
|
136
|
+
Run RSpec tests:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
bundle exec rspec
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
All tests should pass.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## 🛠 Development
|
|
147
|
+
|
|
148
|
+
Clone the repository:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
git clone https://github.com/delacruzjames/mbrcode.git
|
|
152
|
+
cd mbrcode
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Install dependencies:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
bundle install
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Run tests:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
bundle exec rspec
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 🤝 Contributing
|
|
170
|
+
|
|
171
|
+
Pull requests are welcome!
|
|
172
|
+
Please include tests for new features or bug fixes.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## 📜 License
|
|
177
|
+
|
|
178
|
+
Released under the **MIT License**.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 👤 Author
|
|
183
|
+
|
|
184
|
+
**Sensei James Dela Cruz**
|
|
185
|
+
Ruby Developer • API Architect • Karate Instructor
|
|
186
|
+
|
|
187
|
+
📧 Email: `delacruzjamesmartin@gmail.com`
|
|
188
|
+
🐙 GitHub: `@delacruzjames`
|
data/bin/console
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "bundler/setup"
|
|
5
|
+
require "mbrcode"
|
|
6
|
+
|
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
9
|
+
|
|
10
|
+
require "irb"
|
|
11
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/mbrcode/version.rb
CHANGED
data/lib/mbrcode.rb
CHANGED
|
@@ -1,70 +1,60 @@
|
|
|
1
1
|
require "mbrcode/version"
|
|
2
|
-
require "
|
|
2
|
+
require "monitor"
|
|
3
|
+
extend MonitorMixin
|
|
3
4
|
|
|
4
5
|
module Mbrcode
|
|
5
|
-
extend
|
|
6
|
+
extend MonitorMixin
|
|
6
7
|
|
|
7
8
|
@sequence = 0
|
|
8
9
|
|
|
9
10
|
class << self
|
|
10
11
|
#
|
|
11
|
-
#
|
|
12
|
-
# - Prefix processed to exactly 4 chars using logic described
|
|
13
|
-
# - MAX 16 digits total after prefix+shard
|
|
12
|
+
# GENERATE MEMBERSHIP CODE
|
|
14
13
|
#
|
|
15
14
|
def generate(prefix: "mbr", shard: 1)
|
|
15
|
+
shard_str = shard.to_i.to_s
|
|
16
|
+
|
|
17
|
+
# STRICT: shard must be <= 3 characters always
|
|
18
|
+
raise "Shard too long" if shard_str.length > 3
|
|
19
|
+
|
|
16
20
|
prefix_str = normalize_prefix(prefix)
|
|
17
|
-
shard_str = shard.to_i.to_s
|
|
18
21
|
|
|
19
22
|
seq = next_sequence
|
|
20
23
|
|
|
21
|
-
# remaining characters allowed for digits
|
|
22
24
|
max_digits = 16 - (prefix_str.length + shard_str.length)
|
|
23
|
-
|
|
24
|
-
# enforce enough space for meaningful numbering
|
|
25
25
|
raise "Shard too long" if max_digits < 4
|
|
26
26
|
|
|
27
|
-
digits
|
|
28
|
-
|
|
29
|
-
grouped =
|
|
30
|
-
if max_digits > 4
|
|
31
|
-
digits.scan(/.{1,4}/).join("-")
|
|
32
|
-
else
|
|
33
|
-
digits
|
|
34
|
-
end
|
|
27
|
+
digits = format("%0#{max_digits}d", seq)
|
|
28
|
+
grouped = digits.scan(/.{1,4}/).join("-")
|
|
35
29
|
|
|
36
30
|
"#{prefix_str}#{shard_str}-#{grouped}"
|
|
37
31
|
end
|
|
38
32
|
|
|
39
33
|
private
|
|
40
34
|
|
|
41
|
-
#
|
|
42
|
-
# PREFIX NORMALIZATION
|
|
43
|
-
#
|
|
35
|
+
# -----------------------------------------------------------
|
|
36
|
+
# PREFIX NORMALIZATION BASED ON YOUR SPECIFIC RULES
|
|
37
|
+
# -----------------------------------------------------------
|
|
44
38
|
def normalize_prefix(prefix)
|
|
45
39
|
str = prefix.to_s.strip.upcase
|
|
46
40
|
|
|
47
|
-
#
|
|
41
|
+
# 1) MULTI-WORD PREFIX → INITIALS (max 2 chars) → pad to 3
|
|
48
42
|
if str.include?(" ")
|
|
49
43
|
initials = str.split.map { |w| w[0] }.join
|
|
50
|
-
return
|
|
44
|
+
return initials[0, 2].ljust(3, "0")
|
|
51
45
|
end
|
|
52
46
|
|
|
53
|
-
#
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return str
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def pad_or_trim(str)
|
|
63
|
-
if str.length >= 4
|
|
64
|
-
str[0, 4]
|
|
47
|
+
# 2) SINGLE-WORD RULES
|
|
48
|
+
case str.length
|
|
49
|
+
when 1, 2
|
|
50
|
+
return str.ljust(3, "0")
|
|
51
|
+
when 3
|
|
52
|
+
return str
|
|
53
|
+
when 4
|
|
54
|
+
return str[0, 3]
|
|
65
55
|
else
|
|
66
|
-
|
|
67
|
-
str
|
|
56
|
+
mid = (str.length / 2) - 1
|
|
57
|
+
return str[mid, 3]
|
|
68
58
|
end
|
|
69
59
|
end
|
|
70
60
|
|
data/mbrcode.gemspec
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/mbrcode/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "mbrcode"
|
|
7
|
+
spec.version = Mbrcode::VERSION
|
|
8
|
+
spec.authors = ["Sensei James"]
|
|
9
|
+
spec.email = ["delacruzjamesmartin@gmail.com"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "Simple and clean membership code generator."
|
|
12
|
+
spec.description = "Generates structured membership IDs like MBR1-0000-0000-0000 for apps, systems, and organizations."
|
|
13
|
+
spec.homepage = "https://github.com/delacruzjames/mbrcode"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.required_ruby_version = ">= 3.0.0"
|
|
17
|
+
|
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
19
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
|
20
|
+
|
|
21
|
+
# Correct file discovery
|
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
23
|
+
`git ls-files -z`.split("\x0")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
spec.bindir = "exe"
|
|
27
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
28
|
+
spec.require_paths = ["lib"]
|
|
29
|
+
|
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.12"
|
|
31
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require "mbrcode"
|
|
2
|
+
|
|
3
|
+
RSpec.describe Mbrcode do
|
|
4
|
+
before { Mbrcode.instance_variable_set(:@sequence, 0) } # reset sequence for predictable tests
|
|
5
|
+
|
|
6
|
+
describe ".generate" do
|
|
7
|
+
context "default behavior" do
|
|
8
|
+
it "generates a code with the default prefix MBR (normalized to MBR)" do
|
|
9
|
+
code = Mbrcode.generate
|
|
10
|
+
expect(code).to start_with("MBR1-")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "increments the sequence number" do
|
|
14
|
+
first = Mbrcode.generate
|
|
15
|
+
second = Mbrcode.generate
|
|
16
|
+
expect(first).not_to eq(second)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
context "prefix rules (new specification)" do
|
|
21
|
+
it "pads prefix shorter than 3 chars with zeros (KP → KP0)" do
|
|
22
|
+
code = Mbrcode.generate(prefix: "kp")
|
|
23
|
+
expect(code).to start_with("KP01-")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "keeps 3-character prefixes as is (KKP stays KKP)" do
|
|
27
|
+
code = Mbrcode.generate(prefix: "kkp")
|
|
28
|
+
expect(code).to start_with("KKP1-")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "trims 4-character prefixes to first 3 (WKKP → WKK)" do
|
|
32
|
+
code = Mbrcode.generate(prefix: "WKKP")
|
|
33
|
+
expect(code).to start_with("WKK1-")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "extracts middle 3 letters for 5+ char prefixes (WKKPP → KKP)" do
|
|
37
|
+
code = Mbrcode.generate(prefix: "WKKPP")
|
|
38
|
+
expect(code).to start_with("KKP1-")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "multi-word prefixes convert to initials and pad to 3 chars" do
|
|
42
|
+
# "karate membership" → KM → pad → KM0
|
|
43
|
+
code = Mbrcode.generate(prefix: "karate membership")
|
|
44
|
+
expect(code).to start_with("KM01-")
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
context "shard logic" do
|
|
49
|
+
it "appends shard number after normalized prefix" do
|
|
50
|
+
# 'user' → 'USE' (first 3 of USER)
|
|
51
|
+
code = Mbrcode.generate(prefix: "user", shard: 9)
|
|
52
|
+
expect(code).to start_with("USE9-")
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "raises an error when shard is too large for 16-char rule" do
|
|
56
|
+
expect {
|
|
57
|
+
Mbrcode.generate(prefix: "abcd", shard: 123456789)
|
|
58
|
+
}.to raise_error(/Shard too long/)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
context "length compliance" do
|
|
63
|
+
it "ensures total raw length (no dashes) does not exceed 16 chars" do
|
|
64
|
+
code = Mbrcode.generate(prefix: "mem", shard: 1)
|
|
65
|
+
raw = code.delete("-")
|
|
66
|
+
expect(raw.length).to be <= 16
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
|
5
|
+
# files.
|
|
6
|
+
#
|
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
|
13
|
+
# it.
|
|
14
|
+
#
|
|
15
|
+
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
16
|
+
RSpec.configure do |config|
|
|
17
|
+
# rspec-expectations config goes here. You can use an alternate
|
|
18
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
19
|
+
# assertions if you prefer.
|
|
20
|
+
config.expect_with :rspec do |expectations|
|
|
21
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
|
22
|
+
# and `failure_message` of custom matchers include text for helper methods
|
|
23
|
+
# defined using `chain`, e.g.:
|
|
24
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
|
25
|
+
# # => "be bigger than 2 and smaller than 4"
|
|
26
|
+
# ...rather than:
|
|
27
|
+
# # => "be bigger than 2"
|
|
28
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
|
32
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
33
|
+
config.mock_with :rspec do |mocks|
|
|
34
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
|
35
|
+
# a real object. This is generally recommended, and will default to
|
|
36
|
+
# `true` in RSpec 4.
|
|
37
|
+
mocks.verify_partial_doubles = true
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
|
41
|
+
# have no way to turn it off -- the option exists only for backwards
|
|
42
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
|
43
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
|
44
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
|
45
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
46
|
+
|
|
47
|
+
# The settings below are suggested to provide a good initial experience
|
|
48
|
+
# with RSpec, but feel free to customize to your heart's content.
|
|
49
|
+
=begin
|
|
50
|
+
# This allows you to limit a spec run to individual examples or groups
|
|
51
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
|
52
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
|
53
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
|
54
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
|
55
|
+
config.filter_run_when_matching :focus
|
|
56
|
+
|
|
57
|
+
# Allows RSpec to persist some state between runs in order to support
|
|
58
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
|
59
|
+
# you configure your source control system to ignore this file.
|
|
60
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
|
61
|
+
|
|
62
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
|
63
|
+
# recommended. For more details, see:
|
|
64
|
+
# https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
|
|
65
|
+
config.disable_monkey_patching!
|
|
66
|
+
|
|
67
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
|
68
|
+
# be too noisy due to issues in dependencies.
|
|
69
|
+
config.warnings = true
|
|
70
|
+
|
|
71
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
|
72
|
+
# file, and it's useful to allow more verbose output when running an
|
|
73
|
+
# individual spec file.
|
|
74
|
+
if config.files_to_run.one?
|
|
75
|
+
# Use the documentation formatter for detailed output,
|
|
76
|
+
# unless a formatter has already been configured
|
|
77
|
+
# (e.g. via a command-line flag).
|
|
78
|
+
config.default_formatter = "doc"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Print the 10 slowest examples and example groups at the
|
|
82
|
+
# end of the spec run, to help surface which specs are running
|
|
83
|
+
# particularly slow.
|
|
84
|
+
config.profile_examples = 10
|
|
85
|
+
|
|
86
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
87
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
88
|
+
# the seed, which is printed after each run.
|
|
89
|
+
# --seed 1234
|
|
90
|
+
config.order = :random
|
|
91
|
+
|
|
92
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
|
93
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
94
|
+
# test failures related to randomization by passing the same `--seed` value
|
|
95
|
+
# as the one that triggered the failure.
|
|
96
|
+
Kernel.srand config.seed
|
|
97
|
+
=end
|
|
98
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mbrcode
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sensei James
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -32,6 +32,7 @@ executables: []
|
|
|
32
32
|
extensions: []
|
|
33
33
|
extra_rdoc_files: []
|
|
34
34
|
files:
|
|
35
|
+
- ".gitignore"
|
|
35
36
|
- ".idea/.gitignore"
|
|
36
37
|
- ".idea/inspectionProfiles/Project_Default.xml"
|
|
37
38
|
- ".idea/mbrcode.iml"
|
|
@@ -39,12 +40,19 @@ files:
|
|
|
39
40
|
- ".idea/modules.xml"
|
|
40
41
|
- ".idea/vcs.xml"
|
|
41
42
|
- ".rspec"
|
|
43
|
+
- Gemfile
|
|
44
|
+
- Gemfile.lock
|
|
42
45
|
- LICENSE.txt
|
|
43
46
|
- README.md
|
|
44
47
|
- Rakefile
|
|
48
|
+
- bin/console
|
|
49
|
+
- bin/setup
|
|
45
50
|
- lib/mbrcode.rb
|
|
46
51
|
- lib/mbrcode/version.rb
|
|
52
|
+
- mbrcode.gemspec
|
|
47
53
|
- sig/mbrcode.rbs
|
|
54
|
+
- spec/mbrcode_spec.rb
|
|
55
|
+
- spec/spec_helper.rb
|
|
48
56
|
homepage: https://github.com/delacruzjames/mbrcode
|
|
49
57
|
licenses:
|
|
50
58
|
- MIT
|