-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from kortirso/issue_17
IS-17 Testing
- Loading branch information
Showing
72 changed files
with
1,787 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Main CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
linters: | ||
name: Linters | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.2.0 | ||
|
||
- name: Install latest bundler | ||
run: | | ||
gem install bundler --no-document | ||
bundle config set without 'tools benchmarks docs' | ||
- name: Bundle install | ||
run: bundle install --jobs 4 --retry 3 | ||
|
||
- name: Run linters | ||
run: | | ||
bundle exec rubocop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--require rails_helper | ||
--format progress | ||
--color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# frozen_string_literal: true | ||
|
||
describe Que::View::JobsController do | ||
routes { Que::View::Engine.routes } | ||
|
||
describe 'GET#index' do | ||
it 'renders page' do | ||
get :index | ||
|
||
expect(response).to be_successful | ||
end | ||
end | ||
|
||
describe 'PATCH#update' do | ||
context 'for unexisting job' do | ||
it 'redirects to root_path' do | ||
patch :update, params: { id: 0 } | ||
|
||
expect(response).to redirect_to root_path | ||
end | ||
end | ||
|
||
context 'for existing job' do | ||
let!(:que_job) { create :que_job, run_at: 1.week.before, expired_at: 1.week.before } | ||
|
||
it 'redirects to root_path', :aggregate_failures do | ||
patch :update, params: { id: que_job.id } | ||
|
||
expect(que_job.reload.expired_at).to be_nil | ||
expect(response).to redirect_to root_path | ||
end | ||
end | ||
end | ||
|
||
describe 'POST#reschedule_all' do | ||
context 'for unexisting job' do | ||
it 'does not reschedule any job' do | ||
post :reschedule_all, params: { status: 'scheduled' } | ||
|
||
expect(response).to redirect_to jobs_path(status: 'scheduled') | ||
end | ||
end | ||
|
||
context 'for existing job' do | ||
let!(:scheduled_que_job) { create :que_job, run_at: nil } | ||
let!(:expired_que_job) { create :que_job, :expired } | ||
|
||
it 'reschedules jobs', :aggregate_failures do | ||
post :reschedule_all, params: { status: 'scheduled' } | ||
|
||
expect(scheduled_que_job.reload.run_at).not_to be_nil | ||
expect(expired_que_job.reload.expired_at).to be_nil | ||
expect(response).to redirect_to jobs_path(status: 'scheduled') | ||
end | ||
end | ||
end | ||
|
||
describe 'DELETE#destroy' do | ||
context 'for unexisting jobs' do | ||
it 'does not destroy any job', :aggregate_failures do | ||
expect { delete :destroy_all, params: { status: 'scheduled' } }.not_to change(QueJob, :count) | ||
expect(response).to redirect_to jobs_path(status: 'scheduled') | ||
end | ||
end | ||
|
||
context 'for existing jobs' do | ||
before do | ||
create :que_job | ||
create :que_job, :failing | ||
end | ||
|
||
it 'destroys jobs with specific status', :aggregate_failures do | ||
expect { delete :destroy_all, params: { status: 'scheduled' } }.to change(QueJob, :count).by(-1) | ||
expect(response).to redirect_to jobs_path(status: 'scheduled') | ||
end | ||
end | ||
end | ||
|
||
describe 'DELETE#destroy_all' do | ||
context 'with unexisting jobs' do | ||
it 'does not destroy any job', :aggregate_failures do | ||
expect { delete :destroy_all, params: { status: 'scheduled' } }.not_to change(QueJob, :count) | ||
expect(response).to redirect_to jobs_path(status: 'scheduled') | ||
end | ||
end | ||
|
||
context 'with existing jobs' do | ||
before do | ||
create :que_job | ||
create :que_job, :failing | ||
end | ||
|
||
it 'destroys jobs with specific status', :aggregate_failures do | ||
expect { delete :destroy_all, params: { status: 'scheduled' } }.to change(QueJob, :count).by(-1) | ||
expect(response).to redirect_to jobs_path(status: 'scheduled') | ||
end | ||
end | ||
end | ||
end |
22 changes: 22 additions & 0 deletions
22
spec/controllers/que/view/queue_metrics_controller_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
describe Que::View::QueueMetricsController do | ||
routes { Que::View::Engine.routes } | ||
|
||
describe 'GET#index' do | ||
context 'without authorization' do | ||
before do | ||
create :que_job | ||
create :que_job, :failing | ||
create :que_job, :finished | ||
create :que_job, :expired | ||
|
||
get :index | ||
end | ||
|
||
it 'renders page' do | ||
expect(response).to be_successful | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.