-
Notifications
You must be signed in to change notification settings - Fork 340
/
deprecations_spec.rb
112 lines (90 loc) · 3.49 KB
/
deprecations_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
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
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Specification::DSL::Deprecations do
before do
@spec = Spec.new
end
it 'warns about the renamed `preferred_dependency`' do
@spec.preferred_dependency = 'args'
@spec.attributes_hash['default_subspecs'].should == %w(args)
CoreUI.warnings.should.match /preferred_dependency.*default_subspec/
end
it 'warns about the deprecated `pre_install` hook' do
def @spec.pre_install(pod, target_definition); end
CoreUI.warnings.should.match /pre_install.*deprecated/
end
it 'preservers the functionality of the `pre_install` hook' do
def @spec.pre_install(pod, target_definition)
CoreUI.puts "Cheers! #{pod} #{target_definition}"
end
@spec.pre_install!('A', 'B').should == TRUE
CoreUI.output.should.match /Cheers! A B/
end
it 'warns about the deprecated `post_install` hook' do
def @spec.post_install(target_installer); end
CoreUI.warnings.should.match /post_install.*deprecated/
end
it 'preservers the functionality of the `post_install` hook' do
def @spec.post_install(target_installer)
CoreUI.puts "Cheers! #{target_installer}"
end
@spec.post_install!('A').should == TRUE
CoreUI.output.should.match /Cheers! A/
end
it 'raises if the header_mappings hook is defined' do
should.raise Informative do
def @spec.header_mappings
end
end.message.should.match /header_mappings.*deprecated/
end
it 'raises if the copy_header_mapping hook is defined' do
should.raise Informative do
def @spec.copy_header_mapping
end
end.message.should.match /copy_header_mapping.*deprecated/
end
it 'warns about the deprecated `documentation` attribute' do
@spec.documentation = {}
CoreUI.warnings.should.match /documentation.*deprecated/
end
it 'raises for the deprecated `clean_paths` attribute' do
lambda { @spec.clean_paths = 'value' }.should.raise Informative
end
it 'raises for the deprecated `part_of_dependency` attribute' do
lambda { @spec.part_of_dependency = 'value' }.should.raise Informative
end
it 'raises for the deprecated `part_of` attribute' do
lambda { @spec.part_of = 'value' }.should.raise Informative
end
it 'raises for the deprecated `exclude_header_search_paths` attribute' do
lambda { @spec.exclude_header_search_paths = 'value' }.should.raise Informative
end
#-----------------------------------------------------------------------------#
describe 'Hooks' do
before do
@spec = Spec.new
end
it 'stores a block to run before the installation' do
value = ''
@spec.post_install { value << 'modified' }
@spec.post_install!(nil)
value.should == 'modified'
end
it 'stores a block to run after the installation' do
value = ''
@spec.post_install { value << 'modified' }
@spec.post_install!(nil)
value.should == 'modified'
end
it 'warns about the deprecated `pre_install` hook' do
@spec.pre_install {}
CoreUI.warnings.should.match /pre install hook.*deprecated/
end
it 'warns about the deprecated `pre_install` hook' do
@spec.post_install {}
CoreUI.warnings.should.match /post install hook.*deprecated/
end
end
#-----------------------------------------------------------------------------#
end
end