add qunit to autospec

This commit is contained in:
Régis Hanol
2013-11-01 23:57:50 +01:00
parent e679ba97a3
commit b56b11d96a
18 changed files with 921 additions and 571 deletions

View File

@ -0,0 +1,43 @@
module Autospec
class RspecRunner < BaseRunner
WATCHERS = {}
def self.watch(pattern, &blk); WATCHERS[pattern] = blk; end
def watchers; WATCHERS; end
# Discourse specific
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/components/#{m[1]}_spec.rb" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.+)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^spec/support/.+\.rb$}) { "spec" }
watch("app/controllers/application_controller.rb") { "spec/controllers" }
# Capybara request specs
watch(%r{^app/views/(.+)/.+\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
# Fabrication
watch(%r{^spec/fabricators/.+_fabricator\.rb$}) { "spec" }
RELOADERS = Set.new
def self.reload(pattern); RELOADERS << pattern; end
def reloaders; RELOADERS; end
# We need to reload the whole app when changing any of these files
reload('spec/spec_helper.rb')
reload('config/(.*).rb')
reload('app/helpers/(.*).rb')
def failed_specs
specs = []
path = './tmp/rspec_result'
specs = File.readlines(path) if File.exist?(path)
specs
end
end
end