[QA] better page object explanation, colon confusion

Željko Filipin zfilipin at wikimedia.org
Mon Oct 27 15:48:25 UTC 2014


On Sat, Oct 25, 2014 at 6:37 AM, S Page <spage at wikimedia.org> wrote:

> E.g. https://github.com/cheezy/page-object/wiki/Elements has
>
>   button(:your_name, :id => 'an_id')
>
> but our features/support/foo_page.rb files have e.g.
>
>   h1(:first_heading, id: "firstHeading")
>
> is this Ruby strangeness, or just supporting alternative syntaxes?
>

`:id => 'an_id'` and `id: "firstHeading"` are Ruby hashes. The former is
the Ruby 1.8 syntax (hash rocket), the latter is Ruby 1.9+ syntax.

More information:

https://github.com/bbatsov/ruby-style-guide#no-mixed-hash-syntaces

RuboCop is instructed to allow both, at the moment. Example for Flow:

https://github.com/wikimedia/mediawiki-extensions-Flow/blob/master/.rubocop_todo.yml#L61-L65

Željko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.wikimedia.org/pipermail/qa/attachments/20141027/d69f56de/attachment.html>


More information about the QA mailing list