Commit 7c174603 authored by Mark Lapierre's avatar Mark Lapierre Committed by Nikola Milojevic

Add undefined variable and use ! with destroy

parent d4322db9
# frozen_string_literal: true # frozen_string_literal: true
RSpec.shared_examples 'ci_cd_settings delegation' do RSpec.shared_examples 'ci_cd_settings delegation' do
let(:exclude_attributes) { [] }
context 'when ci_cd_settings is destroyed but project is not' do context 'when ci_cd_settings is destroyed but project is not' do
it 'allows methods delegated to ci_cd_settings to be nil', :aggregate_failures do it 'allows methods delegated to ci_cd_settings to be nil', :aggregate_failures do
project = create(:project) project = create(:project)
attributes = project.ci_cd_settings.attributes.keys - %w(id project_id) - exclude_attributes attributes = project.ci_cd_settings.attributes.keys - %w(id project_id) - exclude_attributes
project.ci_cd_settings.destroy project.ci_cd_settings.destroy!
project.reload project.reload
attributes.each do |attr| attributes.each do |attr|
method = project.respond_to?("ci_#{attr}") ? "ci_#{attr}" : attr method = project.respond_to?("ci_#{attr}") ? "ci_#{attr}" : attr
......
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