[rspec-users] Using has_selector to identify responses.
aslak.hellesoy at gmail.com
Tue Jan 13 16:58:15 EST 2009
On Tue, Jan 13, 2009 at 10:11 PM, James Byrne <lists at ruby-forum.com> wrote:
> This is more of a "best practices" question.
I'll describe a practice that has worked well for me.
(I stopped believing in best practices several years ago :-))
> Earlier, when I was trying to understand what it was I was supposed to
> be testing with cucumber, I was advised that I should test for text
> elements contained in the response body of the expected output. Now,
> what I am wondering is how one accounts for multilingual implementation.
> I have hit upon the idea of simply adding special css id selectors to
> the templates that identify their use. So, for example, instead of
> looking for the word "Registration" I would look for a css selector
> I know that this will work but, is there another, preferred, way of
> handling this situation?
I'm developing a multilingual app now. Based on the user's preferences it
will display UI elements (text, links etc) in either Norwegian, Nynorsk (Neo
Norwegian) or** Sámi (the 3 official languages in Norway).
We use Webrat, and for the Cucumber Scenarios we have chosen one arbitrary
language - Norwegian. (Actually, it's not that arbitrary - it's what all the
developers speak and write). In order to make the scenarios readable for the
stakeholders we prefer to refer to use the visible text instead of the DOM
id or names. (This also verifies that the <label> tags have properly
corresponding "for" attributes). So we say (translated):
When I fill in "Drammensveien 1" for "Address (work)"
This is much better than
When I fill in "Drammensveien 1" for "user_work_address"
So what about the other languages? We don't even think about them in 95% of
the Cucumber features. We have one feature file that just verifies that we
get Sámi UI instead of Norwegian when the user sets preferences to that
language. This is to verify that the language switching logic works ok. We
also have a few RSpec specs to verify the same down at the ActiveRecord and
> Posted via http://www.ruby-forum.com/.
> rspec-users mailing list
> rspec-users at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users