mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 05:29:17 -06:00
70bb2aa426
This refactors handling of s3 so it can be specified via GlobalSetting This means that in a multisite environment you can configure s3 uploads without actual sites knowing credentials in s3 It is a critical setting for situations where assets are mirrored to s3.
46 lines
1.5 KiB
Ruby
46 lines
1.5 KiB
Ruby
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" }
|
|
|
|
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" }
|
|
|
|
watch(%r{^app/views/(.+)/.+\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
|
|
|
watch(%r{^spec/fabricators/.+_fabricator\.rb$}) { "spec" }
|
|
|
|
watch(%r{^app/assets/javascripts/pretty-text/.*\.js\.es6$}) { "spec/components/pretty_text_spec.rb" }
|
|
watch(%r{^plugins/.*/discourse-markdown/.*\.js\.es6$}) { "spec/components/pretty_text_spec.rb" }
|
|
|
|
watch(%r{^plugins/.*/spec/.*\.rb})
|
|
|
|
RELOADERS = Set.new
|
|
def self.reload(pattern); RELOADERS << pattern; end
|
|
def reloaders; RELOADERS; end
|
|
|
|
# we are using a simple runner at the moment, whole idea of using a reloader is no longer needed
|
|
watch("spec/rails_helper.rb")
|
|
watch(%r{config/.+\.rb})
|
|
#reload(%r{app/helpers/.+\.rb})
|
|
|
|
def failed_specs
|
|
specs = []
|
|
path = './tmp/rspec_result'
|
|
specs = File.readlines(path) if File.exist?(path)
|
|
specs
|
|
end
|
|
|
|
end
|
|
|
|
end
|