Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
2f1a229d
Commit
2f1a229d
authored
May 30, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redundant factory namespace in build specs
Conflicts: spec/models/build_spec.rb
parent
9951243b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
22 deletions
+20
-22
spec/models/build_spec.rb
spec/models/build_spec.rb
+20
-22
No files found.
spec/models/build_spec.rb
View file @
2f1a229d
require
'spec_helper'
describe
Ci
::
Build
,
models:
true
do
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:commit
)
{
create
(
:ci_commit
,
project:
project
)
}
let
(
:build
)
{
create
(
:ci_build
,
commit:
commit
)
}
it
{
is_expected
.
to
validate_presence_of
:ref
}
it
{
is_expected
.
to
respond_to
:trace_html
}
describe
'#first_pending'
do
let
(
:first
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
'pending'
,
created_at:
Date
.
yesterday
}
let
(
:second
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
'pending'
}
before
{
first
;
second
}
let!
(
:first
)
{
create
(
:ci_build
,
commit:
commit
,
status:
'pending'
,
created_at:
Date
.
yesterday
)
}
let!
(
:second
)
{
create
(
:ci_build
,
commit:
commit
,
status:
'pending'
)
}
subject
{
Ci
::
Build
.
first_pending
}
it
{
is_expected
.
to
be_a
(
Ci
::
Build
)
}
...
...
@@ -219,8 +218,8 @@ describe Ci::Build, models: true do
it
{
is_expected
.
to
eq
(
predefined_variables
+
yaml_variables
+
secure_variables
)
}
context
'and trigger variables'
do
let
(
:trigger
)
{
FactoryGirl
.
create
:ci_trigger
,
project:
project
}
let
(
:trigger_request
)
{
FactoryGirl
.
create
:ci_trigger_request_with_variables
,
commit:
commit
,
trigger:
trigger
}
let
(
:trigger
)
{
create
(
:ci_trigger
,
project:
project
)
}
let
(
:trigger_request
)
{
create
(
:ci_trigger_request_with_variables
,
commit:
commit
,
trigger:
trigger
)
}
let
(
:trigger_variables
)
do
[
{
key: :TRIGGER_KEY
,
value:
'TRIGGER_VALUE'
,
public:
false
}
...
...
@@ -329,7 +328,7 @@ describe Ci::Build, models: true do
end
context
'if there are runner'
do
let
(
:runner
)
{
FactoryGirl
.
create
:ci_runner
}
let
(
:runner
)
{
create
(
:ci_runner
)
}
before
do
build
.
project
.
runners
<<
runner
...
...
@@ -366,7 +365,7 @@ describe Ci::Build, models: true do
it
{
is_expected
.
to
be_truthy
}
context
"and there are specific runner"
do
let
(
:runner
)
{
FactoryGirl
.
create
:ci_runner
,
contacted_at:
1
.
second
.
ago
}
let
(
:runner
)
{
create
(
:ci_runner
,
contacted_at:
1
.
second
.
ago
)
}
before
do
build
.
project
.
runners
<<
runner
...
...
@@ -415,7 +414,7 @@ describe Ci::Build, models: true do
end
describe
'#repo_url'
do
let
(
:build
)
{
FactoryGirl
.
create
:ci_build
}
let
(
:build
)
{
create
(
:ci_build
)
}
let
(
:project
)
{
build
.
project
}
subject
{
build
.
repo_url
}
...
...
@@ -429,10 +428,10 @@ describe Ci::Build, models: true do
end
describe
'#depends_on_builds'
do
let!
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
name:
'build'
,
stage_idx:
0
,
stage:
'build'
}
let!
(
:rspec_test
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
name:
'rspec'
,
stage_idx:
1
,
stage:
'test'
}
let!
(
:rubocop_test
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
name:
'rubocop'
,
stage_idx:
1
,
stage:
'test'
}
let!
(
:staging
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
name:
'staging'
,
stage_idx:
2
,
stage:
'deploy'
}
let!
(
:build
)
{
create
(
:ci_build
,
commit:
commit
,
name:
'build'
,
stage_idx:
0
,
stage:
'build'
)
}
let!
(
:rspec_test
)
{
create
(
:ci_build
,
commit:
commit
,
name:
'rspec'
,
stage_idx:
1
,
stage:
'test'
)
}
let!
(
:rubocop_test
)
{
create
(
:ci_build
,
commit:
commit
,
name:
'rubocop'
,
stage_idx:
1
,
stage:
'test'
)
}
let!
(
:staging
)
{
create
(
:ci_build
,
commit:
commit
,
name:
'staging'
,
stage_idx:
2
,
stage:
'deploy'
)
}
it
'to have no dependents if this is first build'
do
expect
(
build
.
depends_on_builds
).
to
be_empty
...
...
@@ -453,8 +452,7 @@ describe Ci::Build, models: true do
end
def
create_mr
(
build
,
commit
,
factory: :merge_request
,
created_at:
Time
.
now
)
FactoryGirl
.
create
(
factory
,
source_project_id:
commit
.
gl_project_id
,
create
(
factory
,
source_project_id:
commit
.
gl_project_id
,
target_project_id:
commit
.
gl_project_id
,
source_branch:
build
.
ref
,
created_at:
created_at
)
...
...
@@ -501,8 +499,8 @@ describe Ci::Build, models: true do
context
'when a Build is created after the MR'
do
before
do
@merge_request
=
create_mr
(
build
,
commit
,
factory: :merge_request_with_diffs
)
commit2
=
FactoryGirl
.
create
:ci_commit
,
project:
project
@build2
=
FactoryGirl
.
create
:ci_build
,
commit:
commit2
commit2
=
create
(
:ci_commit
,
project:
project
)
@build2
=
create
(
:ci_build
,
commit:
commit2
)
commits
=
[
double
(
id:
commit
.
sha
),
double
(
id:
commit2
.
sha
)]
allow
(
@merge_request
).
to
receive
(
:commits
).
and_return
(
commits
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment