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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bf057172
Commit
bf057172
authored
Aug 09, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define model in migration spec
parent
d1c23a61
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
spec/migrations/update_authorized_keys_file_spec.rb
spec/migrations/update_authorized_keys_file_spec.rb
+11
-7
No files found.
spec/migrations/update_authorized_keys_file_spec.rb
View file @
bf057172
...
...
@@ -2,6 +2,10 @@ require 'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'migrate'
,
'20170626202753_update_authorized_keys_file.rb'
)
describe
UpdateAuthorizedKeysFile
,
:migration
do
class
ApplicationSetting
<
ActiveRecord
::
Base
self
.
table_name
=
'application_settings'
end
let
(
:migration
)
{
described_class
.
new
}
describe
'#up'
do
...
...
@@ -11,7 +15,7 @@ describe UpdateAuthorizedKeysFile, :migration do
ActiveRecord
::
Base
.
connection
.
change_column_null
:application_settings
,
:authorized_keys_enabled
,
true
ActiveRecord
::
Base
.
connection
.
change_column
:application_settings
,
:authorized_keys_enabled
,
:boolean
,
default:
nil
ApplicationSetting
.
create!
(
authorized_keys_enabled:
nil
,
mirror_max_delay:
300
)
ApplicationSetting
.
create!
(
authorized_keys_enabled:
nil
)
end
it
'sets authorized_keys_enabled to true'
do
...
...
@@ -83,11 +87,11 @@ describe UpdateAuthorizedKeysFile, :migration do
end
context
'when is a record in application_settings table'
do
before
do
ApplicationSetting
.
create!
(
authorized_keys_enabled:
true
,
mirror_max_delay:
300
)
end
context
'when authorized_keys_enabled is true'
do
before
do
ApplicationSetting
.
create!
(
authorized_keys_enabled:
true
)
end
it
{
is_expected
.
to
be_truthy
}
end
...
...
@@ -97,7 +101,7 @@ describe UpdateAuthorizedKeysFile, :migration do
ActiveRecord
::
Base
.
connection
.
change_column_null
:application_settings
,
:authorized_keys_enabled
,
true
ActiveRecord
::
Base
.
connection
.
change_column
:application_settings
,
:authorized_keys_enabled
,
:boolean
,
default:
nil
ApplicationSetting
.
first
.
update
(
authorized_keys_enabled:
nil
,
mirror_max_delay:
300
)
ApplicationSetting
.
create!
(
authorized_keys_enabled:
nil
)
end
it
{
is_expected
.
to
be_truthy
}
...
...
@@ -105,7 +109,7 @@ describe UpdateAuthorizedKeysFile, :migration do
context
'when authorized_keys_enabled is explicitly false'
do
before
do
ApplicationSetting
.
first
.
update!
(
authorized_keys_enabled:
false
,
mirror_max_delay:
300
)
ApplicationSetting
.
create!
(
authorized_keys_enabled:
false
)
end
it
{
is_expected
.
to
be_falsey
}
...
...
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