blob: f11e60222964b0639a03162045a0e438efeac314 (
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
|
After '@tempfile' do
if @tempfile
@tempfile.close
@tempfile.unlink
end
end
# store end of server log for failing scenarios
After do |scenario|
if scenario.failed?
logfile_path = Rails.root + 'tmp'
logfile_path += "#{scenario.title.gsub(/\s/, '_')}.log"
File.open(logfile_path, 'w') do |test_log|
test_log.puts scenario.title
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
|