-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub_informer_spec.rb
More file actions
47 lines (39 loc) · 1.41 KB
/
github_informer_spec.rb
File metadata and controls
47 lines (39 loc) · 1.41 KB
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
require 'github_informer'
RSpec.describe GithubInformer do
describe '.repo' do
it "Should pick out the github repo from the path" do
expect( GithubInformer.determine_repo('.') ).to eq 'bbc/github_informer'
end
it "Should raise an error if it can't identify the repo" do
expect { GithubInformer.determine_repo('/') }.to raise_error
end
end
describe '.sha' do
it "Should pick out the sha from the path" do
expect( GithubInformer.determine_sha('.') ).to be_a String
expect( GithubInformer.determine_sha('.').length ).to eq 41
end
it "Should raise an error if it can't identify the sha" do
expect { GithubInformer.determine_sha('/') }.to raise_error
end
end
describe '.normalise_status' do
it "should normalise :pass as 'success'" do
expect( GithubInformer.normalise_status(:pass) ).to eq 'success'
end
it "should normalise :fail as 'failure'" do
expect( GithubInformer.normalise_status(:fail) ).to eq 'failure'
end
it "should normalise :error as 'error'" do
expect( GithubInformer.normalise_status(:error) ).to eq 'error'
end
end
describe '.initialize' do
it "errors if you don't provide a context" do
expect { GithubInformer.new() }.to raise_error
end
it "can be initialized with only a context" do
expect( GithubInformer.new( :context => 'HiveCI' ) ).to be_a GithubInformer
end
end
end