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

cleanup some warnings

This commit is contained in:
Thomas Walpole 2017-01-26 16:10:51 -08:00
parent ea68ce79a2
commit dbeec59726
30 changed files with 38 additions and 38 deletions

View file

@ -1,17 +1,17 @@
# frozen_string_literal: true # frozen_string_literal: true
When /^I visit the (?:root|home) page$/ do When(/^I visit the (?:root|home) page$/) do
visit('/') visit('/')
end end
Then /^I should see "([^"]*)"$/ do |text| Then(/^I should see "([^"]*)"$/) do |text|
expect(page).to have_content(text) expect(page).to have_content(text)
end end
Then /^Capybara should use the "([^"]*)" driver$/ do |driver| Then(/^Capybara should use the "([^"]*)" driver$/) do |driver|
expect(Capybara.current_driver).to eq(driver.to_sym) expect(Capybara.current_driver).to eq(driver.to_sym)
end end
When /^I use a matcher that fails$/ do When(/^I use a matcher that fails$/) do
begin begin
expect(page).to have_css('h1#doesnotexist') expect(page).to have_css('h1#doesnotexist')
rescue StandardError, RSpec::Expectations::ExpectationNotMetError => e rescue StandardError, RSpec::Expectations::ExpectationNotMetError => e
@ -19,7 +19,7 @@ When /^I use a matcher that fails$/ do
end end
end end
Then /^the failing exception should be nice$/ do Then(/^the failing exception should be nice$/) do
expect(@error_message).to match %r(expected to find css \"h1#doesnotexist\") expect(@error_message).to match %r(expected to find css \"h1#doesnotexist\")
end end

View file

@ -29,7 +29,7 @@ module Capybara
if @expected_path.is_a? Regexp if @expected_path.is_a? Regexp
@actual_path.match(@expected_path) @actual_path.match(@expected_path)
else else
::Addressable::URI.parse(@expected_path) == Addressable::URI.parse(@actual_path) ::Addressable::URI.parse(@expected_path) == ::Addressable::URI.parse(@actual_path)
end end
end end

View file

@ -42,7 +42,7 @@ module Capybara
def description def description
@description = String.new("#{label} #{locator.inspect}") @description = String.new("#{label} #{locator.inspect}")
@description << " with#{" exact" if exact_text === true} text #{options[:text].inspect}" if options[:text] @description << " with#{" exact" if exact_text == true} text #{options[:text].inspect}" if options[:text]
@description << " with exact text #{options[:exact_text]}" if options[:exact_text].is_a?(String) @description << " with exact text #{options[:exact_text]}" if options[:exact_text].is_a?(String)
@description << " with id #{options[:id]}" if options[:id] @description << " with id #{options[:id]}" if options[:id]
@description << " with classes #{Array(options[:class]).join(',')}]" if options[:class] @description << " with classes #{Array(options[:class]).join(',')}]" if options[:class]
@ -56,7 +56,7 @@ module Capybara
regexp = if options[:text].is_a?(Regexp) regexp = if options[:text].is_a?(Regexp)
options[:text] options[:text]
else else
if exact_text === true if exact_text == true
"\\A#{Regexp.escape(options[:text].to_s)}\\z" "\\A#{Regexp.escape(options[:text].to_s)}\\z"
else else
Regexp.escape(options[:text].to_s) Regexp.escape(options[:text].to_s)
@ -205,7 +205,7 @@ module Capybara
end end
def exact_text def exact_text
exact_text = options.fetch(:exact_text, Capybara.exact_text) options.fetch(:exact_text, Capybara.exact_text)
end end
end end
end end

View file

@ -8,12 +8,12 @@ Capybara::Selector::FilterSet.add(:_field) do
describe do |options| describe do |options|
desc, states = String.new, [] desc, states = String.new, []
states << 'checked' if options[:checked] || (options[:unchecked] === false) states << 'checked' if options[:checked] || (options[:unchecked] == false)
states << 'not checked' if options[:unchecked] || (options[:checked] === false) states << 'not checked' if options[:unchecked] || (options[:checked] == false)
states << 'disabled' if options[:disabled] == true states << 'disabled' if options[:disabled] == true
desc << " that is #{states.join(' and ')}" unless states.empty? desc << " that is #{states.join(' and ')}" unless states.empty?
desc << " with the multiple attribute" if options[:multiple] == true desc << " with the multiple attribute" if options[:multiple] == true
desc << " without the multiple attribute" if options[:multiple] === false desc << " without the multiple attribute" if options[:multiple] == false
desc desc
end end
end end

View file

@ -172,7 +172,7 @@ module Capybara
# #
def current_path def current_path
# Addressable parsing is more lenient than URI # Addressable parsing is more lenient than URI
uri = Addressable::URI.parse(current_url) uri = ::Addressable::URI.parse(current_url)
# If current_url ends up being nil, won't be able to call .path on a NilClass. # If current_url ends up being nil, won't be able to call .path on a NilClass.
return nil if uri.nil? return nil if uri.nil?

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<h1>Buttons</h1> <h1>Buttons</h1>
<button>Click me!</button> <button>Click me!</button>
<button id="click_me_123">Click me by id!</button> <button id="click_me_123">Click me by id!</button>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<form action="/form" method="post"> <form action="/form" method="post">
<fieldset id="agent_fieldset"> <fieldset id="agent_fieldset">
<legend>Agent</legend> <legend>Agent</legend>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<h1>Form</h1> <h1>Form</h1>
<form action="/form" method="post"> <form action="/form" method="post">

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html> <html>
<head> <head>
<title>This is the child frame title</title> <title>This is the child frame title</title>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html> <html>
<head> <head>
<title>This is the title of frame one</title> <title>This is the title of frame one</title>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html> <html>
<head> <head>
<title>This is the parent frame title</title> <title>This is the parent frame title</title>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html> <html>
<head> <head>
<title>This is the title of frame two</title> <title>This is the title of frame two</title>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<p> <p>
<a href="/get_header">Link</a> <a href="/get_header">Link</a>
</p> </p>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<p> <p>
<a href="/host">Relative Host</a> <a href="/host">Relative Host</a>
<a href="<%= params[:absolute_host] %>/host">Absolute Host</a> <a href="<%= params[:absolute_host] %>/host">Absolute Host</a>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<body> <body>
<div> <div>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html> <html>
<head> <head>
<title>Title of the first popup</title> <title>Title of the first popup</title>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html> <html>
<head> <head>
<title>Title of popup two</title> <title>Title of popup two</title>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<h1>Postback</h1> <h1>Postback</h1>
<form method="get"> <form method="get">

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<form action="/form" method="post"> <form action="/form" method="post">
<table id="agent_table"> <table id="agent_table">
<caption>Agent</caption> <caption>Agent</caption>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head> <head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/> <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<h1>This page is used for testing number options of has_text?</h1> <h1>This page is used for testing number options of has_text?</h1>
<p>count1</p> <p>count1</p>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head> <head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/> <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<div id="referrer"><%= referrer %></div> <div id="referrer"><%= referrer %></div>
<h1>This is a test</h1> <h1>This is a test</h1>

View file

@ -1,2 +1,2 @@
<%# frozen_string_literal: true %>
Encoding with &mdash; html entities &raquo; Encoding with &mdash; html entities &raquo;

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head> <head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/> <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<h1>This page is used for testing various scopes</h1> <h1>This page is used for testing various scopes</h1>
<p id="for_foo"> <p id="for_foo">

View file

@ -1,2 +1,2 @@
<%# frozen_string_literal: true %>
Bar Bar

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<title>Test Title</title> <title>Test Title</title>
<body> <body>
<svg><title>abcdefg</title></svg> <svg><title>abcdefg</title></svg>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html> <html>
<head> <head>
<title>With Windows</title> <title>With Windows</title>

View file

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html> <html>
<head> <head>
<title>With Frames</title> <title>With Frames</title>