How I could test I18n html keys with the rspec steak gem?
feature 'about page - not signed in user' do
background do
visit '/about'
end
scenario 'visit about page' do
page.should have_content(I18n.t("pages.about.headline_html"))
page.should have_content(I18n.t("pages.about.body_html"))
end
end
I always get following:
..FF
Failures:
1) about page - not signed in user visit about page
Failure/Error: page.should have_content(I18n.t("pages.about.headline_html"))
expected there to be content "<h1>About</h1>" in "About"
Anybody an idea?
I already tried:
page.should have_content(I18n.t("pages.about.headline_html").html_safe)
EDIT: If I include
include ActionView::Helpers::SanitizeHelper
into my feature and I do like that:
headline = strip_tags(I18n.t("pages.about.headline_html"))
body = strip_tags(I18n.t("pages.about.body_html"))
page.should have_content(headline)
page.should have_content(body)
everything works.
What do you think about this solution? Seems to be a bit hacky I think..