Class: Aruba::Initializers::MiniTestInitializer

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

Overview

Add aruba + minitest to project

Instance Method Summary collapse

Instance Method Details

#create_exampleObject



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/aruba/initializer.rb', line 167

def create_example
  create_file 'test/use_aruba_with_minitest.rb', "$LOAD_PATH.unshift File.expand_path('../test', __FILE__)\n\nrequire 'test_helper'\nrequire 'minitest/autorun'\nrequire 'aruba/api'\n\nclass FirstRun < Minitest::Test\n  include Aruba::Api\n\n  def setup\n    aruba_setup\n  end\nend\n"
end

#create_helperObject



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/aruba/initializer.rb', line 146

def create_helper
  file =  'test/test_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