Sha256: d0ec61e0897d87a6c72921fcc4045f74956354c37def27576b49e7570cdef83d

Contents?: true

Size: 704 Bytes

Versions: 2

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true

require "refinements/struct"

module Rubysmith
  module Builders
    module RSpec
      # Builds RSpec shared context for temporary directories.
      class Context < Abstract
        using Refinements::Struct

        def call
          return configuration unless configuration.build_rspec

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

          configuration
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubysmith-6.10.0 lib/rubysmith/builders/rspec/context.rb
rubysmith-6.9.0 lib/rubysmith/builders/rspec/context.rb