Class: Tuev::TestSuite

Inherits:
Object
  • Object
show all
Defined in:
lib/tuev/tuev.rb

Instance Method Summary collapse

Constructor Details

#initialize(test_suite_config) ⇒ TestSuite

Returns a new instance of TestSuite.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/tuev/tuev.rb', line 42

def initialize(test_suite_config)
  begin
    @test_file_template = File.join(Tuev.cwd, test_suite_config["test_file_template"])
  rescue
    raise "could not find 'test_file_template' setting for current suite"
  end

  @jquery_js       = file_url(Tuev.contrib_dir, "jquery-1.5.1.js")
  @mockjax_js      = file_url(Tuev.contrib_dir, "jquery.mockjax.js")
  @qunit_js        = file_url(Tuev.contrib_dir, "qunit.js")
  @tuev_qunit_js   = file_url(Tuev.contrib_dir, "tuev_qunit.js")
  @qunit_css       = file_url(Tuev.contrib_dir, "qunit.css")
  @test_suite_name = test_suite_config["name"]

  @combine_tests   =  test_suite_config["combine_tests"]

  @test_set = @tests   = build_file_list(test_suite_config["test_files"])

  @dependencies = build_file_list(test_suite_config["dependencies"])
end

Instance Method Details

#create_test_filesObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/tuev/tuev.rb', line 63

def create_test_files
  files = []
  if ENV['COMBINE_TESTS'] == 'true' || (ENV['COMBINE_TESTS'] != 'false' && @combine_tests)
    files << File.join(out_path, "#{@test_suite_name}.html")

    @test_set_name = title_from_filename(files.last)
    @test_set = @tests
    save(render_template(@tests), files.last)
  else
    @tests.each do |test|
      files << File.join(out_path, "#{@test_suite_name}_#{test.gsub('file://','').gsub(Tuev.cwd, '').tr('/.','_')}.html")

      @test_set_name = title_from_filename(files.last)
      @test_set = [test]
      save(render_template(test), files.last)
    end
  end

  files
end