spec/capybara_spec.rb in capybara-2.7.1 vs spec/capybara_spec.rb in capybara-2.8.0

- old
+ new

@@ -75,9 +75,43 @@ server = lambda {|app, port|} Capybara.server(&server) expect(Capybara.server).to eq(server) end end + + describe 'app_host' do + after do + Capybara.app_host = nil + end + + it "should warn if not a valid URL" do + expect { Capybara.app_host = "www.example.com" }.to raise_error(ArgumentError, /Capybara\.app_host should be set to a url/) + end + + it "should not warn if a valid URL" do + expect { Capybara.app_host = "http://www.example.com" }.not_to raise_error + end + + it "should not warn if nil" do + expect { Capybara.app_host = nil }.not_to raise_error + end + end + + describe 'default_host' do + around do |test| + old_default = Capybara.default_host + test.run + Capybara.default_host = old_default + end + + it "should warn if not a valid URL" do + expect { Capybara.default_host = "www.example.com" }.to raise_error(ArgumentError, /Capybara\.default_host should be set to a url/) + end + + it "should not warn if a valid URL" do + expect { Capybara.default_host = "http://www.example.com" }.not_to raise_error + end + end end RSpec.describe Capybara::Session do context 'with non-existant driver' do it "should raise an error" do