/
list_spec.rb
80 lines (72 loc) · 2.8 KB
/
list_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
require File.expand_path('../../../../spec_helper', __FILE__)
module Pod
describe Command::Lib::Lint do
it 'lints the current working directory' do
Dir.chdir(fixture('integration/Reachability')) do
cmd = command('lib', 'lint', '--only-errors', '--quick')
cmd.run
UI.output.should.include 'passed validation'
end
end
it 'lints the current working directory using Debug configuration' do
Dir.chdir(fixture('integration/Reachability')) do
cmd = command('lib', 'lint', '--only-errors', '--quick', '--configuration=Debug')
cmd.run
UI.output.should.include 'passed validation'
end
end
it 'analyzes the current working directory using Debug configuration' do
Dir.chdir(fixture('integration/Reachability')) do
cmd = command('lib', 'lint', '--only-errors', '--quick', '--configuration=Debug', '--analyze')
cmd.run
UI.output.should.include 'passed validation'
end
end
it 'lints a single spec in the current working directory' do
Dir.chdir(fixture('integration/Reachability')) do
cmd = command('lib', 'lint', 'Reachability.podspec', '--quick', '--only-errors')
cmd.run
UI.output.should.include 'passed validation'
end
end
it 'fails to lint a broken spec file and cleans up' do
Dir.chdir(temporary_directory) do
open(temporary_directory + 'Broken.podspec', 'w') do |f|
f << 'Pod::Spec.new do |spec|'
f << "spec.name = 'Broken'"
f << 'end'
end
Validator.any_instance.expects(:no_clean=).with(false)
Validator.any_instance.stubs(:perform_extensive_analysis)
should.raise Pod::Informative do
run_command('lib', 'lint', 'Broken.podspec')
end
UI.output.should.include 'Missing required attribute'
end
end
it 'fails to lint a broken spec file and leaves lint directory' do
Dir.chdir(temporary_directory) do
open(temporary_directory + 'Broken.podspec', 'w') do |f|
f << 'Pod::Spec.new do |spec|'
f << "spec.name = 'Broken'"
f << 'end'
end
Validator.any_instance.expects(:no_clean=).with(true)
Validator.any_instance.stubs(:perform_extensive_analysis)
should.raise Pod::Informative do
run_command('lib', 'lint', 'Broken.podspec', '--no-clean')
end
UI.output.should.include 'Missing required attribute'
UI.output.should.include 'Pods workspace available at'
end
end
it 'fails to lint if the spec is not loaded' do
Dir.chdir(temporary_directory) do
should.raise Pod::Informative do
run_command('lib', 'lint', '404.podspec')
end
UI.output.should.include 'could not be loaded'
end
end
end
end