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
When /^I visit the (?:root|home) page$/ do
When(/^I visit the (?:root|home) page$/) do
visit('/')
end
Then /^I should see "([^"]*)"$/ do |text|
Then(/^I should see "([^"]*)"$/) do |text|
expect(page).to have_content(text)
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)
end
When /^I use a matcher that fails$/ do
When(/^I use a matcher that fails$/) do
begin
expect(page).to have_css('h1#doesnotexist')
rescue StandardError, RSpec::Expectations::ExpectationNotMetError => e
@ -19,7 +19,7 @@ When /^I use a matcher that fails$/ do
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\")
end

View File

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

View File

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

View File

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

View File

@ -172,7 +172,7 @@ module Capybara
#
def current_path
# 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.
return nil if uri.nil?

View File

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<h1>Buttons</h1>
<button>Click me!</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">
<fieldset id="agent_fieldset">
<legend>Agent</legend>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<p>
<a href="/host">Relative 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">
<body>
<div>

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<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>
<p>count1</p>

View File

@ -1,4 +1,4 @@
<%# frozen_string_literal: true %>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<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>
<h1>This is a test</h1>

View File

@ -1,2 +1,2 @@
<%# frozen_string_literal: true %>
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">
<head>
<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>
<p id="for_foo">

View File

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

View File

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

View File

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

View File

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