Skip to content

Commit 636303b

Browse files
authored
Add RSpec warnings file, and fix small issues (#425)
* Add an RSpec configuration file and enable warnings. * Drop unused variables in test * Avoid "unary plus" warning * Avoid "ambiguity" warning * Fix test's quoting Reinstate meaning of test: double quotes carry meaning here.
1 parent 7730ee5 commit 636303b

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

.rspec

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--require spec_helper
2+
--warnings

spec/sitemap_generator/adapters/google_storage_adapter_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
shared_examples 'writes the raw data to a file and then uploads that file to Google Storage' do |acl|
1111
it 'writes the raw data to a file and then uploads that file to Google Storage' do
12-
bucket = double(:bucket)
1312
storage = double(:storage)
1413
bucket_resource = double(:bucket_resource)
1514
expect(Google::Cloud::Storage).to receive(:new).with(credentials: 'abc', project_id: 'project_id').and_return(storage)

spec/sitemap_generator/builder/sitemap_url_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ def new_url(*args)
9090

9191
it 'should not fail if invalid characters are used in the URL' do
9292
special = ':$&+,;:=?@'
93-
url = SitemapGenerator::Builder::SitemapUrl.new('/#{special}', :host => 'http://example.com/#{special}/')
94-
expect(url[:loc]).to eq('http://example.com/#{special}/#{special}')
93+
url = SitemapGenerator::Builder::SitemapUrl.new("/#{special}", :host => "http://example.com/#{special}/")
94+
expect(url[:loc]).to eq("http://example.com/#{special}/#{special}")
9595
end
9696

9797
describe 'w3c_date' do

spec/sitemap_generator/core_ext/numeric_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def numeric(size)
1515
numeric(1).kilobyte ** 4 => numeric( 1).terabyte,
1616
numeric(1024).kilobytes + numeric(2).megabytes => numeric(3).megabytes,
1717
numeric( 2).gigabytes / 4 => numeric(512).megabytes,
18-
numeric(256).megabytes * 20 +numeric( 5).gigabytes => numeric(10).gigabytes,
18+
numeric(256).megabytes * 20 + numeric( 5).gigabytes => numeric(10).gigabytes,
1919
numeric(1).kilobyte ** 5 => numeric(1).petabyte,
2020
numeric(1).kilobyte ** 6 => numeric(1).exabyte
2121
}

spec/sitemap_generator/sitemaps/mobile_sitemap_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
it 'should add the mobile sitemap element' do
66
loc = 'http://www.example.com/mobile_page.html'
7-
format = 'html'
87

98
mobile_xml_fragment = SitemapGenerator::Builder::SitemapUrl.new('mobile_page.html',
109
:host => 'http://www.example.com',

spec/support/xml_macros.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ def gzipped_xml_file_should_have_minimal_whitespace(xml_gz_filename)
5454
end
5555

5656
def xml_data_should_have_minimal_whitespace(xml_data)
57-
expect(xml_data).not_to match /^\s/
58-
expect(xml_data).not_to match /\s$/
59-
expect(xml_data).not_to match /\s\s+/
60-
expect(xml_data).not_to match /\s[<>]/
61-
expect(xml_data).not_to match /[<>]\s/
57+
expect(xml_data).not_to match(/^\s/)
58+
expect(xml_data).not_to match(/\s$/)
59+
expect(xml_data).not_to match(/\s\s+/)
60+
expect(xml_data).not_to match(/\s[<>]/)
61+
expect(xml_data).not_to match(/[<>]\s/)
6262
end
6363
end

0 commit comments

Comments
 (0)