tuev 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tuev (0.3.2)
4
+ tuev (0.4.0)
5
5
  selenium-client
6
6
 
7
7
  GEM
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.4.0
data/contrib/tuev.yml CHANGED
@@ -2,6 +2,7 @@
2
2
  selenium:
3
3
  host: 'localhost' # host which runs selenium server
4
4
  port: '4444' # selenium server port (if you get connection refused, try 5555)
5
+ tests_out: '/tmp' # where your temporary files should be saved
5
6
  browsers:
6
7
  - '*firefox' # should work on most systems
7
8
  #- *googlechrome # ... can't get it to work on mac os x or linux
@@ -20,7 +21,7 @@ test_suites:
20
21
 
21
22
  # it should be there ... check it out, adjust it to your needs
22
23
  test_file_template: 'tests/tuev/contrib/test_default.html'
23
- combine_tests: false # whether to create one big test file or one pre js-test-file
24
+ combine_tests: true # whether to create one big test file or one pre js-test-file
24
25
  test_files:
25
26
  include: 'client/public/javascripts/tests/**/*.js' # Dir.glob-pattern
26
27
  exclude: 'mocks.js'
@@ -1,11 +1,15 @@
1
- QUnit.log = function(result_object, message) {
1
+ /* this snippet will save qunit test information in an object called
2
+ * window.results and window.errors .
3
+ * Use this in conjunction with tuev to get detailed testing output */
4
+
5
+ QUnit.log = function(result_object, qunit_message) {
2
6
  message = result_object.result ? "ok " : "FAILED ";
3
7
  message += result_object.message;
4
- if(!result_object.result){
8
+ if(!result_object.result && result_object.expected){
5
9
  message += "\n-----------------------8<-------------------------"
6
- message += "\nexpected: " + result_object.expected
7
- message += "\nbut got: " + result_object.actual
8
- message += "\nsource: " + result_object.source
10
+ message += "\nexpected: " + result_object.expected;
11
+ message += "\nbut got: " + result_object.actual;
12
+ message += "\nsource: " + result_object.source;
9
13
  message += "\n----------------------->8-------------------------\n"
10
14
  window.errors.push(message);
11
15
  }
data/lib/tuev/tuev.rb CHANGED
@@ -3,7 +3,21 @@ require 'erb'
3
3
  class Tuev
4
4
  @contrib_dir = "tests/tuev/contrib"
5
5
  class << self
6
- attr_accessor :cwd, :gem_path, :config, :contrib_dir
6
+ attr_accessor :cwd, :gem_path, :config, :contrib_dir, :read_config
7
+ end
8
+
9
+ def self.read_config
10
+ config_file = ENV['TUEV_CONFIG'] || File.join(Tuev.cwd, "config/tuev.yml")
11
+
12
+ if File.exists?(config_file)
13
+ @config = YAML.load_file(config_file)
14
+ else
15
+ raise "\n\nERROR: Can't find '#{config_file}' ... create it or set TUEV_CONFIG to point to a valid tuev.yml\n\n"
16
+ end
17
+ end
18
+
19
+ def self.config
20
+ return @config ||= read_config
7
21
  end
8
22
 
9
23
  def self.test_suites
@@ -13,7 +27,7 @@ class Tuev
13
27
  end
14
28
 
15
29
  def self.test_out
16
- File.expand_path(File.join(Tuev.cwd, "tests", "tuev", "test_files"))
30
+ config["tests_out"] || "/tmp" #File.expand_path(File.join(Tuev.cwd, "tests", "tuev", "test_files"))
17
31
  end
18
32
 
19
33
  def self.selenium_conf
@@ -40,14 +40,21 @@ class QunitRunner
40
40
  run_in_browser(browser_id) do |browser|
41
41
  browser.open "file://#{@test_file}"
42
42
  browser.wait_for_page_to_load "60000"
43
- puts "\n****** testing #{browser.get_text('css=title')} in #{browser_id}"
44
- puts "file:\n\t#{@test_file}\n\n"
43
+ puts "\ntesting: #{@test_file}\n\n"
45
44
  60.times{ break if (browser.is_element_present("id=qunit-testresult") rescue false); sleep 1 }
46
45
  sleep 1
47
- puts browser.get_eval('window.results.join("\n")')
48
- errors += browser.get_eval('window.errors.join("\n")')
46
+ if browser.get_eval("typeof(window.results)") == "undefined"
47
+ $stderr.puts "\tINFO: some lines of javascript will give you detailed testing output. For more info, see:"
48
+ $stderr.puts "\thttps://github.com/kesselborn/tuev/raw/master/contrib/tuev_qunit.js"
49
+ $stderr.puts
50
+ else
51
+ puts browser.get_eval('window.results.join("\n")')
52
+ errors += browser.get_eval('window.errors.join("\n")')
53
+ end
54
+
49
55
  60.times{ break if (browser.get_text('id=qunit-testresult') != "Running..." rescue false); sleep 1 }
50
56
  puts browser.get_text('id=qunit-testresult')
57
+ puts
51
58
  num_of_errors += browser.get_text("css=#qunit-testresult .failed").to_i
52
59
  end
53
60
  end
data/lib/tuev.rb CHANGED
@@ -11,5 +11,3 @@ else
11
11
  Dir["#{Tuev.gem_path}/lib/tasks/*.rake"].each { |ext| load ext }
12
12
  end
13
13
 
14
- config_file = File.join(Tuev.cwd, "config/tuev.yml")
15
- Tuev.config = YAML.load_file(config_file) if File.exists?(config_file)
data/tuev.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tuev}
8
- s.version = "0.3.2"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["kesselborn"]
12
- s.date = %q{2011-03-29}
12
+ s.date = %q{2011-04-14}
13
13
  s.default_executable = %q{tuev}
14
14
  s.description = %q{...}
15
15
  s.email = %q{daniel@soundcloud.com}
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: tuev
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.2
5
+ version: 0.4.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - kesselborn
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-29 00:00:00 +02:00
13
+ date: 2011-04-14 00:00:00 +02:00
14
14
  default_executable: tuev
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -153,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
153
  requirements:
154
154
  - - ">="
155
155
  - !ruby/object:Gem::Version
156
- hash: -1497357001173131428
156
+ hash: -612069244517957402
157
157
  segments:
158
158
  - 0
159
159
  version: "0"