Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8936043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:07:29+00:00 2026-06-15T10:07:29+00:00

For integration testing, I check content of pages, to make sure user would see

  • 0

For integration testing, I check content of pages, to make sure user would see what I want.

For example:

it "shows list of articles" do
    get :articles
    response.body.should have_content("Articles found:")
end

Somewhere in articles view, there is this line:

<h1>Articles found:</h1>

I want to get rid of strings duplicity, make the code easier to maintain and tests more solid. I’m considering putting those strings into config/locales/en.yml and then do something like this

it "shows list of articles" do
    get :articles
    response.body.should have_content(I18n.t('title'))
end

and in the view:

<h1><%=t :title %></h1>

Does it make sense from long term perspective or is there a better/standardized way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:07:31+00:00Added an answer on June 15, 2026 at 10:07 am

    I wouldn’t, internationalized strings are meant for humans to read.

    As an alternative, see if you can structure the document in a way that makes asserting by selects more deterministic.

    it "shows list of articles" do
        get :articles
        assert_select "h1.articles-title"
    end
    

    And in the view.

    <h1 class="articles-title"><%=t :title %></h1>
    

    While I understand that your original test case asserts the presence of a correct title, I would argue that the greatest benefit for a general integration test like this is the presence of a title.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For integration testing I want to use selenium, also for my TDD/BDD workflow but
I want to create a unit test for integration testing. What class should I
I do some integration testing like this : def user.excel_import fixture_excel = fixture_file_upload('goodsins.xls', 'text/xls')
I'm new to integration testing, but have had great success so far buiding up
My question is for the JUnitServlet for integration testing in Adobe cq5. When it
I have recently started using RSpec for Integration testing in my Rails application, to
I learned basics of web-based integration testing using SpecFlow and WatiN. From what I
Basically what is happening is when I'm doing the integration testing in my rspec
I am trying to clear the cache for my integration testing. I could find
I have a central git repository that everyone pushes to for testing and integration,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.