Testing sidecar translations with RSpec #1251
Answered
by
cpjmcquillan
cpjmcquillan
asked this question in
Q&A
-
Has anybody managed to load translations in tests when using the In tests I tend to include RSpec.configure do |config|
config.include ActionView::Helpers::TranslationHelper
end so I can do things like this. expect(page).to have_content(t("messages.show.title")) In ViewComponent unit tests I'd like to be able to do something similar. |
Beta Was this translation helpful? Give feedback.
Answered by
cpjmcquillan
Jan 20, 2022
Replies: 1 comment
-
I ended up defining a helper method for view component tests. def t(component, key, **options)
component.translate(key, **options)
end |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
cpjmcquillan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I ended up defining a helper method for view component tests.