qunited 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/qunited/qunit_test_result.rb +3 -1
- data/lib/qunited/runner.rb +12 -2
- data/lib/qunited/version.rb +1 -1
- data/test/unit/test_runner.rb +7 -0
- metadata +1 -1
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
1
3
|
module QUnited
|
2
4
|
|
3
5
|
# Contains results data from a QUnit JavaScript test. Useful for passing data
|
@@ -34,7 +36,7 @@ module QUnited
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def self.from_json(json)
|
37
|
-
self.new clean_up_result(YAML.load(json))
|
39
|
+
self.new clean_up_result(::YAML.load(json))
|
38
40
|
end
|
39
41
|
|
40
42
|
attr_accessor :data
|
data/lib/qunited/runner.rb
CHANGED
@@ -57,13 +57,13 @@ module QUnited
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def get_driver(klass)
|
60
|
-
if
|
60
|
+
if known_driver_classes.include?(klass)
|
61
61
|
::QUnited::Driver.const_get(klass.to_s)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
def get_formatter(klass)
|
66
|
-
if
|
66
|
+
if known_formatter_classes.include?(klass)
|
67
67
|
::QUnited::Formatter.const_get(klass.to_s)
|
68
68
|
end
|
69
69
|
end
|
@@ -75,5 +75,15 @@ module QUnited
|
|
75
75
|
def confirm_existence_of_files(files_array)
|
76
76
|
files_array.each { |f| raise UsageError, "File not found: #{f}" unless File.exist? f }
|
77
77
|
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
def known_driver_classes
|
82
|
+
::QUnited::Driver.constants.map(&:to_sym).reject { |d| [:Base, :ResultsCollector].include? d }
|
83
|
+
end
|
84
|
+
|
85
|
+
def known_formatter_classes
|
86
|
+
::QUnited::Formatter.constants.map(&:to_sym).reject { |d| d == :Base }
|
87
|
+
end
|
78
88
|
end
|
79
89
|
end
|
data/lib/qunited/version.rb
CHANGED
data/test/unit/test_runner.rb
CHANGED
@@ -57,4 +57,11 @@ class TestRunner < MiniTest::Unit::TestCase
|
|
57
57
|
runner.resolve_driver_class
|
58
58
|
end
|
59
59
|
end
|
60
|
+
|
61
|
+
def test_get_driver_can_resolve_drivers
|
62
|
+
runner = QUnited::Runner.new(['source.js'], ['test.js'])
|
63
|
+
driver = runner.get_driver(:PhantomJs)
|
64
|
+
|
65
|
+
assert_equal QUnited::Driver::PhantomJs, driver
|
66
|
+
end
|
60
67
|
end
|