Sha256: ee062738881e2007bc67951ed97b8b318a09ebea53fe950a797a63549cc3452a

Contents?: true

Size: 662 Bytes

Versions: 10

Compression:

Stored size: 662 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 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
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rubysmith-7.9.0 lib/rubysmith/builders/rspec/context.rb
rubysmith-7.8.0 lib/rubysmith/builders/rspec/context.rb
rubysmith-7.7.0 lib/rubysmith/builders/rspec/context.rb
rubysmith-7.6.0 lib/rubysmith/builders/rspec/context.rb
rubysmith-7.5.0 lib/rubysmith/builders/rspec/context.rb
rubysmith-7.4.0 lib/rubysmith/builders/rspec/context.rb
rubysmith-7.3.0 lib/rubysmith/builders/rspec/context.rb
rubysmith-7.2.0 lib/rubysmith/builders/rspec/context.rb
rubysmith-7.1.0 lib/rubysmith/builders/rspec/context.rb
rubysmith-7.0.0 lib/rubysmith/builders/rspec/context.rb