natritmeyer/site_prism — pull request #34 by srawlins (2013-06-23 01:40:50+00:00)
Title: Add private versions of element, elements, section, and sections

Heyo,

My team saw that it was impossible to declare `elements` as private. For example:

```
class PageWithElement < SitePrism::Page
private
element :bob, 'a.b c.d'
end

page = PageWithElement.new
# page still responds to #bob, #has_bob?, etc.
```

We wanted the ability to declare certain elements as private, so they they cannot be interacted with from outside of the Page. Thus, outside code would not be able to call `page.bob.click` etc. We still wanted the helpers, such as `#has_bob?` to be always public though.

This PR adds `private_` versions of `element`, `elements`, `section`, and `sections`. Tests are included. In the end, this PR allows for the following:

```
class PageWithElement < SitePrism::Page
private_element :bob, 'a.b c.d'
end

page = PageWithElement.new
# page does not respond to #bob,
# but still responds to helpers: #has_bob?, etc.
```

Side note: I would have added `#private_iframe` as well, but there are currently no specs for `#iframe`, so I decided against it, for now.