mirror of
https://github.com/plashchynski/crono.git
synced 2026-04-22 08:48:38 +02:00
Lint the whole project
This commit is contained in:
@@ -1,44 +1,47 @@
|
||||
require "spec_helper"
|
||||
require "rack/test"
|
||||
require 'spec_helper'
|
||||
require 'rack/test'
|
||||
include Rack::Test::Methods
|
||||
|
||||
describe Crono::Web do
|
||||
let(:app) { Crono::Web }
|
||||
|
||||
before do
|
||||
@test_job_id = "Perform TestJob every 5 seconds"
|
||||
@test_job_log = "All runs ok"
|
||||
@test_job = Crono::CronoJob.create!(job_id: @test_job_id, log: @test_job_log)
|
||||
@test_job_id = 'Perform TestJob every 5 seconds'
|
||||
@test_job_log = 'All runs ok'
|
||||
@test_job = Crono::CronoJob.create!(
|
||||
job_id: @test_job_id,
|
||||
log: @test_job_log
|
||||
)
|
||||
end
|
||||
|
||||
after { @test_job.destroy }
|
||||
|
||||
describe "/" do
|
||||
it "should show all jobs" do
|
||||
describe '/' do
|
||||
it 'should show all jobs' do
|
||||
get '/'
|
||||
expect(last_response).to be_ok
|
||||
expect(last_response.body).to include @test_job_id
|
||||
end
|
||||
|
||||
it "should show a error mark when a job is unhealthy" do
|
||||
it 'should show a error mark when a job is unhealthy' do
|
||||
@test_job.update(healthy: false)
|
||||
get '/'
|
||||
expect(last_response.body).to include "Error"
|
||||
expect(last_response.body).to include 'Error'
|
||||
end
|
||||
end
|
||||
|
||||
describe "/job/:id" do
|
||||
it "should show job log" do
|
||||
describe '/job/:id' do
|
||||
it 'should show job log' do
|
||||
get "/job/#{@test_job.id}"
|
||||
expect(last_response).to be_ok
|
||||
expect(last_response.body).to include @test_job_id
|
||||
expect(last_response.body).to include @test_job_log
|
||||
end
|
||||
|
||||
it "should show a message about the unhealthy job" do
|
||||
it 'should show a message about the unhealthy job' do
|
||||
@test_job.update(healthy: false)
|
||||
get "/job/#{@test_job.id}"
|
||||
expect(last_response.body).to include "An error occurs during the last execution of this job"
|
||||
expect(last_response.body).to include 'An error occurs during the last execution of this job'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user