Class: ProxyRb::Initializers::RSpecInitializer

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/proxy_rb/initializer.rb

Overview

Add proxy_rb + rspec to project

Instance Method Summary collapse

Instance Method Details

#create_helperObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/proxy_rb/initializer.rb', line 53

def create_helper
  file = 'spec/spec_helper.rb'
  creator = if File.exist? file
              :append_to_file
            else
              :create_file
            end

  send creator, file, <<~EOS
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)

  ::Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f }
  ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }
  EOS
end

#create_support_fileObject



69
70
71
72
73
# File 'lib/proxy_rb/initializer.rb', line 69

def create_support_file
  create_file 'spec/support/proxy_rb.rb', <<~EOS
  require 'proxy_rb/rspec'
  EOS
end