File: language.rb

package info (click to toggle)
ruby-rubocop-rspec 2.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,892 kB
  • sloc: ruby: 22,283; makefile: 4
file content (37 lines) | stat: -rw-r--r-- 830 bytes parent folder | download
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
37
# frozen_string_literal: true

module RuboCop
  module RSpec
    module FactoryBot
      # Contains node matchers for common FactoryBot DSL.
      module Language
        extend RuboCop::NodePattern::Macros

        METHODS = %i[
          attributes_for
          attributes_for_list
          attributes_for_pair
          build
          build_list
          build_pair
          build_stubbed
          build_stubbed_list
          build_stubbed_pair
          create
          create_list
          create_pair
          generate
          generate_list
          null
          null_list
          null_pair
        ].to_set.freeze

        # @!method factory_bot?(node)
        def_node_matcher :factory_bot?, <<~PATTERN
          (const {nil? cbase} {:FactoryGirl :FactoryBot})
        PATTERN
      end
    end
  end
end