Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
lumen-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
03bfa71d
authored
Aug 03, 2017
by
John Doe
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
removed db seed
parent
7a647b26
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
45 deletions
db/seeds.rb
db/seeds.rb
View file @
03bfa71d
...
@@ -6,48 +6,3 @@
...
@@ -6,48 +6,3 @@
#
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
# Mayor.create(name: 'Emanuel', city: cities.first)
require
'factory_girl_rails'
# config.include FactoryGirl::Syntax::Methods
DatabaseCleaner
.
strategy
=
:truncation
DatabaseCleaner
.
clean
# create named users
def
create_user
(
first_name
,
last_name
)
FactoryGirl
.
create
(
:user
,
first_name:
first_name
,
last_name:
last_name
)
end
john
=
create_user
(
'John'
,
'Donnal'
)
john
.
email
=
'jdonnal@gmail.com'
john
.
password
=
'changeme'
john
.
save!
nicky
=
create_user
(
'Nicky'
,
'Donnal'
)
steve
=
create_user
(
'Steve'
,
'Leeb'
)
pete
=
create_user
(
'Pete'
,
'Lindahl'
)
greg
=
create_user
(
'Greg'
,
'Bredariol'
)
# create named groups
donnals
=
FactoryGirl
.
create
(
:user_group
,
name:
'Donnals'
,
owner:
john
,
members:
[
nicky
])
lab
=
FactoryGirl
.
create
(
:user_group
,
name:
'Lab'
,
owner:
john
,
members:
[
steve
,
pete
,
greg
])
# create real nilms
nc
=
CreateNilm
.
new
nc
.
run
(
name:
'Local'
,
url:
'http://localhost:8080'
,
owner:
john
)
home
=
nc
.
nilm
FactoryGirl
.
create
(
:permission
,
nilm:
home
,
user_group:
donnals
,
role:
'owner'
)
FactoryGirl
.
create
(
:permission
,
nilm:
home
,
user:
steve
,
role:
'viewer'
)
# create fake nilms
3
.
times
{
FactoryGirl
.
create
(
:nilm
,
admins:
[
john
])
}
5
.
times
{
FactoryGirl
.
create
(
:nilm
,
owners:
[
john
])
}
10
.
times
{
FactoryGirl
.
create
(
:nilm
,
viewers:
[
john
])}
# create other groups
5
.
times
do
g
=
FactoryGirl
.
create
(
:test_user_group
,
size:
rand
(
1
..
8
))
g
.
users
<<
john
#john joins every group!
end
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