-
Notifications
You must be signed in to change notification settings - Fork 0
/
.autotest
125 lines (105 loc) · 4.23 KB
/
.autotest
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
Autotest.add_hook(:initialize) {|at|
%w{.svn .hg .git vendor}.each {|exception| at.add_exception(exception)}
at.add_exception %r{^.git} # ignore Version Control System
at.add_exception %r{^./tmp} # ignore temp files, lest autotest will run again, and again...
%w{config/ coverage/ db/ doc/ log/ public/ script/ tmp/ vendor/rails vendor/plugins previous_failures.txt}.each do |exception|
at.add_exception(exception)
end
at.clear_mappings
#### --------------- rspec mappings ---------------------
at.add_mapping(%r%^(test|spec)/fixtures/(.*).yml$%) { |_, m|
["spec/models/#{m[2].singularize}_spec.rb"] + at.files_matching(%r%^spec\/views\/#{m[2]}/.*_spec\.rb$%)
}
at.add_mapping(%r%^spec/(models|controllers|routing|views|helpers|lib|modules)/.*rb$%) { |filename, _|
filename
}
at.add_mapping(%r%^app/models/(.*)\.rb$%) { |_, m|
["spec/models/#{m[1]}_spec.rb"]
}
at.add_mapping(%r%^app/views/(.*)$%) { |_, m|
at.files_matching %r%^spec/views/#{m[1]}_spec.rb$%
}
at.add_mapping(%r%^app/controllers/(.*)\.rb$%) { |_, m|
if m[1] == "application"
at.files_matching %r%^spec/controllers/.*_spec\.rb$%
else
["spec/controllers/#{m[1]}_spec.rb"]
end
}
at.add_mapping(%r%^app/helpers/(.*)_helper\.rb$%) { |_, m|
if m[1] == "application" then
at.files_matching(%r%^spec/(views|helpers)/.*_spec\.rb$%)
else
["spec/helpers/#{m[1]}_helper_spec.rb"] + at.files_matching(%r%^spec\/views\/#{m[1]}/.*_spec\.rb$%)
end
}
at.add_mapping(%r%^config/routes\.rb$%) {
at.files_matching %r%^spec/(controllers|routing|views|helpers)/.*_spec\.rb$%
}
at.add_mapping(%r%^config/database\.yml$%) { |_, m|
at.files_matching %r%^spec/models/.*_spec\.rb$%
}
at.add_mapping(%r%^(spec/(spec_helper|shared/.*)|config/(boot|environment(s/test)?))\.rb$%) {
at.files_matching %r%^spec/(models|controllers|routing|views|helpers)/.*_spec\.rb$%
}
at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
["spec/lib/#{m[1]}_spec.rb"]
}
#### ------------ test:unit mappings --------------------
at.add_exception %r%^\./(?:db|doc|log|public|script|tmp|vendor)%
at.add_mapping(/^lib\/.*\.rb$/) do |filename, _|
impl = File.basename(filename, '.rb')
files_matching %r%^test/unit/#{impl}_test.rb$%
# TODO: (unit|functional|integration) maybe?
end
at.add_mapping %r%^test/fixtures/(.*)s.yml% do |_, m|
["test/unit/#{m[1]}_test.rb",
"test/controllers/#{m[1]}_controller_test.rb",
"test/views/#{m[1]}_view_test.rb",
"test/functional/#{m[1]}_controller_test.rb"]
end
at.add_mapping %r%^test/(unit|integration|controllers|views|functional)/.*rb$% do |filename, _|
filename
end
at.add_mapping %r%^app/models/(.*)\.rb$% do |_, m|
"test/unit/#{m[1]}_test.rb"
end
at.add_mapping %r%^app/helpers/application_helper.rb% do
at.files_matching %r%^test/(views|functional)/.*_test\.rb$%
end
at.add_mapping %r%^app/helpers/(.*)_helper.rb% do |_, m|
if m[1] == "application" then
at.files_matching %r%^test/(views|functional)/.*_test\.rb$%
else
["test/views/#{m[1]}_view_test.rb",
"test/functional/#{m[1]}_controller_test.rb"]
end
end
at.add_mapping %r%^app/views/(.*)/% do |_, m|
["test/views/#{m[1]}_view_test.rb",
"test/functional/#{m[1]}_controller_test.rb"]
end
at.add_mapping %r%^app/controllers/(.*)\.rb$% do |_, m|
if m[1] == "application" then
at.files_matching %r%^test/(controllers|views|functional)/.*_test\.rb$%
else
["test/controllers/#{m[1]}_test.rb",
"test/functional/#{m[1]}_test.rb"]
end
end
at.add_mapping %r%^app/views/layouts/% do
"test/views/layouts_view_test.rb"
end
at.add_mapping %r%^config/routes.rb$% do # FIX:
at.files_matching %r%^test/(controllers|views|functional)/.*_test\.rb$%
end
at.add_mapping %r%^test/test_helper.rb|config/((boot|environment(s/test)?).rb|database.yml)% do
at.files_matching %r%^test/(unit|controllers|views|functional)/.*_test\.rb$%
end
##### ------------- wagn mappings --------------------------
at.add_mapping %r%^modules/(.*)\.rb$% do |_, m|
["spec/modules/#{m[1]}_spec.rb"]
end
# FIXME: we'll probably want to add for directory type modules as well.
nil
}