1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Remove Capybara.exact_options setting

This commit is contained in:
Thomas Walpole 2017-11-19 10:56:42 -08:00
parent c405ce5dc6
commit ddd1d7f401
7 changed files with 14 additions and 22 deletions

View file

@ -8,6 +8,13 @@ Release date: unreleased
* RSpec 2.x no longer supported
* Deprecated methods removed
* `first` now raises ElementNotFound by default instead of returning nil, when no matches are found - Issue #1507
* 'all' now waits for at least one matching element by default. Pass `wait: false` if you want the previous
behavior where an empty result would be returned immediately if no matching elements exist yet.
### Removed
* `Capybara.exact_options` no longer exists. Just use `exact:true` on relevant actions/finders if necessary.
# Version 2.17.0
Release date: 2018-01-02

View file

@ -27,12 +27,6 @@ module Capybara
warn "Unused parameters passed to #{self.class.name} : #{args}" unless args.empty?
# TODO: make this better somehow
# for compatibility with Capybara 2.0
if session_options.exact_options and @selector == Selector.all[:option]
@options[:exact] = true
end
@expression = @selector.call(@locator, @options.merge(enable_aria_label: session_options.enable_aria_label))
warn_exact_usage

View file

@ -5,7 +5,7 @@ module Capybara
class SessionConfig
OPTIONS = [:always_include_port, :run_server, :default_selector, :default_max_wait_time, :ignore_hidden_elements,
:automatic_reload, :match, :exact, :exact_text, :raise_server_errors, :visible_text_only,
:automatic_label_click, :enable_aria_label, :save_path, :exact_options, :asset_host, :default_host, :app_host,
:automatic_label_click, :enable_aria_label, :save_path, :asset_host, :default_host, :app_host,
:server_host, :server_port, :server_errors]
attr_accessor(*OPTIONS)
@ -37,9 +37,6 @@ module Capybara
# See {Capybara.configure}
#@!method save_path
# See {Capybara.configure}
#@deprecated
#@!method exact_options
# See {Capybara.configure}
#@!method asset_host
# See {Capybara.configure}
#@!method default_host

View file

@ -13,7 +13,7 @@ Capybara::SpecHelper.spec "#select" do
expect(@session.find_field('Title').value).to eq('Miss')
end
it "should allow selecting options where there are inexact matches" do
it "should allow selecting exact options where there are inexact matches" do
@session.select("Mr", from: 'Title')
expect(@session.find_field('Title').value).to eq('Mr')
end
@ -23,11 +23,10 @@ Capybara::SpecHelper.spec "#select" do
expect(@session.find_field('Title').value).to eq('Miss')
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
it "should not allow selecting options where they are the only inexact match if `exact: true` is specified" do
sel = @session.find(:select, 'Title')
expect do
@session.select("Mis", from: 'Title')
sel.select("Mis", exact: true)
end.to raise_error(Capybara::ElementNotFound)
end

View file

@ -24,9 +24,6 @@ module Capybara
Capybara.default_max_wait_time = 1
Capybara.ignore_hidden_elements = true
Capybara.exact = 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

View file

@ -10,8 +10,8 @@ RSpec.describe Capybara::SessionConfig do
[:default_host, :app_host, :always_include_port, :run_server,
:default_selector, :default_max_wait_time, :ignore_hidden_elements,
:automatic_reload, :match, :exact, :raise_server_errors, :visible_text_only,
:automatic_label_click, :enable_aria_label,
:save_path, :exact_options, :asset_host].each do |m|
:automatic_label_click, :enable_aria_label, :save_path,
:asset_host].each do |m|
expect(session.config.public_send(m)).to eq Capybara.public_send(m)
end
end

View file

@ -183,8 +183,6 @@ RSpec.describe Capybara::Server do
Capybara::Server.new(proc {|e|}).boot
end.to raise_error(RuntimeError, 'kaboom')
ensure
# TODO refactor out the defaults so it's reliant on unset state instead of
# a one-time call in capybara.rb
Capybara.server = :default
end
end