delegate_matcher 0.4.1 → 0.4.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/Gemfile.lock +1 -1
- data/lib/delegate_matcher/version.rb +1 -1
- data/spec/to_a_class_variable_spec.rb +10 -11
- data/spec/to_a_constant_spec.rb +10 -10
- 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: 907400f6ff89ecfdf2e5b3d2be559badf3bd5732
|
4
|
+
data.tar.gz: 909ebfb8f6134e64fb9fd92166573da8ed41c69b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8901ccdeb2ce0543a88c55ada12f76862eec14bbbac6c7854f0f25aa9ae7fe030930d70d4588e588edf1f3c199c10fdc48ebc22940c6394ee8597639bda7ef4
|
7
|
+
data.tar.gz: cae4cd06519c5c6983be8cc1fb694715d58a1eba8ad965f7a62a68f889048bd3fc004b5b2f69b99534514a1b14e075e428c163db21e33470533fe4fe51a420ac
|
data/Gemfile.lock
CHANGED
@@ -4,34 +4,33 @@ module RSpec
|
|
4
4
|
module Matchers
|
5
5
|
module DelegateMatcher
|
6
6
|
describe 'delegation to a class variable' do
|
7
|
-
|
8
|
-
|
9
|
-
before(:all) do
|
10
|
-
class Post
|
7
|
+
let(:klass) do
|
8
|
+
Class.new do
|
11
9
|
include PostMethods
|
12
10
|
|
13
|
-
|
14
|
-
|
11
|
+
class_variable_set(:@@author, Author.new)
|
12
|
+
|
13
|
+
def author
|
14
|
+
self.class.class_variable_get(:@@author)
|
15
|
+
end
|
15
16
|
|
16
17
|
def name
|
17
|
-
|
18
|
+
author.name
|
18
19
|
end
|
19
20
|
|
20
21
|
def name_allow_nil
|
21
|
-
|
22
|
+
author.name if author
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
26
|
-
subject {
|
27
|
+
subject { klass.new }
|
27
28
|
|
28
29
|
let(:receiver) { :@@author }
|
29
30
|
|
30
31
|
it_behaves_like 'a basic delegator'
|
31
32
|
it_behaves_like 'a delegator without a nil check'
|
32
33
|
it_behaves_like 'a delegator with a nil check'
|
33
|
-
|
34
|
-
after(:all) { DelegateMatcher.module_eval { remove_const :Post } }
|
35
34
|
end
|
36
35
|
end
|
37
36
|
end
|
data/spec/to_a_constant_spec.rb
CHANGED
@@ -4,33 +4,33 @@ module RSpec
|
|
4
4
|
module Matchers
|
5
5
|
module DelegateMatcher
|
6
6
|
describe 'class delegation' do
|
7
|
-
|
8
|
-
|
9
|
-
before(:all) do
|
10
|
-
class Post
|
7
|
+
let(:klass) do
|
8
|
+
Class.new do
|
11
9
|
include PostMethods
|
12
10
|
|
13
|
-
AUTHOR
|
11
|
+
const_set(:AUTHOR, Author.new)
|
12
|
+
|
13
|
+
def author
|
14
|
+
self.class.const_get(:AUTHOR)
|
15
|
+
end
|
14
16
|
|
15
17
|
def name
|
16
|
-
|
18
|
+
author.name
|
17
19
|
end
|
18
20
|
|
19
21
|
def name_allow_nil
|
20
|
-
|
22
|
+
author.name if author
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
subject {
|
27
|
+
subject { klass.new }
|
26
28
|
|
27
29
|
let(:receiver) { :AUTHOR }
|
28
30
|
|
29
31
|
it_behaves_like 'a basic delegator'
|
30
32
|
it_behaves_like 'a delegator without a nil check'
|
31
33
|
it_behaves_like 'a delegator with a nil check'
|
32
|
-
|
33
|
-
after(:all) { DelegateMatcher.module_eval { remove_const :Post } }
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|