Skip to content

Commit

Permalink
Deprecate Capybara.exact_options
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed Nov 19, 2017
1 parent e7ed2a1 commit 4bde730
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/capybara/session/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class SessionConfig
# See {Capybara.configure}
#@!method save_path
# See {Capybara.configure}
#@deprecated
#@!method exact_options
# See {Capybara.configure}
#@!method asset_host
Expand Down Expand Up @@ -90,6 +91,13 @@ def save_and_open_page_path=(path)
@save_and_open_page_path = path
end

remove_method :exact_options=
def exact_options=(opt)
@exact_options = opt
warn "DEPRECATED: #exact_options is deprecated, please scope your findes/actions and use the `:exact` "\
"option if similar functionality is needed."
end

def initialize_copy(other)
super
@server_errors = @server_errors.dup
Expand Down
1 change: 1 addition & 0 deletions lib/capybara/spec/session/select_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
end

it "should not allow selecting options where they are the only inexact match if `Capybara.exact_options = true`" do
expect_any_instance_of(Kernel).to receive(:warn).with(/^DEPRECATED:/)
Capybara.exact_options = true
expect do
@session.select("Mis", from: 'Title')
Expand Down
4 changes: 3 additions & 1 deletion lib/capybara/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def reset!
Capybara.default_max_wait_time = 1
Capybara.ignore_hidden_elements = true
Capybara.exact = false
Capybara.exact_options = false
# `exact_options` is deprecated - set instancce var directly so we
# don't generate message every reset
Capybara.send(:config).session_options.instance_variable_set('@exact_options', false)
Capybara.raise_server_errors = true
Capybara.visible_text_only = false
Capybara.match = :smart
Expand Down

0 comments on commit 4bde730

Please sign in to comment.