Skip to content

Commit

Permalink
Merge pull request #261 from ifad/chore/fix-some-offences-in-non-prod
Browse files Browse the repository at this point in the history
Fix safe offences in non-production code
  • Loading branch information
tagliala authored Sep 13, 2024
2 parents 52268b4 + 75eb519 commit 2df81a9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 29 deletions.
16 changes: 0 additions & 16 deletions .rubocop_todo.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion spec/integration/callback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
# Simple sinatra app to receive and display callbacks
#
require 'pp'
require 'sinatra'

set :port, 9230
Expand Down
12 changes: 6 additions & 6 deletions spec/lib/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
let(:author) { 'spliffy' }

def show_backtrace response
if response.status == 500
begin
puts JSON.pretty_generate(JSON.parse response.body)
rescue StandardError => e
puts response.body
end
return unless response.status == 500

begin
puts JSON.pretty_generate(JSON.parse response.body)
rescue StandardError => e
puts response.body
end
end

Expand Down
12 changes: 6 additions & 6 deletions spec/lib/document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
it 'runs' do
dir = document.directory
expect(dir).to_not be_nil
expect(File.exists? dir).to eq true
expect(File.exist? dir).to eq true
end
end

Expand Down Expand Up @@ -131,7 +131,7 @@
it 'runs' do
version = document.new_version
expect(version).to_not be_nil
expect(File.exists? document.directory + version).to eq true
expect(File.exist? document.directory + version).to eq true
new_doc = described_class.load storage_dir, doc_key
expect(new_doc.versions.include? version).to eq true
end
Expand All @@ -142,21 +142,21 @@
file = __FILE__
body = File.read(file)
document.add_file 'v002', File.basename(file), body
expect(File.exists? document.directory + 'v002' + File.basename(file)).to eq true
expect(File.exist? document.directory + 'v002' + File.basename(file)).to eq true
end
it 'runs with author' do
file = __FILE__
body = File.read(file)
document.add_file 'v002', File.basename(file), body, author
expect(File.exists? document.directory + 'v002' + File.basename(file)).to eq true
expect(File.exists? document.directory + 'v002' + described_class::AUTHOR_FILE).to eq true
expect(File.exist? document.directory + 'v002' + File.basename(file)).to eq true
expect(File.exist? document.directory + 'v002' + described_class::AUTHOR_FILE).to eq true
expect(File.read(document.directory + 'v002' + described_class::AUTHOR_FILE).chomp).to eq author
end
it 'runs with IO for body' do
file = __FILE__
body = File.open(file)
document.add_file 'v002', File.basename(file), body
expect(File.exists? document.directory + 'v002' + File.basename(file)).to eq true
expect(File.exist? document.directory + 'v002' + File.basename(file)).to eq true
end
end

Expand Down

0 comments on commit 2df81a9

Please sign in to comment.