Skip to content

Commit

Permalink
Add RSpec warnings file, and fix small issues (#425)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
olleolleolle authored Nov 11, 2024
1 parent 7730ee5 commit 636303b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--require spec_helper
--warnings
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

shared_examples 'writes the raw data to a file and then uploads that file to Google Storage' do |acl|
it 'writes the raw data to a file and then uploads that file to Google Storage' do
bucket = double(:bucket)
storage = double(:storage)
bucket_resource = double(:bucket_resource)
expect(Google::Cloud::Storage).to receive(:new).with(credentials: 'abc', project_id: 'project_id').and_return(storage)
Expand Down
4 changes: 2 additions & 2 deletions spec/sitemap_generator/builder/sitemap_url_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def new_url(*args)

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

describe 'w3c_date' do
Expand Down
2 changes: 1 addition & 1 deletion spec/sitemap_generator/core_ext/numeric_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def numeric(size)
numeric(1).kilobyte ** 4 => numeric( 1).terabyte,
numeric(1024).kilobytes + numeric(2).megabytes => numeric(3).megabytes,
numeric( 2).gigabytes / 4 => numeric(512).megabytes,
numeric(256).megabytes * 20 +numeric( 5).gigabytes => numeric(10).gigabytes,
numeric(256).megabytes * 20 + numeric( 5).gigabytes => numeric(10).gigabytes,
numeric(1).kilobyte ** 5 => numeric(1).petabyte,
numeric(1).kilobyte ** 6 => numeric(1).exabyte
}
Expand Down
1 change: 0 additions & 1 deletion spec/sitemap_generator/sitemaps/mobile_sitemap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

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

mobile_xml_fragment = SitemapGenerator::Builder::SitemapUrl.new('mobile_page.html',
:host => 'http://www.example.com',
Expand Down
10 changes: 5 additions & 5 deletions spec/support/xml_macros.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def gzipped_xml_file_should_have_minimal_whitespace(xml_gz_filename)
end

def xml_data_should_have_minimal_whitespace(xml_data)
expect(xml_data).not_to match /^\s/
expect(xml_data).not_to match /\s$/
expect(xml_data).not_to match /\s\s+/
expect(xml_data).not_to match /\s[<>]/
expect(xml_data).not_to match /[<>]\s/
expect(xml_data).not_to match(/^\s/)
expect(xml_data).not_to match(/\s$/)
expect(xml_data).not_to match(/\s\s+/)
expect(xml_data).not_to match(/\s[<>]/)
expect(xml_data).not_to match(/[<>]\s/)
end
end

0 comments on commit 636303b

Please sign in to comment.