Sha256: 73c158c7498d88f2b6eac0a4b26a584e68de9243f7e6749226b86d334360de4c

Contents?: true

Size: 788 Bytes

Versions: 6

Compression:

Stored size: 788 Bytes

Contents

# frozen_string_literal: true

module Rubysmith
  module Builders
    module RSpec
      # Builds RSpec spec helper for project skeleton.
      class Helper
        def self.call realm, builder: Builder
          new(realm, builder: builder).call
        end

        def initialize realm, builder: Builder
          @realm = realm
          @builder = builder
        end

        def call
          return unless realm.build_rspec

          builder.call(realm.with(template_path: "%project_name%/spec/spec_helper.rb.erb"))
                 .render
                 .replace(/\n{3,}/, "\n\n")
                 .replace("  require", "require")
                 .replace("  Simple", "Simple")
        end

        private

        attr_reader :realm, :builder
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubysmith-0.5.0 lib/rubysmith/builders/rspec/helper.rb
rubysmith-0.4.0 lib/rubysmith/builders/rspec/helper.rb
rubysmith-0.3.0 lib/rubysmith/builders/rspec/helper.rb
rubysmith-0.2.0 lib/rubysmith/builders/rspec/helper.rb
rubysmith-0.1.1 lib/rubysmith/builders/rspec/helper.rb
rubysmith-0.1.0 lib/rubysmith/builders/rspec/helper.rb