class Datamapper4Rails::IntegrationTest
Attributes
directory[RW]
generator_args[RW]
rails_template[RW]
Public Class Methods
new() { |self| ... }
click to toggle source
# File lib/datamapper4rails/integration_test.rb, line 10 def initialize @ruby = RUBY_PLATFORM =~ /java/ ? 'jruby' : 'ruby' @directory = 'tmp' @generator_args = [] @rails_template = 'datamapper_rails_templates.rb' yield self if block_given? execute end
Public Instance Methods
execute()
click to toggle source
# File lib/datamapper4rails/integration_test.rb, line 23 def execute FileUtils.rm_rf(@directory) run("-S rails _2.3.8_ -fm #{rails_template} #{directory}") FileUtils.cd(@directory) do @generator_args.each do |arg| run("script/generate #{arg}") end run("-S rake spec") #run("-S rake test:units") end end
generate(*args)
click to toggle source
# File lib/datamapper4rails/integration_test.rb, line 19 def generate(*args) @generator_args << args.join(" ") end
run(command)
click to toggle source
# File lib/datamapper4rails/integration_test.rb, line 36 def run(command) unless system("#{@ruby} #{command}") puts puts "error in: #{@ruby} #{command}" exit 1 end end