Skip to content

Commit b67ae4d

Browse files
committed
Merge pull request #1277 from totothink/master
rename @config_context to @config_class
2 parents bdbb2e4 + 2907ed1 commit b67ae4d

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

lib/grape/dsl/settings.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def namespace_setting(key, value = nil)
7171

7272
# (see #unset_global_setting)
7373
def unset_namespace_setting(key)
74-
unset :namespace_setting, key
74+
unset :namespace, key
7575
end
7676

7777
# (see #global_setting)
@@ -106,7 +106,7 @@ def api_class_setting(key, value = nil)
106106

107107
# (see #unset_global_setting)
108108
def unset_api_class_setting(key)
109-
unset :api_class_setting, key
109+
unset :api_class, key
110110
end
111111

112112
# Fork our inheritable settings to a new instance, copied from our

lib/grape/util/strict_hash_configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def config_context
9898
new_config_class = config_class(*args)
9999

100100
class_mod.send(:define_method, :config_class) do
101-
@config_context ||= new_config_class
101+
@config_class ||= new_config_class
102102
end
103103
end
104104
end

spec/grape/dsl/settings_spec.rb

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ def reset_validations!; end
4242
end
4343
end
4444

45+
describe '#unset_global_setting' do
46+
it 'delegates to unset' do
47+
expect(subject).to receive(:unset).with(:global, :dummy)
48+
subject.unset_global_setting(:dummy)
49+
end
50+
end
51+
4552
describe '#route_setting' do
4653
it 'delegates to get_or_set' do
4754
expect(subject).to receive(:get_or_set).with(:route, :dummy, 1)
@@ -58,6 +65,13 @@ def reset_validations!; end
5865
end
5966
end
6067

68+
describe '#unset_route_setting' do
69+
it 'delegates to unset' do
70+
expect(subject).to receive(:unset).with(:route, :dummy)
71+
subject.unset_route_setting(:dummy)
72+
end
73+
end
74+
6175
describe '#namespace_setting' do
6276
it 'delegates to get_or_set' do
6377
expect(subject).to receive(:get_or_set).with(:namespace, :dummy, 1)
@@ -94,6 +108,13 @@ def reset_validations!; end
94108
end
95109
end
96110

111+
describe '#unset_namespace_setting' do
112+
it 'delegates to unset' do
113+
expect(subject).to receive(:unset).with(:namespace, :dummy)
114+
subject.unset_namespace_setting(:dummy)
115+
end
116+
end
117+
97118
describe '#namespace_inheritable' do
98119
it 'delegates to get_or_set' do
99120
expect(subject).to receive(:get_or_set).with(:namespace_inheritable, :dummy, 1)
@@ -120,6 +141,13 @@ def reset_validations!; end
120141
end
121142
end
122143

144+
describe '#unset_namespace_inheritable' do
145+
it 'delegates to unset' do
146+
expect(subject).to receive(:unset).with(:namespace_inheritable, :dummy)
147+
subject.unset_namespace_inheritable(:dummy)
148+
end
149+
end
150+
123151
describe '#namespace_stackable' do
124152
it 'delegates to get_or_set' do
125153
expect(subject).to receive(:get_or_set).with(:namespace_stackable, :dummy, 1)
@@ -146,13 +174,27 @@ def reset_validations!; end
146174
end
147175
end
148176

177+
describe '#unset_namespace_stackable' do
178+
it 'delegates to unset' do
179+
expect(subject).to receive(:unset).with(:namespace_stackable, :dummy)
180+
subject.unset_namespace_stackable(:dummy)
181+
end
182+
end
183+
149184
describe '#api_class_setting' do
150185
it 'delegates to get_or_set' do
151186
expect(subject).to receive(:get_or_set).with(:api_class, :dummy, 1)
152187
subject.api_class_setting(:dummy, 1)
153188
end
154189
end
155190

191+
describe '#unset_api_class_setting' do
192+
it 'delegates to unset' do
193+
expect(subject).to receive(:unset).with(:api_class, :dummy)
194+
subject.unset_api_class_setting(:dummy)
195+
end
196+
end
197+
156198
describe '#within_namespace' do
157199
it 'calls start and end for a namespace' do
158200
expect(subject).to receive :namespace_start

0 commit comments

Comments
 (0)