mutant 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +6 -0
- data/config/flay.yml +1 -1
- data/lib/mutant/matcher/method/instance.rb +2 -2
- data/lib/mutant/subject/method/instance.rb +12 -0
- data/lib/mutant/version.rb +1 -1
- data/mutant.gemspec +1 -0
- data/spec/unit/mutant/subject/method/instance_spec.rb +28 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf574dc48496c63daaefac87f3603ba5b2c4703a
|
4
|
+
data.tar.gz: 2666871190b2b4788d9e216f3e3fe155833b6e00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b837342c26c28e970e5ff9784531fce12fd26fb30dde6ee7ef0f856910a44026891534468a488459b81e7e653167948c913ef13e0f5e6b01f16c7c45ab23413a
|
7
|
+
data.tar.gz: ff9190edab3e81f861e06767196b268327e690b22b1229b94296af49c596b3e057fc45ffc11471a9fe18730e42ee6dec176b03fab465bee3917c189bdb8fc84d
|
data/Changelog.md
CHANGED
data/config/flay.yml
CHANGED
@@ -7,7 +7,7 @@ module Mutant
|
|
7
7
|
class Instance < self
|
8
8
|
SUBJECT_CLASS = Subject::Method::Instance
|
9
9
|
|
10
|
-
# Dispatching builder, detects
|
10
|
+
# Dispatching builder, detects memoizable case
|
11
11
|
#
|
12
12
|
# @param [Cache] cache
|
13
13
|
# @param [Class, Module] scope
|
@@ -19,7 +19,7 @@ module Mutant
|
|
19
19
|
#
|
20
20
|
def self.build(cache, scope, method)
|
21
21
|
name = method.name
|
22
|
-
if scope.ancestors.include?(::
|
22
|
+
if scope.ancestors.include?(::Memoizable) and scope.memoized?(name)
|
23
23
|
return Memoized.new(cache, scope, method)
|
24
24
|
end
|
25
25
|
super
|
@@ -52,6 +52,18 @@ module Mutant
|
|
52
52
|
end
|
53
53
|
memoize :source
|
54
54
|
|
55
|
+
# Prepare subject for mutation insertion
|
56
|
+
#
|
57
|
+
# @return [self]
|
58
|
+
#
|
59
|
+
# @api private
|
60
|
+
#
|
61
|
+
def prepare
|
62
|
+
scope.send(:memoized_methods).instance_variable_get(:@memory).delete(name)
|
63
|
+
scope.send(:undef_method, name)
|
64
|
+
self
|
65
|
+
end
|
66
|
+
|
55
67
|
private
|
56
68
|
|
57
69
|
# Return mutations
|
data/lib/mutant/version.rb
CHANGED
data/mutant.gemspec
CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |gem|
|
|
31
31
|
gem.add_runtime_dependency('ice_nine', '~> 0.11.0')
|
32
32
|
gem.add_runtime_dependency('descendants_tracker', '~> 0.0.1')
|
33
33
|
gem.add_runtime_dependency('adamantium', '~> 0.2.0')
|
34
|
+
gem.add_runtime_dependency('memoizable', '~> 0.4.2')
|
34
35
|
gem.add_runtime_dependency('equalizer', '~> 0.0.7')
|
35
36
|
gem.add_runtime_dependency('inflecto', '~> 0.0.2')
|
36
37
|
gem.add_runtime_dependency('anima', '~> 0.2.0')
|
@@ -51,6 +51,34 @@ describe Mutant::Subject::Method::Instance::Memoized do
|
|
51
51
|
s(:def, :foo, s(:args))
|
52
52
|
end
|
53
53
|
|
54
|
+
describe '#prepare' do
|
55
|
+
|
56
|
+
let(:context) do
|
57
|
+
Mutant::Context::Scope.new(scope, double('Source Path'))
|
58
|
+
end
|
59
|
+
|
60
|
+
let(:scope) do
|
61
|
+
Class.new do
|
62
|
+
include Memoizable
|
63
|
+
def foo
|
64
|
+
end
|
65
|
+
memoize :foo
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
subject { object.prepare }
|
70
|
+
|
71
|
+
it 'undefines memoizer' do
|
72
|
+
expect { subject }.to change { scope.memoized?(:foo) }.from(true).to(false)
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'undefines method on scope' do
|
76
|
+
expect { subject }.to change { scope.instance_methods.include?(:foo) }.from(true).to(false)
|
77
|
+
end
|
78
|
+
|
79
|
+
it_should_behave_like 'a command method'
|
80
|
+
end
|
81
|
+
|
54
82
|
describe '#source' do
|
55
83
|
subject { object.source }
|
56
84
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ~>
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.2.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: memoizable
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.4.2
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ~>
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.4.2
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: equalizer
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|