mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
warn when the app passed doesnt respond to #call
This commit is contained in:
parent
ad439ba37f
commit
9fc3ad9735
2 changed files with 11 additions and 0 deletions
|
@ -67,6 +67,7 @@ module Capybara
|
|||
attr_accessor :synchronized
|
||||
|
||||
def initialize(mode, app=nil)
|
||||
raise ArgumentError, "The second parameter to Session::new should be a rack app if passed." if app && !app.respond_to?(:call)
|
||||
@mode = mode
|
||||
@app = app
|
||||
if Capybara.run_server and @app and driver.needs_server?
|
||||
|
|
10
spec/session_spec.rb
Normal file
10
spec/session_spec.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe Capybara::Session do
|
||||
it "verifies a passed app is a rack app" do
|
||||
expect do
|
||||
Capybara::Session.new(:unknown, { random: "hash"})
|
||||
end.to raise_error ArgumentError, "The second parameter to Session::new should be a rack app if passed."
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue