immutability 0.0.4 → 0.0.5
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/CHANGELOG.md +9 -1
- data/README.md +2 -1
- data/lib/immutability/version.rb +1 -1
- data/spec/support/frozen_double.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f099da696ee2965d0705383a8bfca47d89736b0d
|
4
|
+
data.tar.gz: 9af0b157ad8256d860d48233fbbe0c005838c13b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48b3e52146ebc88bb67d639ea32405e35aabca31104fa951c9d0a1c28e9a2182951a114782b702312095989316c9a39e202739b38f16ec1185bb12b8561838fa
|
7
|
+
data.tar.gz: ea4c83cee676dd5f39129dfe63428cd2bfd35aa447d4d6d1267606b92be0dd4d5e80a59e305d22904e2044f5b88d45562b036c5f2f59e24f40c1e39f1542e8ce
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
## v0.0.
|
1
|
+
## v0.0.5 to be released
|
2
|
+
|
3
|
+
### Bugs fixed
|
4
|
+
|
5
|
+
- `frozen_double` can be provided without options (nepalez)
|
6
|
+
|
7
|
+
[Compare v0.0.4...v0.0.5](https://github.com/nepalez/immutability/compare/v0.0.4...v0.0.5)
|
8
|
+
|
9
|
+
## v0.0.4 2015-10-09
|
2
10
|
|
3
11
|
The small release (backward-compatible) adds `frozen_double` to rspec helper methods.
|
4
12
|
|
data/README.md
CHANGED
@@ -162,7 +162,7 @@ The matcher will pass if both the object and all its variables are immutable at
|
|
162
162
|
|
163
163
|
### frozen_double
|
164
164
|
|
165
|
-
Initializers of immutable objects freeze
|
165
|
+
Initializers of immutable objects freeze variables deeply. When you use doubles as initializers' arguments, `RSpec` will complain. To avoid this problem, use `frozen_double` instead of `double`:
|
166
166
|
|
167
167
|
```ruby
|
168
168
|
include "immutability/rspec"
|
@@ -170,6 +170,7 @@ include "immutability/rspec"
|
|
170
170
|
describe User, "#name" do
|
171
171
|
subject { User.new(name, 44).name }
|
172
172
|
|
173
|
+
# the name can be used by the initializer safely
|
173
174
|
let(:name) { frozen_double :name, to_s: "Andrew" }
|
174
175
|
|
175
176
|
it { is_expected.to eql "Andrew" }
|
data/lib/immutability/version.rb
CHANGED
@@ -5,7 +5,7 @@ RSpec.configure do |config|
|
|
5
5
|
# Returns the double with +#frozen?+ and +#freeze+ methods defined
|
6
6
|
#
|
7
7
|
def frozen_double(*args)
|
8
|
-
options = args.
|
8
|
+
options = args.last.instance_of?(Hash) ? args.pop : {}
|
9
9
|
name = args.first
|
10
10
|
instance = double name, options.merge(frozen?: true)
|
11
11
|
allow(instance).to receive(:freeze).and_return(instance)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: immutability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kozin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ice_nine
|