-
Notifications
You must be signed in to change notification settings - Fork 13
/
derived_data_spec.rb
83 lines (68 loc) · 2.22 KB
/
derived_data_spec.rb
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
require 'spec_helper'
include Xcprofiler
describe DerivedData do
let(:derived_data_root) { File.absolute_path(File.join(__FILE__, '../fixtures')) }
describe '#by_product_name' do
context 'with valid log' do
it 'returns DerivedData' do
derived_data = DerivedData.by_product_name('MyApp', derived_data_root)
expect(derived_data).to_not be_nil
end
context 'with default_derived_data_root' do
before do
allow(DerivedData).to receive(:default_derived_data_root).and_return(derived_data_root)
end
it 'returns DerivedData' do
derived_data = DerivedData.by_product_name('MyApp', derived_data_root)
expect(derived_data).to_not be_nil
end
end
context 'with not existing log' do
it 'raises DerivedDataNotFound' do
expect {
DerivedData.by_product_name('NotExist', derived_data_root)
}.to raise_error(DerivedDataNotFound, 'Any matching derived data are not found')
end
end
end
end
context 'with valid log' do
let(:derived_data) { DerivedData.by_product_name('MyApp', derived_data_root) }
describe '#flag_enabled?' do
it 'returns true' do
expect(derived_data.flag_enabled?).to be_truthy
end
end
describe '#executions' do
it 'returns array' do
expect(derived_data.executions).not_to be_empty
end
end
context 'with logs generated by Xcode 8.3+' do
let(:derived_data) { DerivedData.by_product_name('Xcode83', derived_data_root) }
describe '#flag_enabled?' do
it 'returns true' do
expect(derived_data.flag_enabled?).to be_truthy
end
end
describe '#executions' do
it 'returns array' do
expect(derived_data.executions).not_to be_empty
end
end
end
end
context 'with invalid log' do
let(:derived_data) { DerivedData.by_product_name('Invalid', derived_data_root) }
describe '#flag_enabled?' do
it 'returns false' do
expect(derived_data.flag_enabled?).to be_falsey
end
end
describe '#executions' do
it 'returns empty array' do
expect(derived_data.executions).to be_empty
end
end
end
end