Skip to content

Commit

Permalink
Fix spec
Browse files Browse the repository at this point in the history
  • Loading branch information
alpaca-tc committed Mar 28, 2024
1 parent 979cc9a commit f22385f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spec/diverdown/web_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ def app
end

describe 'GET /' do
around do |example|
index_path = File.join(Diverdown::Web::WEB_DIR, 'index.html')
file_exist = File.exist?(index_path)

unless file_exist
# index.html is generated by `pnpn run build`
FileUtils.mkdir_p(Diverdown::Web::WEB_DIR)
FileUtils.touch(index_path)
end

example.run
ensure
File.delete(index_path) unless file_exist
end

it 'returns body' do
get '/'
expect(last_response.status).to eq(200)
Expand Down

0 comments on commit f22385f

Please sign in to comment.