Skip to content

Implement custom Rspec matcher for ROP main classes

MR: Implement custom rop rspec matcher (!153367 - merged)

Description

The following discussion from !147718 (merged) should be addressed:

  • @pslaughter started a discussion: (+2 comments)

    I'm assuming this pipeline is covered by an integration test, and we already have Result unit tested, and these individual functions are unit tested. As far as creator_spec coverage goes, from a unit test perspective, I think we're mostly concerned about:

    To assert that the Railway was created and executed as expected, it'd be nice to have helpers like:

    expect_railway_to_have_been_called(
      PersonalAccessTokenCreator.method(:create),
      WorkspaceCreator.method(:create),
      WorkspaceVariablesCreator.method(:create)
    ).with(init_value).and_return(Result.ok(updated_value))

    Then we can greatly reduce the amount of test code here and in other places. WDYT? I think simplifying the testability is one of the best wins we get with ROP.

See entire thread for a more detailed discussion.

See https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/remote_development/README.md#railway-oriented-programming-and-the-result-class for more context on ROP.

Acceptance Criteria

Technical Requirements

Impact Assessment

Improves developer productivity and happiness by making ROP tests easier to write, understand, and maintain.

Edited by Safwan Ahmed