immutability 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 +7 -7
- data/CHANGELOG.md +14 -0
- data/lib/immutability/version.rb +1 -1
- data/spec/support/immutable.rb +26 -5
- metadata +49 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f8d657925469b79af0254ac672766659aad0406d
|
4
|
+
data.tar.gz: 9f00806f764b8f16ae948453f212347d29d0939d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 77ba2967808ef4d0ef6904209edd9ef490dc171de94f55933d80e816305320c0118f65540c375bdba416139f76d548b1b9477f3da9e84a0875247f6c7b12a7f3
|
7
|
+
data.tar.gz: f2bad0c884a0591e27c44d6dc5df7a2ff4eacbddb007afbb668f1a33ecfb6b323151b6e84670296162c4e968bec098f1e282160b6a48362fc59ac4965a1d1054
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## v0.0.3 2015-09-25
|
2
|
+
|
3
|
+
The patch fixes bug in matcher that broke gems:
|
4
|
+
- 'abstract_mapper',
|
5
|
+
- 'query_builder'
|
6
|
+
- 'attributes_dsl'
|
7
|
+
in rbx (nepalez)
|
8
|
+
|
9
|
+
### Bugs fixed
|
10
|
+
|
11
|
+
- Bug in rspec matcher `be_immutable` for rbx arrays and hashes (nepalez)
|
12
|
+
|
13
|
+
[Compare v0.0.2...v0.0.3](https://github.com/nepalez/immutability/compare/v0.0.2...v0.0.3)
|
14
|
+
|
1
15
|
## v0.0.2 2015-09-24
|
2
16
|
|
3
17
|
The version fixes some bugs and adds `#at` method fild past states of objects with memory.
|
data/lib/immutability/version.rb
CHANGED
data/spec/support/immutable.rb
CHANGED
@@ -8,15 +8,36 @@
|
|
8
8
|
# @api public
|
9
9
|
#
|
10
10
|
RSpec::Matchers.define :be_immutable do
|
11
|
+
def can_be_frozen?(value)
|
12
|
+
return false if value.is_a? Module
|
13
|
+
return false if value.nil?
|
14
|
+
return false if value.equal? true
|
15
|
+
return false if value.equal? false
|
16
|
+
return false if !value.class.respond_to?(:new)
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
11
20
|
match do |instance|
|
12
|
-
if
|
21
|
+
if can_be_frozen? instance
|
13
22
|
expect(instance).to be_frozen
|
14
|
-
|
15
|
-
|
16
|
-
|
23
|
+
end
|
24
|
+
|
25
|
+
if instance.is_a? Hash
|
26
|
+
instance.each do |k, v|
|
27
|
+
expect(k).to be_immutable
|
28
|
+
expect(v).to be_immutable
|
29
|
+
end
|
17
30
|
else
|
18
|
-
|
31
|
+
instance.instance_variables.each do |ivar|
|
32
|
+
expect(instance.instance_variable_get(ivar)).to be_immutable
|
33
|
+
end
|
34
|
+
|
35
|
+
if instance.respond_to? :each
|
36
|
+
instance.each { |item| expect(item).to be_immutable }
|
37
|
+
end
|
19
38
|
end
|
39
|
+
|
40
|
+
expect(true).to be_truthy
|
20
41
|
end
|
21
42
|
|
22
43
|
failure_message do |instance|
|
metadata
CHANGED
@@ -1,58 +1,53 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: immutability
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Andrew Kozin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
|
12
|
+
date: 2015-09-24 00:00:00 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
14
15
|
name: ice_nine
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.11.1
|
20
|
-
type: :runtime
|
21
16
|
prerelease: false
|
22
|
-
|
23
|
-
requirements:
|
24
|
-
- -
|
25
|
-
- !ruby/object:Gem::Version
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
26
21
|
version: 0.11.1
|
27
|
-
|
22
|
+
type: :runtime
|
23
|
+
version_requirements: *id001
|
24
|
+
- !ruby/object:Gem::Dependency
|
28
25
|
name: hexx-rspec
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.5'
|
34
|
-
type: :development
|
35
26
|
prerelease: false
|
36
|
-
|
37
|
-
requirements:
|
38
|
-
- -
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version:
|
27
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ~>
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: "0.5"
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id002
|
41
34
|
description:
|
42
35
|
email: andrew.kozin@gmail.com
|
43
36
|
executables: []
|
37
|
+
|
44
38
|
extensions: []
|
45
|
-
|
39
|
+
|
40
|
+
extra_rdoc_files:
|
46
41
|
- README.md
|
47
42
|
- LICENSE
|
48
|
-
files:
|
49
|
-
-
|
50
|
-
-
|
51
|
-
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
43
|
+
files:
|
44
|
+
- .coveralls.yml
|
45
|
+
- .gitignore
|
46
|
+
- .metrics
|
47
|
+
- .rspec
|
48
|
+
- .rubocop.yml
|
49
|
+
- .travis.yml
|
50
|
+
- .yardopts
|
56
51
|
- CHANGELOG.md
|
57
52
|
- Gemfile
|
58
53
|
- Guardfile
|
@@ -83,34 +78,37 @@ files:
|
|
83
78
|
- spec/unit/immutability/with_memory_spec.rb
|
84
79
|
- spec/unit/immutability_spec.rb
|
85
80
|
homepage: https://github.com/nepalez/immutability
|
86
|
-
licenses:
|
81
|
+
licenses:
|
87
82
|
- MIT
|
88
83
|
metadata: {}
|
84
|
+
|
89
85
|
post_install_message:
|
90
86
|
rdoc_options: []
|
91
|
-
|
87
|
+
|
88
|
+
require_paths:
|
92
89
|
- lib
|
93
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
95
92
|
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
93
|
+
- !ruby/object:Gem::Version
|
97
94
|
version: 1.9.3
|
98
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
100
97
|
- - ">="
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version:
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: "0"
|
103
100
|
requirements: []
|
101
|
+
|
104
102
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.4.
|
103
|
+
rubygems_version: 2.4.6
|
106
104
|
signing_key:
|
107
105
|
specification_version: 4
|
108
106
|
summary: Make instances immutable (deeply frozen) and versioned
|
109
|
-
test_files:
|
107
|
+
test_files:
|
110
108
|
- spec/spec_helper.rb
|
111
109
|
- spec/unit/immutability_spec.rb
|
112
|
-
- spec/unit/immutability/object_spec.rb
|
113
|
-
- spec/unit/immutability/with_memory_spec.rb
|
114
110
|
- spec/support/immutable.rb
|
115
111
|
- spec/shared/user.rb
|
112
|
+
- spec/unit/immutability/object_spec.rb
|
113
|
+
- spec/unit/immutability/with_memory_spec.rb
|
116
114
|
has_rdoc:
|