Skip to content

E2E: Update all resource attributes when calling reload!

Andrejs Cunskis requested to merge acunskis-resource-objects-refactor into master

Description of the test

Properly support resource object creation and attribute reloads to better support importer tests where most of the objects get created on the Gitlab side and all of the attribute values need to be fetched rather than set during fabrication.

By naming convention reload! method should support that, yet it only updates the api objects and accessing value via custom attribute will not fetch updated value if it was already populated.

This MR enhances reload! behaviour and refactors Resource::Base in following ways:

  • Refactors Base class - separate instance methods from class methods with class << self
  • Removes Dsl subclass and simply create private attribute class method
  • Adds attributes method to create multiple attributes without a block
  • Updates custom attributes on reload! method call each time it is called
  • Adds init class method to create new instance of object without performing any api calls
  • Updates MergeRequest resource
    • Renames id to iid to be inline with api response.
    • Adds comments method
    • Removes reference to project.default_branch inside initialize block which is always fabricating new project since it is always still nil when new is called
  • Adds MR comment validation to Github importer tests
  • Update specs according to refactor
Edited by Andrejs Cunskis

Merge request reports