jslint on json data
This commit is contained in:
parent
c7d7be6ed2
commit
a69ae2e4ab
|
@ -35,11 +35,11 @@ module Hydra #:nodoc:
|
|||
trace "Running file: #{file}"
|
||||
|
||||
output = ""
|
||||
if file =~ /_spec.rb$/
|
||||
if file =~ /_spec.rb$/i
|
||||
output = run_rspec_file(file)
|
||||
elsif file =~ /.feature$/
|
||||
elsif file =~ /.feature$/i
|
||||
output = run_cucumber_file(file)
|
||||
elsif file =~ /.js$/
|
||||
elsif file =~ /.js$/i or file =~ /.json$/i
|
||||
output = run_javascript_file(file)
|
||||
else
|
||||
output = run_test_unit_file(file)
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"var1": "something",
|
||||
"var2": "trailing comma",
|
||||
}
|
|
@ -43,6 +43,12 @@ class RunnerTest < Test::Unit::TestCase
|
|||
assert results =~ /Missing semicolon/
|
||||
end
|
||||
|
||||
should "run a json data file and find errors" do
|
||||
runner = Hydra::Runner.new(:io => File.new('/dev/null', 'w'))
|
||||
results = runner.run_file(json_file)
|
||||
assert results =~ /trailing comma/
|
||||
end
|
||||
|
||||
should "run two rspec tests" do
|
||||
runner = Hydra::Runner.new(:io => File.new('/dev/null', 'w'))
|
||||
runner.run_file(rspec_file)
|
||||
|
|
|
@ -46,6 +46,10 @@ class Test::Unit::TestCase
|
|||
def javascript_file
|
||||
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'js_file.js'))
|
||||
end
|
||||
|
||||
def json_file
|
||||
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'json_data.json'))
|
||||
end
|
||||
end
|
||||
|
||||
module Hydra #:nodoc:
|
||||
|
|
Loading…
Reference in New Issue