Module: RSpecWatcher

Defined in:
lib/rspec-watcher.rb,
lib/rspec_watcher/railtie.rb,
lib/rspec_watcher/version.rb

Defined Under Namespace

Classes: Railtie

Constant Summary collapse

SPEC_INFERRER =
->(_modified, _added, _removed) { [] }
PATH_INFERRER =
->(path) { Rails.root.join(path) }
RELOADER =
-> { Rails.application.reloader.reload! }
VERSION =
'0.3.2'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.path_inferrerObject

Returns the value of attribute path_inferrer.



19
20
21
# File 'lib/rspec-watcher.rb', line 19

def path_inferrer
  @path_inferrer
end

.reloaderObject

Returns the value of attribute reloader.



19
20
21
# File 'lib/rspec-watcher.rb', line 19

def reloader
  @reloader
end

.rulesObject (readonly)

Returns the value of attribute rules.



20
21
22
# File 'lib/rspec-watcher.rb', line 20

def rules
  @rules
end

Class Method Details

.configure(&block) ⇒ Object



22
23
24
25
26
# File 'lib/rspec-watcher.rb', line 22

def configure(&block)
  @rules = []
  @failed_specs = []
  instance_exec(&block)
end

.startObject



33
34
35
# File 'lib/rspec-watcher.rb', line 33

def start
  listeners.each(&:start)
end

.watch(path, **options, &inferrer) ⇒ Object



28
29
30
31
# File 'lib/rspec-watcher.rb', line 28

def watch(path, **options, &inferrer)
  inferrer ||= SPEC_INFERRER
  rules << [path, options, inferrer]
end