Sha256: 41be50c74ce1d1a3c6290572b6f4a3987dee7cd874bad450ca652a6795aa0e49

Contents?: true

Size: 812 Bytes

Versions: 28

Compression:

Stored size: 812 Bytes

Contents

# frozen_string_literal: true

require "refinements/structs"

module Hanamismith
  module Builders
    module RSpec
      # Builds project skeleton RSpec application shared context.
      class ApplicationSharedContext
        using Refinements::Structs

        def self.call(...) = new(...).call

        def initialize configuration, builder: Rubysmith::Builder
          @configuration = configuration
          @builder = builder
        end

        def call
          return configuration unless configuration.build_rspec

          path = "%project_name%/spec/support/shared_contexts/application.rb.erb"
          builder.call(configuration.merge(template_path: path)).render

          configuration
        end

        private

        attr_reader :configuration, :builder
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
hanamismith-0.24.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.23.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.22.1 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.22.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.21.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.20.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.19.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.18.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.17.1 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.17.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.16.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.15.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.14.1 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.14.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.13.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.12.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.11.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.10.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.9.0 lib/hanamismith/builders/rspec/application_shared_context.rb
hanamismith-0.8.0 lib/hanamismith/builders/rspec/application_shared_context.rb