configurations 1.3.1 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/lib/configurations.rb +1 -1
- data/lib/configurations/configuration.rb +3 -1
- data/test/configurations/test_configuration.rb +20 -0
- metadata +1 -2
- data/.ruby-version +0 -1
data/.gitignore
CHANGED
data/lib/configurations.rb
CHANGED
@@ -75,7 +75,9 @@ module Configurations
|
|
75
75
|
# Respond to missing according to the method_missing implementation
|
76
76
|
#
|
77
77
|
def respond_to_missing?(method, include_private = false)
|
78
|
-
|
78
|
+
(_is_writer?(method) && @_writeable && _configurable?(property)) ||
|
79
|
+
(!_is_writer?(method) && @_writeable || _configured?(method)) ||
|
80
|
+
::Kernel.respond_to?(method, include_private) || super
|
79
81
|
end
|
80
82
|
|
81
83
|
# Set the configuration to writeable or read only. Access to writer methods is only allowed within the
|
@@ -114,4 +114,24 @@ class TestConfiguration < Minitest::Test
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
+
def test_method_missing_on_kernel_method
|
118
|
+
assert_raises StandardError do
|
119
|
+
@configuration.raise StandardError
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_respond_to_missing_on_kernel_method
|
124
|
+
assert_equal true, @configuration.respond_to?(:puts)
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_method_missing_on_non_kernel_method
|
128
|
+
assert_raises NoMethodError do
|
129
|
+
@configuration.blabla
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_respond_to_missing_on_non_kernel_method
|
134
|
+
assert_equal false, @configuration.respond_to?(:bbaaaaa)
|
135
|
+
end
|
136
|
+
|
117
137
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configurations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -68,7 +68,6 @@ extensions: []
|
|
68
68
|
extra_rdoc_files: []
|
69
69
|
files:
|
70
70
|
- .gitignore
|
71
|
-
- .ruby-version
|
72
71
|
- .travis.yml
|
73
72
|
- Gemfile
|
74
73
|
- License.txt
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.9.3-p547
|