Class: Develry::Project::Initializer::Rspec

Inherits:
Develry::Project::Initializer show all
Defined in:
lib/develry/project/initializer/rspec.rb

Overview

Requires all shared specs in a project’s spec_helper Also installs a configurable unit test timeout

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize a new instance

Parameters:

  • project (Project)

    the project to initialize

  • unit_test_timeout (Numeric)

    the maximum time a single unit test can take



54
55
56
57
58
# File 'lib/develry/project/initializer/rspec.rb', line 54

def initialize(project)
  super
  @spec_root         = project.spec_root
  @unit_test_timeout = project.unit_test_timeout
end

Class Method Details

.call(project) ⇒ Rspec

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize RSpec for project

Parameters:

  • project (Project)

    the project to initialize

Returns:



23
24
25
# File 'lib/develry/project/initializer/rspec.rb', line 23

def self.call(project)
  new(project).call
end

.require_files(directory) ⇒ Object



11
12
13
# File 'lib/develry/project/initializer/rspec.rb', line 11

def self.require_files(directory)
  Develry.require_files(directory, SHARED_SPEC_PATTERN)
end

Instance Method Details

#callself

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Setup RSpec for Develry::Project::Initializer#project

Returns:

  • (self)


65
66
67
68
69
70
# File 'lib/develry/project/initializer/rspec.rb', line 65

def call
  require 'rspec'
  require_shared_spec_files
  enable_unit_test_timeout unless Develry.jit?
  self
end