Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
What's new
8
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in
Toggle navigation
Menu
Open sidebar
gitlab-qa-sandbox-group
qa-test-2019-05-06-03-38-42-40f225278db2df81
add-member-project-38ac0d05ff9a6e41
Commits
77053a6c
Commit
77053a6c
authored
Aug 30, 2015
by
Robert Speicher
Browse files
Convert to RSpec3 syntax via transpec
Command: transpec -c 'bundle exec rspec spec -t ~feature' \ -o should,oneliner,should_receive
parent
74b995d1
Changes
43
Hide whitespace changes
Inline
Side-by-side
spec/features/admin/runners_spec.rb
View file @
77053a6c
...
...
@@ -42,7 +42,7 @@ describe "Admin Runners", feature: true do
end
describe
'runner info'
do
it
{
find_field
(
'runner_token'
).
value
.
should
eq
runner
.
token
}
it
{
expect
(
find_field
(
'runner_token'
).
value
).
to
eq
runner
.
token
}
end
describe
'projects'
do
...
...
spec/features/projects_spec.rb
View file @
77053a6c
...
...
@@ -39,7 +39,7 @@ describe "Projects", feature: true do
expect
(
page
).
to
have_content
'was successfully updated'
find_field
(
'Timeout'
).
value
.
should
eq
'70'
expect
(
find_field
(
'Timeout'
).
value
).
to
eq
'70'
end
end
...
...
spec/features/runners_spec.rb
View file @
77053a6c
...
...
@@ -60,7 +60,7 @@ describe "Runners", feature: true do
click_on
"Remove runner"
end
Runner
.
exists?
(
id:
@specific_runner
)
.
should
be_falsey
expect
(
Runner
.
exists?
(
id:
@specific_runner
)
).
to
be_falsey
end
end
...
...
@@ -75,7 +75,7 @@ describe "Runners", feature: true do
click_on
"Enable shared runners"
@project
.
reload
.
shared_runners_enabled
.
should
be_truthy
expect
(
@project
.
reload
.
shared_runners_enabled
).
to
be_truthy
end
end
...
...
spec/features/triggers_spec.rb
View file @
77053a6c
...
...
@@ -11,7 +11,7 @@ describe 'Variables', feature: true do
context
'create a trigger'
do
before
do
click_on
'Add Trigger'
@project
.
triggers
.
count
.
should
eq
1
expect
(
@project
.
triggers
.
count
).
to
eq
1
end
it
'contains trigger token'
do
...
...
@@ -20,7 +20,7 @@ describe 'Variables', feature: true do
it
'revokes the trigger'
do
click_on
'Revoke'
@project
.
triggers
.
count
.
should
eq
0
expect
(
@project
.
triggers
.
count
).
to
eq
0
end
end
end
spec/features/variables_spec.rb
View file @
77053a6c
...
...
@@ -19,7 +19,7 @@ describe "Variables", feature: true do
click_on
"Save changes"
expect
(
page
).
to
have_content
(
"Variables were successfully updated."
)
@project
.
variables
.
count
.
should
eq
1
expect
(
@project
.
variables
.
count
).
to
eq
1
end
end
...
...
spec/helpers/application_helper_spec.rb
View file @
77053a6c
...
...
@@ -11,12 +11,12 @@ describe ApplicationHelper do
}
intervals_in_words
.
each
do
|
interval
,
expectation
|
duration_in_words
(
Time
.
now
+
interval
,
Time
.
now
)
.
should
eq
expectation
expect
(
duration_in_words
(
Time
.
now
+
interval
,
Time
.
now
)
).
to
eq
expectation
end
end
it
"calculates interval from now if there is no finished_at"
do
duration_in_words
(
nil
,
Time
.
now
-
5
)
.
should
eq
"5 seconds"
expect
(
duration_in_words
(
nil
,
Time
.
now
-
5
)
).
to
eq
"5 seconds"
end
end
...
...
@@ -30,7 +30,7 @@ describe ApplicationHelper do
}
intervals_in_words
.
each
do
|
interval
,
expectation
|
time_interval_in_words
(
interval
)
.
should
eq
expectation
expect
(
time_interval_in_words
(
interval
)
).
to
eq
expectation
end
end
end
...
...
spec/helpers/runners_helper_spec.rb
View file @
77053a6c
...
...
@@ -3,16 +3,16 @@ require 'spec_helper'
describe
RunnersHelper
do
it
"returns - not contacted yet"
do
runner
=
FactoryGirl
.
build
:runner
runner_status_icon
(
runner
)
.
should
include
(
"not connected yet"
)
expect
(
runner_status_icon
(
runner
)
).
to
include
(
"not connected yet"
)
end
it
"returns offline text"
do
runner
=
FactoryGirl
.
build
(
:runner
,
contacted_at:
1
.
day
.
ago
,
active:
true
)
runner_status_icon
(
runner
)
.
should
include
(
"Runner is offline"
)
expect
(
runner_status_icon
(
runner
)
).
to
include
(
"Runner is offline"
)
end
it
"returns online text"
do
runner
=
FactoryGirl
.
build
(
:runner
,
contacted_at:
1
.
hour
.
ago
,
active:
true
)
runner_status_icon
(
runner
)
.
should
include
(
"Runner is online"
)
expect
(
runner_status_icon
(
runner
)
).
to
include
(
"Runner is online"
)
end
end
spec/helpers/user_helper_spec.rb
View file @
77053a6c
...
...
@@ -8,7 +8,7 @@ describe UserHelper do
let
(
:avatar_url
)
{
nil
}
it
'should return a generic avatar'
do
user_avatar_url
(
user
)
.
should
eq
'no_avatar.png'
expect
(
user_avatar_url
(
user
)
).
to
eq
'no_avatar.png'
end
end
...
...
@@ -17,11 +17,11 @@ describe UserHelper do
let
(
:avatar_url
)
{
"
#{
base_url
}
?s=40&d=mm"
}
it
'should return gravatar with default size'
do
user_avatar_url
(
user
)
.
should
eq
"
#{
base_url
}
?s=40&d=identicon"
expect
(
user_avatar_url
(
user
)
).
to
eq
"
#{
base_url
}
?s=40&d=identicon"
end
it
'should return gravatar with custom size'
do
user_avatar_url
(
user
,
120
)
.
should
eq
"
#{
base_url
}
?s=120&d=identicon"
expect
(
user_avatar_url
(
user
,
120
)
).
to
eq
"
#{
base_url
}
?s=120&d=identicon"
end
end
...
...
@@ -30,11 +30,11 @@ describe UserHelper do
let
(
:avatar_url
)
{
"
#{
base_url
}
?s=40&d=mm"
}
it
'should return gravatar with default size'
do
user_avatar_url
(
user
)
.
should
eq
"
#{
base_url
}
?s=40&d=identicon"
expect
(
user_avatar_url
(
user
)
).
to
eq
"
#{
base_url
}
?s=40&d=identicon"
end
it
'should return gravatar with custom size'
do
user_avatar_url
(
user
,
120
)
.
should
eq
"
#{
base_url
}
?s=120&d=identicon"
expect
(
user_avatar_url
(
user
,
120
)
).
to
eq
"
#{
base_url
}
?s=120&d=identicon"
end
end
...
...
@@ -42,7 +42,7 @@ describe UserHelper do
let
(
:avatar_url
)
{
'http://example.local/avatar.png'
}
it
'should return custom avatar'
do
user_avatar_url
(
user
)
.
should
eq
avatar_url
expect
(
user_avatar_url
(
user
)
).
to
eq
avatar_url
end
end
end
...
...
spec/helpers/user_sessions_helper_spec.rb
View file @
77053a6c
...
...
@@ -7,17 +7,17 @@ describe UserSessionsHelper do
let
(
:return_to
)
{
'b'
}
it
'should return null if return_to is also null'
do
generate_oauth_hmac
(
salt
,
nil
)
.
should
be_nil
expect
(
generate_oauth_hmac
(
salt
,
nil
)
).
to
be_nil
end
it
'should return not null if return_to is also not null'
do
generate_oauth_hmac
(
salt
,
return_to
)
.
should_not
be_nil
expect
(
generate_oauth_hmac
(
salt
,
return_to
)
).
not_to
be_nil
end
it
'should return different hmacs for different salts'
do
secret1
=
generate_oauth_hmac
(
salt
,
return_to
)
secret2
=
generate_oauth_hmac
(
salt2
,
return_to
)
secret1
.
should_not
eq
(
secret2
)
expect
(
secret1
).
not_to
eq
(
secret2
)
end
end
...
...
@@ -25,13 +25,13 @@ describe UserSessionsHelper do
let
(
:return_to
)
{
'b'
}
it
'should return null if return_to is also null'
do
generate_oauth_state
(
nil
)
.
should
be_nil
expect
(
generate_oauth_state
(
nil
)
).
to
be_nil
end
it
'should return two different states for same return_to'
do
state1
=
generate_oauth_state
(
return_to
)
state2
=
generate_oauth_state
(
return_to
)
state1
.
should_not
eq
(
state2
)
expect
(
state1
).
not_to
eq
(
state2
)
end
end
...
...
@@ -40,7 +40,7 @@ describe UserSessionsHelper do
let
(
:state
)
{
generate_oauth_state
(
return_to
)
}
it
'should return return_to'
do
get_ouath_state_return_to
(
state
)
.
should
eq
(
return_to
)
expect
(
get_ouath_state_return_to
(
state
)
).
to
eq
(
return_to
)
end
end
...
...
@@ -53,17 +53,17 @@ describe UserSessionsHelper do
let
(
:invalid3
)
{
'aa:bb:'
}
it
'should validate oauth state'
do
is_oauth_state_valid?
(
state
)
.
should
be_truthy
expect
(
is_oauth_state_valid?
(
state
)
).
to
be_truthy
end
it
'should not validate forged state'
do
is_oauth_state_valid?
(
forged
)
.
should
be_falsey
expect
(
is_oauth_state_valid?
(
forged
)
).
to
be_falsey
end
it
'should not validate invalid state'
do
is_oauth_state_valid?
(
invalid
)
.
should
be_falsey
is_oauth_state_valid?
(
invalid2
)
.
should
be_falsey
is_oauth_state_valid?
(
invalid3
)
.
should
be_falsey
expect
(
is_oauth_state_valid?
(
invalid
)
).
to
be_falsey
expect
(
is_oauth_state_valid?
(
invalid2
)
).
to
be_falsey
expect
(
is_oauth_state_valid?
(
invalid3
)
).
to
be_falsey
end
end
end
spec/lib/ansi2html_spec.rb
View file @
77053a6c
...
...
@@ -3,131 +3,131 @@ require 'spec_helper'
describe
Ansi2html
do
it
"prints non-ansi as-is"
do
described_class
::
convert
(
"Hello"
)
.
should
eq
'Hello'
expect
(
described_class
::
convert
(
"Hello"
)
).
to
eq
'Hello'
end
it
"strips non-color-changing controll sequences"
do
described_class
::
convert
(
"Hello
\e
[2Kworld"
)
.
should
eq
'Hello world'
expect
(
described_class
::
convert
(
"Hello
\e
[2Kworld"
)
).
to
eq
'Hello world'
end
it
"prints simply red"
do
described_class
::
convert
(
"
\e
[31mHello
\e
[0m"
)
.
should
eq
'<span class="term-fg-red">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[31mHello
\e
[0m"
)
).
to
eq
'<span class="term-fg-red">Hello</span>'
end
it
"prints simply red without trailing reset"
do
described_class
::
convert
(
"
\e
[31mHello"
)
.
should
eq
'<span class="term-fg-red">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[31mHello"
)
).
to
eq
'<span class="term-fg-red">Hello</span>'
end
it
"prints simply yellow"
do
described_class
::
convert
(
"
\e
[33mHello
\e
[0m"
)
.
should
eq
'<span class="term-fg-yellow">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[33mHello
\e
[0m"
)
).
to
eq
'<span class="term-fg-yellow">Hello</span>'
end
it
"prints default on blue"
do
described_class
::
convert
(
"
\e
[39;44mHello"
)
.
should
eq
'<span class="term-bg-blue">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[39;44mHello"
)
).
to
eq
'<span class="term-bg-blue">Hello</span>'
end
it
"prints red on blue"
do
described_class
::
convert
(
"
\e
[31;44mHello"
)
.
should
eq
'<span class="term-fg-red term-bg-blue">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[31;44mHello"
)
).
to
eq
'<span class="term-fg-red term-bg-blue">Hello</span>'
end
it
"resets colors after red on blue"
do
described_class
::
convert
(
"
\e
[31;44mHello
\e
[0m world"
)
.
should
eq
'<span class="term-fg-red term-bg-blue">Hello</span> world'
expect
(
described_class
::
convert
(
"
\e
[31;44mHello
\e
[0m world"
)
).
to
eq
'<span class="term-fg-red term-bg-blue">Hello</span> world'
end
it
"performs color change from red/blue to yellow/blue"
do
described_class
::
convert
(
"
\e
[31;44mHello
\e
[33mworld"
)
.
should
eq
'<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-blue">world</span>'
expect
(
described_class
::
convert
(
"
\e
[31;44mHello
\e
[33mworld"
)
).
to
eq
'<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-blue">world</span>'
end
it
"performs color change from red/blue to yellow/green"
do
described_class
::
convert
(
"
\e
[31;44mHello
\e
[33;42mworld"
)
.
should
eq
'<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-green">world</span>'
expect
(
described_class
::
convert
(
"
\e
[31;44mHello
\e
[33;42mworld"
)
).
to
eq
'<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-green">world</span>'
end
it
"performs color change from red/blue to reset to yellow/green"
do
described_class
::
convert
(
"
\e
[31;44mHello
\e
[0m
\e
[33;42mworld"
)
.
should
eq
'<span class="term-fg-red term-bg-blue">Hello</span> <span class="term-fg-yellow term-bg-green">world</span>'
expect
(
described_class
::
convert
(
"
\e
[31;44mHello
\e
[0m
\e
[33;42mworld"
)
).
to
eq
'<span class="term-fg-red term-bg-blue">Hello</span> <span class="term-fg-yellow term-bg-green">world</span>'
end
it
"ignores unsupported codes"
do
described_class
::
convert
(
"
\e
[51mHello
\e
[0m"
)
.
should
eq
'Hello'
expect
(
described_class
::
convert
(
"
\e
[51mHello
\e
[0m"
)
).
to
eq
'Hello'
end
it
"prints light red"
do
described_class
::
convert
(
"
\e
[91mHello
\e
[0m"
)
.
should
eq
'<span class="term-fg-l-red">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[91mHello
\e
[0m"
)
).
to
eq
'<span class="term-fg-l-red">Hello</span>'
end
it
"prints default on light red"
do
described_class
::
convert
(
"
\e
[101mHello
\e
[0m"
)
.
should
eq
'<span class="term-bg-l-red">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[101mHello
\e
[0m"
)
).
to
eq
'<span class="term-bg-l-red">Hello</span>'
end
it
"performs color change from red/blue to default/blue"
do
described_class
::
convert
(
"
\e
[31;44mHello
\e
[39mworld"
)
.
should
eq
'<span class="term-fg-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>'
expect
(
described_class
::
convert
(
"
\e
[31;44mHello
\e
[39mworld"
)
).
to
eq
'<span class="term-fg-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>'
end
it
"performs color change from light red/blue to default/blue"
do
described_class
::
convert
(
"
\e
[91;44mHello
\e
[39mworld"
)
.
should
eq
'<span class="term-fg-l-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>'
expect
(
described_class
::
convert
(
"
\e
[91;44mHello
\e
[39mworld"
)
).
to
eq
'<span class="term-fg-l-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>'
end
it
"prints bold text"
do
described_class
::
convert
(
"
\e
[1mHello"
)
.
should
eq
'<span class="term-bold">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[1mHello"
)
).
to
eq
'<span class="term-bold">Hello</span>'
end
it
"resets bold text"
do
described_class
::
convert
(
"
\e
[1mHello
\e
[21m world"
)
.
should
eq
'<span class="term-bold">Hello</span> world'
described_class
::
convert
(
"
\e
[1mHello
\e
[22m world"
)
.
should
eq
'<span class="term-bold">Hello</span> world'
expect
(
described_class
::
convert
(
"
\e
[1mHello
\e
[21m world"
)
).
to
eq
'<span class="term-bold">Hello</span> world'
expect
(
described_class
::
convert
(
"
\e
[1mHello
\e
[22m world"
)
).
to
eq
'<span class="term-bold">Hello</span> world'
end
it
"prints italic text"
do
described_class
::
convert
(
"
\e
[3mHello"
)
.
should
eq
'<span class="term-italic">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[3mHello"
)
).
to
eq
'<span class="term-italic">Hello</span>'
end
it
"resets italic text"
do
described_class
::
convert
(
"
\e
[3mHello
\e
[23m world"
)
.
should
eq
'<span class="term-italic">Hello</span> world'
expect
(
described_class
::
convert
(
"
\e
[3mHello
\e
[23m world"
)
).
to
eq
'<span class="term-italic">Hello</span> world'
end
it
"prints underlined text"
do
described_class
::
convert
(
"
\e
[4mHello"
)
.
should
eq
'<span class="term-underline">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[4mHello"
)
).
to
eq
'<span class="term-underline">Hello</span>'
end
it
"resets underlined text"
do
described_class
::
convert
(
"
\e
[4mHello
\e
[24m world"
)
.
should
eq
'<span class="term-underline">Hello</span> world'
expect
(
described_class
::
convert
(
"
\e
[4mHello
\e
[24m world"
)
).
to
eq
'<span class="term-underline">Hello</span> world'
end
it
"prints concealed text"
do
described_class
::
convert
(
"
\e
[8mHello"
)
.
should
eq
'<span class="term-conceal">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[8mHello"
)
).
to
eq
'<span class="term-conceal">Hello</span>'
end
it
"resets concealed text"
do
described_class
::
convert
(
"
\e
[8mHello
\e
[28m world"
)
.
should
eq
'<span class="term-conceal">Hello</span> world'
expect
(
described_class
::
convert
(
"
\e
[8mHello
\e
[28m world"
)
).
to
eq
'<span class="term-conceal">Hello</span> world'
end
it
"prints crossed-out text"
do
described_class
::
convert
(
"
\e
[9mHello"
)
.
should
eq
'<span class="term-cross">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[9mHello"
)
).
to
eq
'<span class="term-cross">Hello</span>'
end
it
"resets crossed-out text"
do
described_class
::
convert
(
"
\e
[9mHello
\e
[29m world"
)
.
should
eq
'<span class="term-cross">Hello</span> world'
expect
(
described_class
::
convert
(
"
\e
[9mHello
\e
[29m world"
)
).
to
eq
'<span class="term-cross">Hello</span> world'
end
it
"can print 256 xterm fg colors"
do
described_class
::
convert
(
"
\e
[38;5;16mHello"
)
.
should
eq
'<span class="xterm-fg-16">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[38;5;16mHello"
)
).
to
eq
'<span class="xterm-fg-16">Hello</span>'
end
it
"can print 256 xterm fg colors on normal magenta background"
do
described_class
::
convert
(
"
\e
[38;5;16;45mHello"
)
.
should
eq
'<span class="xterm-fg-16 term-bg-magenta">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[38;5;16;45mHello"
)
).
to
eq
'<span class="xterm-fg-16 term-bg-magenta">Hello</span>'
end
it
"can print 256 xterm bg colors"
do
described_class
::
convert
(
"
\e
[48;5;240mHello"
)
.
should
eq
'<span class="xterm-bg-240">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[48;5;240mHello"
)
).
to
eq
'<span class="xterm-bg-240">Hello</span>'
end
it
"can print 256 xterm bg colors on normal magenta foreground"
do
described_class
::
convert
(
"
\e
[48;5;16;35mHello"
)
.
should
eq
'<span class="term-fg-magenta xterm-bg-16">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[48;5;16;35mHello"
)
).
to
eq
'<span class="term-fg-magenta xterm-bg-16">Hello</span>'
end
it
"prints bold colored text vividly"
do
described_class
::
convert
(
"
\e
[1;31mHello
\e
[0m"
)
.
should
eq
'<span class="term-fg-l-red term-bold">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[1;31mHello
\e
[0m"
)
).
to
eq
'<span class="term-fg-l-red term-bold">Hello</span>'
end
it
"prints bold light colored text correctly"
do
described_class
::
convert
(
"
\e
[1;91mHello
\e
[0m"
)
.
should
eq
'<span class="term-fg-l-red term-bold">Hello</span>'
expect
(
described_class
::
convert
(
"
\e
[1;91mHello
\e
[0m"
)
).
to
eq
'<span class="term-fg-l-red term-bold">Hello</span>'
end
end
spec/lib/charts_spec.rb
View file @
77053a6c
...
...
@@ -9,6 +9,6 @@ describe Charts::BuildTime do
it
'should return build times in minutes'
do
chart
=
described_class
.
new
(
@project
)
chart
.
build_times
.
should
eq
[
2
]
expect
(
chart
.
build_times
).
to
eq
[
2
]
end
end
spec/lib/gitlab_ci_yaml_processor_spec.rb
View file @
77053a6c
...
...
@@ -13,8 +13,8 @@ describe GitlabCiYamlProcessor do
config_processor
=
described_class
.
new
(
config
)
config_processor
.
builds_for_stage_and_ref
(
type
,
"master"
).
size
.
should
eq
1
config_processor
.
builds_for_stage_and_ref
(
type
,
"master"
).
first
.
should
eq
({
expect
(
config_processor
.
builds_for_stage_and_ref
(
type
,
"master"
).
size
).
to
eq
1
expect
(
config_processor
.
builds_for_stage_and_ref
(
type
,
"master"
).
first
).
to
eq
({
stage:
"test"
,
except:
nil
,
name: :rspec
,
...
...
@@ -34,7 +34,7 @@ describe GitlabCiYamlProcessor do
config_processor
=
described_class
.
new
(
config
)
config_processor
.
builds_for_stage_and_ref
(
type
,
"master"
).
size
.
should
eq
0
expect
(
config_processor
.
builds_for_stage_and_ref
(
type
,
"master"
).
size
).
to
eq
0
end
it
"does not return builds if only has regexp with another branch"
do
...
...
@@ -45,7 +45,7 @@ describe GitlabCiYamlProcessor do
config_processor
=
described_class
.
new
(
config
)
config_processor
.
builds_for_stage_and_ref
(
type
,
"master"
).
size
.
should
eq
0
expect
(
config_processor
.
builds_for_stage_and_ref
(
type
,
"master"
).
size
).
to
eq
0
end
it
"returns builds if only has specified this branch"
do
...
...
@@ -56,7 +56,7 @@ describe GitlabCiYamlProcessor do
config_processor
=
described_class
.
new
(
config
)
config_processor
.
builds_for_stage_and_ref
(
type
,
"master"
).
size
.
should
eq
1
expect
(
config_processor
.
builds_for_stage_and_ref
(
type
,
"master"
).
size
).
to
eq
1
end
it
"does not build tags"
do
...
...
@@ -67,7 +67,7 @@ describe GitlabCiYamlProcessor do
config_processor
=
described_class
.
new
(
config
)
config_processor
.
builds_for_stage_and_ref
(
type
,
"0-1"
,
true
).
size
.
should
eq
0
expect
(
config_processor
.
builds_for_stage_and_ref
(
type
,
"0-1"
,
true
).
size
).
to
eq
0
end
it
"returns builds if only has a list of branches including specified"
do
...
...
@@ -78,7 +78,7 @@ describe GitlabCiYamlProcessor do
config_processor
=
described_class
.
new
(
config
)
config_processor
.
builds_for_stage_and_ref
(
type
,
"deploy"
).
size
.
should
eq
1
expect
(
config_processor
.
builds_for_stage_and_ref
(
type
,
"deploy"
).
size
).
to
eq
1
end
it
"returns build only for specified type"
do
...
...
@@ -93,9 +93,9 @@ describe GitlabCiYamlProcessor do
config_processor
=
described_class
.
new
(
config
)
config_processor
.
builds_for_stage_and_ref
(
"production"
,
"deploy"
).
size
.
should
eq
0
config_processor
.
builds_for_stage_and_ref
(
type
,
"deploy"
).
size
.
should
eq
1
config_processor
.
builds_for_stage_and_ref
(
"deploy"
,
"deploy"
).
size
.
should
eq
2
expect
(
config_processor
.
builds_for_stage_and_ref
(
"production"
,
"deploy"
).
size
).
to
eq
0
expect
(
config_processor
.
builds_for_stage_and_ref
(
type
,
"deploy"
).
size
).
to
eq
1
expect
(
config_processor
.
builds_for_stage_and_ref
(
"deploy"
,
"deploy"
).
size
).
to
eq
2
end
end
...
...
@@ -110,8 +110,8 @@ describe GitlabCiYamlProcessor do
config_processor
=
described_class
.
new
(
config
)
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
size
.
should
eq
1
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
first
.
should
eq
({
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
size
).
to
eq
1
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
first
).
to
eq
({
except:
nil
,
stage:
"test"
,
name: :rspec
,
...
...
@@ -136,8 +136,8 @@ describe GitlabCiYamlProcessor do
config_processor
=
described_class
.
new
(
config
)
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
size
.
should
eq
1
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
first
.
should
eq
({
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
size
).
to
eq
1
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
first
).
to
eq
({
except:
nil
,
stage:
"test"
,
name: :rspec
,
...
...
@@ -166,7 +166,7 @@ describe GitlabCiYamlProcessor do
})
config_processor
=
described_class
.
new
(
config
)
config_processor
.
variables
.
should
eq
variables
expect
(
config_processor
.
variables
).
to
eq
variables
end
end
...
...
spec/lib/upgrader_spec.rb
View file @
77053a6c
...
...
@@ -5,13 +5,13 @@ describe Upgrader do
let
(
:current_version
)
{
GitlabCi
::
VERSION
}
describe
'current_version_raw'
do
it
{
upgrader
.
current_version_raw
.
should
eq
current_version
}
it
{
expect
(
upgrader
.
current_version_raw
).
to
eq
current_version
}
end
describe
'latest_version?'
do
it
'should be true if newest version'
do
allow
(
upgrader
).
to
receive_messages
(
latest_version_raw:
current_version
)
upgrader
.
latest_version?
.
should
be_truthy
expect
(
upgrader
.
latest_version?
).
to
be_truthy
end
end
...
...
spec/mailers/notify_spec.rb
View file @
77053a6c
...
...
@@ -14,11 +14,11 @@ describe Notify do
subject
{
described_class
.
build_success_email
(
@build
.
id
,
'wow@example.com'
)
}
it
'has the correct subject'
do
should
have_subject
/Build success for/
is_expected
.
to
have_subject
/Build success for/
end
it
'contains name of project'
do
should
have_body_text
/build successful/
is_expected
.
to
have_body_text
/build successful/
end
end
...
...
@@ -26,11 +26,11 @@ describe Notify do
subject
{
described_class
.
build_fail_email
(
@build
.
id
,
'wow@example.com'
)
}
it
'has the correct subject'
do
should
have_subject
/Build failed for/
is_expected
.
to
have_subject
/Build failed for/
end
it
'contains name of project'
do
should
have_body_text
/build failed/
is_expected
.
to
have_body_text
/build failed/
end
end
end
spec/models/build_spec.rb
View file @
77053a6c
...
...
@@ -30,14 +30,14 @@ describe Build do
let
(
:commit
)
{
FactoryGirl
.
create
:commit
,
project:
project
}
let
(
:build
)
{
FactoryGirl
.
create
:build
,
commit:
commit
}
it
{
should
belong_to
(
:commit
)
}
it
{
should
validate_presence_of
:status
}
it
{
is_expected
.
to
belong_to
(
:commit
)
}
it
{
is_expected
.
to
validate_presence_of
:status
}
it
{
should
respond_to
:success?
}
it
{
should
respond_to
:failed?
}
it
{
should
respond_to
:running?
}
it
{
should
respond_to
:pending?
}
it
{
should
respond_to
:trace_html
}
it
{
is_expected
.
to
respond_to
:success?
}
it
{
is_expected
.
to
respond_to
:failed?
}
it
{
is_expected
.
to
respond_to
:running?
}
it
{
is_expected
.
to
respond_to
:pending?
}
it
{
is_expected
.
to
respond_to
:trace_html
}
describe
'.first_pending'
do
let
(
:first
)
{
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
'pending'
,
created_at:
Date
.
yesterday
}
...
...
@@ -45,8 +45,8 @@ describe Build do
before
{
first
;
second
}
subject
{
Build
.
first_pending
}
it
{
should
be_a
(
Build
)
}
it
(
'returns with the first pending build'
)
{
should
eq
(
first
)
}
it
{
is_expected
.
to
be_a
(
Build
)
}
it
(
'returns with the first pending build'
)
{
is_expected
.
to
eq
(
first
)
}
end
describe
'.create_from'
do
...
...
@@ -69,14 +69,14 @@ describe Build do
context
'without started_at'
do
before
{
build
.
started_at
=
nil
}
it
{
should
be_falsey
}
it
{
is_expected
.
to
be_falsey
}
end
%w(running success failed)
.
each
do
|
status
|
context
"if build status is
#{
status
}
"
do