Welcome to mirror list, hosted at ThFree Co, Russian Federation.

avoid_setup_spec.rb « rspec « gitlab « cop « rubocop « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f9226649f6597245199ba7c0cc3ce05b578bb2cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

require 'rubocop_spec_helper'

require_relative '../../../../../rubocop/cop/gitlab/rspec/avoid_setup'

RSpec.describe RuboCop::Cop::Gitlab::RSpec::AvoidSetup do
  context 'when calling let_it_be' do
    let(:source) do
      <<~SRC
        let_it_be(:user) { create(:user) }
        ^^^^^^^^^^^^^^^^ Avoid the use of `let_it_be` [...]
      SRC
    end

    it 'registers an offense' do
      expect_offense(source)
    end
  end

  context 'without readability issues' do
    let(:source) do
      <<~SRC
        it 'registers the user and sends them to a project listing page' do
          user_signs_up

          expect_to_see_account_confirmation_page
        end
      SRC
    end

    it 'does not register an offense' do
      expect_no_offenses(source)
    end
  end
end