noid 0.8.0 → 0.9.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
  SHA1:
3
- metadata.gz: acd76906cdc40cfe6803fcf7ca54bf88ce0ca981
4
- data.tar.gz: 90961988a2c041a1c7946cb57c61923fa303f3ac
3
+ metadata.gz: 31fffcc02d97ab52d90673b1914612ec8316ed15
4
+ data.tar.gz: e5aab1a19eb09f2473b8af2f3aa6187f3bca7e48
5
5
  SHA512:
6
- metadata.gz: 3c481bd56ec9435a09875416e0e24751f07f348eebf1234ede326bef81a031582e9574fa51e457507d231696724cc167e1978e39aeb88c6672a625766e58ea6e
7
- data.tar.gz: c93b2e4e8a68a6bc7c17bafbe8131dbe479fdfcaff85954aa0712a050882a1fcbbd6c4c3118ba6637859f908b7600639a56d84df62cc866d19268989ffa5c2d4
6
+ metadata.gz: 2c6ae2de1729b20be10b9a23d57c9d11665cc478bdc29123d9edd84ede169f3e36c5b7a0d3c97b3520c55d238fdf2707add133f3afbd8d09541e6b5ee00cf7c1
7
+ data.tar.gz: 0a56a99d410cbd335c01a2b442ab5e2f70458f6d5708ff2ac94fead94eb87c291e7c5afe76c445381116ddeb753db361240188ad9240e13433c959e705f66919
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.0
1
+ 0.9.0
@@ -14,7 +14,6 @@ module Noid
14
14
  str = prefix
15
15
  str += n2xdig(n)
16
16
  str += checkdigit(str) if checkdigit?
17
-
18
17
  str
19
18
  end
20
19
 
@@ -43,6 +42,15 @@ module Noid
43
42
  @min ||= 0
44
43
  end
45
44
 
45
+ def to_s
46
+ template
47
+ end
48
+
49
+ def ==(other)
50
+ return false unless other.is_a? Noid::Template
51
+ template == other.template
52
+ end
53
+
46
54
  ##
47
55
  # maximum sequence value for the template
48
56
  def max
@@ -1,11 +1,34 @@
1
1
  require 'spec_helper'
2
2
 
3
+
4
+ class OtherTemplate < Noid::Template
5
+ end
6
+
3
7
  describe Noid::Template do
4
8
  context 'with a valid template' do
5
9
  let(:template) { '.redek' }
6
10
  it 'initializes without raising' do
7
11
  expect { described_class.new(template) }.not_to raise_error
8
12
  end
13
+ it 'stringifies cleanly as the template string' do
14
+ expect(described_class.new(template).to_s).to eq(template)
15
+ end
16
+ describe 'comparison' do
17
+ let(:object) { described_class.new(template) }
18
+ it 'unrelated object is not equivalent' do
19
+ expect(object).not_to eq(Array.new)
20
+ end
21
+ it 'descendant object with same template is equivalent' do
22
+ expect(object).to eq(OtherTemplate.new(object.template))
23
+ end
24
+ it 'same templates produce equivalent objects' do
25
+ expect(object).to eq(described_class.new(object.template))
26
+ end
27
+ it 'different templates produce non-equivalent objects' do
28
+ expect(object).not_to eq(described_class.new('.redddek'))
29
+ expect(object).not_to eq(OtherTemplate.new('.redddek'))
30
+ end
31
+ end
9
32
  end
10
33
  context 'with a bogus template' do
11
34
  let(:template) { 'foobar' }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-05 00:00:00.000000000 Z
11
+ date: 2016-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,8 +95,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project: noid
98
- rubygems_version: 2.4.6
98
+ rubygems_version: 2.6.4
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Nice Opaque Identifier
102
- test_files: []
102
+ test_files:
103
+ - spec/lib/minter_spec.rb
104
+ - spec/lib/template_spec.rb
105
+ - spec/spec_helper.rb