-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathfactories.rb
100 lines (82 loc) · 2.29 KB
/
factories.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
require 'factory_girl'
Job.class_eval do
def public=(value)
self.private = !value
end
end
FactoryGirl.define do
REPO_KEY = OpenSSL::PKey::RSA.generate(4096)
factory :user do
login 'svenfuchs'
github_oauth_token 'token'
end
factory :org, :class => 'Organization' do
login 'travis-ci'
end
factory :subscription do
valid_to Time.now + 24 * 3600
end
factory :trial
factory :repository, aliases: [:repo] do
name 'gem-release'
github_id 549743
vcs_id '549743'
vcs_type 'GithubRepository'
owner { User.first || FactoryGirl.create(:user) }
owner_name { owner.login }
key { SslKey.create(public_key: REPO_KEY.public_key, private_key: REPO_KEY.to_pem) }
users { [ owner ] }
settings {}
# TODO why is the worker payload interested in these at all?
last_build_id nil
last_build_started_at '2016-01-01T10:00:00Z'
last_build_finished_at '2016-01-01T11:00:00Z'
last_build_number 2
last_build_duration 60
last_build_state :passed
description 'description'
server_type 'git'
end
factory :installation
factory :job do
owner { User.first || FactoryGirl.create(:user) }
repository { Repository.first || FactoryGirl.create(:repository) }
source { FactoryGirl.create(:build) }
commit { FactoryGirl.create(:commit) }
config {}
number '2.1'
queue 'builds.gce'
state :created
queueable true
end
factory :build do
request { Request.first || FactoryGirl.create(:request) }
number 2
event_type :push
end
factory :stage
factory :request do
event_type 'push'
end
factory :pull_request do
end
factory :commit do
request { Request.first || FactoryGirl.create(:request) }
commit '62aaef'
branch 'master'
message 'message'
compare_url 'https://github.com/svenfuchs/minimal/compare/0cd9ff...62aaef'
committed_at '2016-01-01T12:00:00Z'
committer_email '[email protected]'
committer_name 'Sven Fuchs'
author_name 'Sven Fuchs'
author_email '[email protected]'
end
factory :membership do
association :organization
association :user
end
factory :custom_key, :class => 'CustomKey' do
name 'key'
end
end