Class: Rubysmith::Builders::RSpec::Context

Inherits:
Abstract
  • Object
show all
Defined in:
lib/rubysmith/builders/rspec/context.rb

Overview

Builds RSpec shared context for temporary directories.

Instance Method Summary collapse

Methods inherited from Abstract

#initialize

Constructor Details

This class inherits a constructor from Rubysmith::Builders::Abstract

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rubysmith/builders/rspec/context.rb', line 12

def call
  return false unless settings.build_rspec

  template = "%project_name%/spec/support/shared_contexts/temp_dir.rb.erb"
  settings.merge(template_path: template)
          .then { |updated_configuration| builder.call updated_configuration }
          .render
          .replace(/\n\s+\n\s+/, "\n  ")

  true
end