jnicklas/capybara — pull request #1139 by carols10cents (2013-08-08 23:37:25+00:00)
Title: Allows passing options through has_button? to has_selector?

Hi capybara team! :heart:

I wanted to assert that there was a disabled button on a page, but I discovered that `has_button?` ignores disabled buttons. Then I found that finders take an option `:disabled`, and that `has_field?` passes options through so that you can do `has_field?(locator, :disabled => true)`. When I tried calling `has_button?("Button text", :disabled => true)` though, I got wrong number of arguments since `has_button?` doesn't currently pass an options hash through like `has_field?` does.

This pull request adds that functionality to `has_button?`, `has_no_button?`, and the associated RSpec matchers.

I noticed that `has_checked_field?`, `has_unchecked_field?` and their associated `no` methods are also missing an `options` argument-- I'd be happy to add that enhancement as well, but I wanted to make sure I was on the right track and that this was something you wanted to support before doing that.

Thank you!