Skip to content
  • Steve Azzopardi's avatar
    Refactor project.latest_successful_builds_for def · 50a1dd6a79ff
    Steve Azzopardi authored
    `project.latest_successful_builds_for(ref)` is being used to find a
    single job all the time. This results into us having to call `find_by`
    inside of the controller which violates our CodeReuse/ActiveRecord
    rubocop rule.
    
    Refactor `project.latest_successful_builds_for(ref)` to
    `project.latest_successful_build_for(job_name, ref)` which will execute
    the `find_by` inside of the model.
    
    Also create `project.latest_successful_build_for!(job_name, ref)` which
    raises an exception instead of returning nil.
    50a1dd6a79ff