Commit 6bf1780a authored by Lin Jen-Shin's avatar Lin Jen-Shin

Add tests for relations and scopes, and setting

parent 016e1a29
......@@ -32,5 +32,16 @@ feature "Pipelines settings", feature: true do
expect(page).to have_button('Save changes', disabled: false)
expect(page).to have_field('Test coverage parsing', with: 'coverage_regex')
end
scenario 'updates auto_cancel_pending_pipelines' do
page.check('Auto-cancel redundant, pending pipelines')
click_on 'Save changes'
expect(page.status_code).to eq(200)
expect(page).to have_button('Save changes', disabled: false)
checkbox = find_field('project_auto_cancel_pending_pipelines')
expect(checkbox).to be_checked
end
end
end
......@@ -12,10 +12,12 @@ describe Ci::Pipeline, models: true do
it { is_expected.to belong_to(:project) }
it { is_expected.to belong_to(:user) }
it { is_expected.to belong_to(:auto_canceled_by) }
it { is_expected.to have_many(:statuses) }
it { is_expected.to have_many(:trigger_requests) }
it { is_expected.to have_many(:builds) }
it { is_expected.to have_many(:auto_canceled_pipelines) }
it { is_expected.to validate_presence_of :sha }
it { is_expected.to validate_presence_of :status }
......
......@@ -231,6 +231,18 @@ describe HasStatus do
end
end
describe '.created_or_pending' do
subject { CommitStatus.created_or_pending }
%i[created pending].each do |status|
it_behaves_like 'containing the job', status
end
%i[running failed success].each do |status|
it_behaves_like 'not containing the job', status
end
end
describe '.finished' do
subject { CommitStatus.finished }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment