Skip to content

Use instance_double in tests

Albert Salim requested to merge use-instance-double into master

Since we stub the instance methods in processor tests such as follows, we may inadvertently miss out implementing the methods in the class. Using instance_double adds assurance that the methods exist in the actual object.

  let(:event) do
    instance_double('Triage::Event',
      from_gitlab_org?: true,
      added_label_names: added_label_names,
      user: { 'username' => Triage::Event::ENG_PROD_TEAM_USERNAMES.first },
      noteable_path: '/foo')
  end
Edited by Albert Salim

Merge request reports