mad_id 0.0.1 → 0.0.2
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/lib/mad_id/identity_methods.rb +2 -1
- data/lib/mad_id/version.rb +1 -1
- data/spec/mad_id_spec.rb +14 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4042c8ec49b11bb1ef84bacc35e97c27424c456d
|
4
|
+
data.tar.gz: cb50809eca16ed50ca04513e41e7d20e8819ba9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 214384a13864dec0349b7bc89b2b6dfc21299a673e83c1432aace4bf6188fcd64f9ee3887fa85b692ba937b3893ea37cdc90a98d0d6703f8b55bf73751786e36
|
7
|
+
data.tar.gz: 345ea0ed4b9e90e9f4bdd472a88c02c0496e185687a619002b9e6798342f6119f1a59a713910d426d6485b9ba63a0ea29f95a92318420dccc6b073db87678933
|
data/lib/mad_id/version.rb
CHANGED
data/spec/mad_id_spec.rb
CHANGED
@@ -15,14 +15,14 @@ describe MadId do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'wont set any callbacks' do
|
18
|
-
expect(Pony.
|
18
|
+
expect(Pony._create_callbacks.select {|cb| cb.filter == :set_identifier}).to be_empty
|
19
19
|
end
|
20
20
|
|
21
21
|
describe 'when #identify_with is called' do
|
22
22
|
subject { LittlePony.new }
|
23
23
|
|
24
24
|
it 'inserts the #set_identifier callback' do
|
25
|
-
expect(LittlePony.
|
25
|
+
expect(LittlePony._create_callbacks.select {|cb| cb.filter == :set_identifier}).to have(1).item
|
26
26
|
end
|
27
27
|
|
28
28
|
describe '#to_param' do
|
@@ -52,6 +52,18 @@ describe MadId do
|
|
52
52
|
it 'will set the identifier upon create' do
|
53
53
|
expect{ subject.save! }.to change{ subject.identifier }.from(nil)
|
54
54
|
end
|
55
|
+
|
56
|
+
describe 'persisted object' do
|
57
|
+
subject { LittlePony.create }
|
58
|
+
|
59
|
+
it 'will not set the identifier upon update' do
|
60
|
+
expect{ subject.save! }.not_to change{ subject.reload.identifier }
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'makes identifier readonly' do
|
64
|
+
expect{ subject.update(identifier: 'FOOBAR')}.not_to change{ subject.reload.identifier }
|
65
|
+
end
|
66
|
+
end
|
55
67
|
end
|
56
68
|
|
57
69
|
end
|