-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkins_spec.rb
61 lines (51 loc) · 1.85 KB
/
jenkins_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
require 'spec_helper'
require 'bukin'
require 'bukin/file_match'
describe Bukin::Jenkins, :vcr do
before do
# Sorry md_5, but I'm using you for my integration tests
@url = 'http://ci.md-5.net'
@name = 'spigot'
@version = 'build-1000'
@download = 'http://ci.md-5.net/job/spigot/1000/artifact/Spigot-Server/'\
'target/spigot-1.6.1-R0.1-SNAPSHOT.jar'
@missing_name = 'missing-name'
@missing_version = 'build-99999999'
@missing_file = 'missing-file.jar'
@latest_version = 'build-1136'
end
it 'installs the latest version of a resource' do
provider = Bukin::Jenkins.new(@url)
version, download = provider.find(name: @name)
version.should == @latest_version
end
it 'installs a specific version of a resource' do
provider = Bukin::Jenkins.new(@url)
version, download = provider.find(name: @name, version: @version)
version.should == @version
download.should == @download
end
it 'returns an error when asked for a resource that doese not exist' do
provider = Bukin::Jenkins.new(@url)
expect do
provider.find(name: @missing_name)
end.to raise_error(Bukin::NoDownloadError)
end
it 'returns an error when asked for a version that does not exist' do
provider = Bukin::Jenkins.new(@url)
expect do
provider.find(name: @name, version: @missing_version)
end.to raise_error(Bukin::NoDownloadError)
end
it 'returns an error when asked for a file that does not exist' do
provider = Bukin::Jenkins.new(@url)
expect do
provider.find(name: @name, version: @version, file: @missing_file)
end.to raise_error(Bukin::NoDownloadError)
end
it 'chooses the first file when there are multiple files' do
provider = Bukin::Jenkins.new(@url)
version, download = provider.find(name: @name, version: @version)
download.should == @download
end
end