Class: Aruba::Initializers::RSpecInitializer

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

Overview

Add aruba + rspec to project

Instance Method Summary collapse

Instance Method Details

#create_helperObject



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/aruba/initializer.rb', line 75

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

  send creator, file, "$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)\n\nif RUBY_VERSION < '1.9.3'\n  ::Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }\n  ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }\nelse\n  ::Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f }\n  ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }\nend\n"
end

#create_support_fileObject



96
97
98
99
100
# File 'lib/aruba/initializer.rb', line 96

def create_support_file
  create_file 'spec/support/aruba.rb', "require 'aruba/rspec'\n"
end