Skip to content

Commit e4f0d30

Browse files
authored
fix typo in error message (#2292)
1 parent a07f4a4 commit e4f0d30

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/view_component/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def method_missing(method_name, *args) # rubocop:disable Style/MissingRespondToM
251251
raise e, <<~MESSAGE.chomp if view_context && e.is_a?(NameError) && helpers.respond_to?(method_name)
252252
#{e.message}
253253
254-
You may be trying to call a method provided as a view helper. Did you mean `helpers.#{method_name}'?
254+
You may be trying to call a method provided as a view helper. Did you mean `helpers.#{method_name}`?
255255
MESSAGE
256256

257257
raise

test/sandbox/test/base_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_no_method_error_does_not_reference_helper_if_view_context_not_present
122122
exception_message_regex = Regexp.new <<~MESSAGE.chomp, Regexp::MULTILINE
123123
undefined method `current_user' for .*
124124
125-
You may be trying to call a method provided as a view helper. Did you mean `helpers.current_user'?
125+
You may be trying to call a method provided as a view helper. Did you mean `helpers.current_user`?
126126
MESSAGE
127127
assert !exception_message_regex.match?(exception.message)
128128
end
@@ -135,15 +135,15 @@ def current_user
135135
end
136136
}
137137
exception = assert_raises(NameError) { ReferencesMethodOnHelpersComponent.new.render_in(view_context) }
138-
exception_advice = "You may be trying to call a method provided as a view helper. Did you mean `helpers.current_user'?"
138+
exception_advice = "You may be trying to call a method provided as a view helper. Did you mean `helpers.current_user`?"
139139
assert exception.message.include?(exception_advice)
140140
end
141141

142142
def test_no_method_error_does_not_reference_missing_helper
143143
view_context = ActionController::Base.new.view_context
144144
exception = assert_raises(NameError) { ReferencesMethodOnHelpersComponent.new.render_in(view_context) }
145145
exception_message_regex = Regexp.new <<~MESSAGE.chomp
146-
You may be trying to call a method provided as a view helper\\. Did you mean `helpers.current_user'\\?$
146+
You may be trying to call a method provided as a view helper\\. Did you mean `helpers.current_user`\\?$
147147
MESSAGE
148148
assert !exception_message_regex.match?(exception.message)
149149
end

0 commit comments

Comments
 (0)