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

Restore mistakenly removed server= proc acceptance

This commit is contained in:
Thomas Walpole 2018-04-06 10:17:33 -07:00
parent c449772293
commit 8f115d94e0
3 changed files with 22 additions and 1 deletions

View file

@ -1,3 +1,10 @@
# Version 3.0.1
Release date: unreleased
### Changed
* Restored ability for `Capybara.server=` to accept a proc which was accidentally removed in 3.0.0
# Version 3.0.0
Release date: 2018-04-05

View file

@ -53,7 +53,9 @@ module Capybara
#
def server=(name)
name, options = *name if name.is_a? Array
@server = if options
@server = if name.respond_to? :call
name
elsif options
proc { |app, port, host| Capybara.servers[name.to_sym].call(app, port, host, options) }
else
Capybara.servers[name.to_sym]

View file

@ -64,6 +64,18 @@ RSpec.describe Capybara do
end
end
describe "server=" do
after do
Capybara.server = :default
end
it "accepts a proc" do
server = ->(_app, _port) {}
Capybara.server = server
expect(Capybara.server).to eq server
end
end
describe 'app_host' do
after do
Capybara.app_host = nil