-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.watchr
45 lines (36 loc) · 905 Bytes
/
.watchr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
def run_spec(file)
puts "\n\n------------------------------------------------\n"
unless File.exist?(file)
puts "#{file} does not exist"
return
end
puts "Running #{file}"
system "bundle exec rspec #{file}"
puts
end
def run_cucumber(file)
puts "\n\n=================================================\n"
unless File.exist?(file)
puts "#{file} does not exist"
return
end
puts "Running #{file}"
system "bundle exec cucumber --drb #{file}"
puts
end
watch("app/(.*/.*).rb") do |match|
run_spec %{spec/#{match[1]}_spec.rb}
end
watch("app/views/(.*).html.erb") do |match|
file = match[0].gsub(/app\//, "")
run_spec "spec/#{file}_spec.rb"
end
watch("spec/.*/*_spec.rb") do |match|
run_spec match[0]
end
watch("features/(.*).feature") do |match|
run_cucumber( match[0])
end
watch("features/(.*/.*).feature") do |match|
run_cucumber( match[0])
end