Skip to content

Any way to keep the original source clean? #73

@tk3369

Description

@tk3369

Let's say I have a function that looks like this:

function do_something_useful(a, b, c)
    d = @mock(first_part(a, b))
    if @mock(second_part(c, d))
        @mock(third_part())
    else
        @mock(forth_part())
    end
end

As you can see, I have to put @mock everywhere if I want to be able to patch all of them. The trouble is that the code does not look clean anymore. Would it be possible to do something like:

@mockfuns first_part second_part third_part forth_path 

@mock function do_something_useful(a, b, c)
    d = first_part(a, b)
    if second_part(c, d)
        third_part()
    else
        forth_part()
    end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions