{"action":"created","issue":{"url":"https://api.github.com/repos/natritmeyer/site_prism/issues/108","labels_url":"https://api.github.com/repos/natritmeyer/site_prism/issues/108/labels{/name}","comments_url":"https://api.github.com/repos/natritmeyer/site_prism/issues/108/comments","events_url":"https://api.github.com/repos/natritmeyer/site_prism/issues/108/events","html_url":"https://github.com/natritmeyer/site_prism/pull/108","id":65124733,"number":108,"title":"Update the system to more carefully combine arguments.","user":{"login":"RealNobody","id":358891,"avatar_url":"https://avatars.githubusercontent.com/u/358891?v=3","gravatar_id":"","url":"https://api.github.com/users/RealNobody","html_url":"https://github.com/RealNobody","followers_url":"https://api.github.com/users/RealNobody/followers","following_url":"https://api.github.com/users/RealNobody/following{/other_user}","gists_url":"https://api.github.com/users/RealNobody/gists{/gist_id}","starred_url":"https://api.github.com/users/RealNobody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RealNobody/subscriptions","organizations_url":"https://api.github.com/users/RealNobody/orgs","repos_url":"https://api.github.com/users/RealNobody/repos","events_url":"https://api.github.com/users/RealNobody/events{/privacy}","received_events_url":"https://api.github.com/users/RealNobody/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-30T03:04:59Z","updated_at":"2015-03-30T15:28:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/natritmeyer/site_prism/pulls/108","html_url":"https://github.com/natritmeyer/site_prism/pull/108","diff_url":"https://github.com/natritmeyer/site_prism/pull/108.diff","patch_url":"https://github.com/natritmeyer/site_prism/pull/108.patch"},"body":"I like the options to pass parameters into the finders.\r\n\r\nThis allows me to create a definition like this:\r\n\r\n```\r\nclass MyPage < SitePrism::Page\r\n  elements :my_elements, \".my-class\"\r\nend\r\n```\r\n\r\nThen, if I have a `MyPage` object I can do something like:\r\n\r\n```\r\nmy_page.my_elements(minimum: 12) # only return success if there are at least 12 items.\r\n```\r\n\r\nThe problem I ran into is if I had the following definitions:\r\n\r\n```\r\nclass MyPage < SitePrism::Page\r\n  elements :my_visible_elements, \".my-class\"\r\n  elements :my_possible_elements, \".my-class\", visible: false\r\nend\r\n```\r\n\r\nNow, if I make this call, I don't get my expected results:\r\n\r\n```\r\nmy_page.my_possible_elements(minimum: 12) # not quite right - will be the same as my_page.my_visible_elements(minimum: 12)\r\n```\r\n\r\nInstead, I would have to do:\r\n\r\n```\r\nmy_page.my_possible_elements(minimum: 12, visible: false)\r\n```\r\n\r\nBut this means that I have to know what the options were that were a part of the element definition.\r\n\r\nThis change merges the sets of values in the element definition with the values passed in to the defined object such that there is only one options hash that is a merge of the two.\r\n\r\nThis would now allow:\r\n\r\n```\r\nmy_page.my_possible_elements(minimum: 12) # now, the options is { visible: false, minimum: 12 }\r\n```"},"comment":{"url":"https://api.github.com/repos/natritmeyer/site_prism/issues/comments/87722993","html_url":"https://github.com/natritmeyer/site_prism/pull/108#issuecomment-87722993","issue_url":"https://api.github.com/repos/natritmeyer/site_prism/issues/108","id":87722993,"user":{"login":"RealNobody","id":358891,"avatar_url":"https://avatars.githubusercontent.com/u/358891?v=3","gravatar_id":"","url":"https://api.github.com/users/RealNobody","html_url":"https://github.com/RealNobody","followers_url":"https://api.github.com/users/RealNobody/followers","following_url":"https://api.github.com/users/RealNobody/following{/other_user}","gists_url":"https://api.github.com/users/RealNobody/gists{/gist_id}","starred_url":"https://api.github.com/users/RealNobody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RealNobody/subscriptions","organizations_url":"https://api.github.com/users/RealNobody/orgs","repos_url":"https://api.github.com/users/RealNobody/repos","events_url":"https://api.github.com/users/RealNobody/events{/privacy}","received_events_url":"https://api.github.com/users/RealNobody/received_events","type":"User","site_admin":false},"created_at":"2015-03-30T15:28:58Z","updated_at":"2015-03-30T15:28:58Z","body":"> it was a known/accepted flaw\r\n\r\nThis implementation also has a minor \"flaw\" in that it always passes in options to the find functions.  That is if I had the definition `element :my_element, \"#my_element_definition_param\"`, instead of calling:  `find(\"#my_element_definition_param\")`, it will call `find(\"#my_element_definition_param\", {})`  (it always adds a blank `{}` options hash param).\r\n\r\nSince we're \"only\" calling the Capybara finder functions, I know that this isn't a problem.  If I were building this more generically, I would normally put in some extra code to ensure that we don't pass a hash unless one of the two original arrays had a hash.\r\n\r\nFor this use, it didn't seem to really be necessary."}}