Class: Aruba::Initializers::RSpecInitializer

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

Overview

RSpec Initializer. Adds aruba + rspec to project

Instance Method Summary collapse

Instance Method Details

#create_helperObject



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/aruba/initializer.rb', line 73

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



89
90
91
92
93
# File 'lib/aruba/initializer.rb', line 89

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