blob: 4ddc77e1f726c3ab4d3f8e1359ae0e1f17d590a1 (
plain)
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
|
After '@tempfile' do
if @tempfile
@tempfile.close
@tempfile.unlink
end
end
After '@config' do |scenario, block|
APP_CONFIG.replace @orig_config if @orig_config
end
# store end of server log for failing scenarios
After do |scenario|
if scenario.failed?
logfile_path = Rails.root + 'tmp'
logfile_path += "#{scenario.name.gsub(/\s/, '_')}.log"
File.open(logfile_path, 'w') do |test_log|
test_log.puts scenario.name
test_log.puts "========================="
test_log.puts `tail log/test.log -n 200`
end
end
end
# clear all records we created
After do
names = self.instance_variables.reject do |v|
v.to_s.starts_with?('@_')
end
names.each do |name|
record = self.instance_variable_get name
if record.is_a?(CouchRest::Model::Base) && record.persisted?
record.reload && record.destroy
end
end
end
|