Sha256: 499a5194836dd13c7679179c7cc5b1f385a0a264b87653db4b33be4008d79989

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

# coding: utf-8
# This file is seed file for test data on development environment.

ActivityNotification::Notification.delete_all
ActivityNotification::Subscription.delete_all
Comment.delete_all
Article.delete_all
Admin.delete_all
User.delete_all
User.connection.execute("UPDATE sqlite_sequence SET seq = 0;")

['Ichiro', 'Stephen', 'Klay', 'Kevin'].each do |name|
  user = User.new(
    email:                 "#{name.downcase}@example.com",
    password:              'changeit',
    password_confirmation: 'changeit',
    name:                  name,
  )
  user.skip_confirmation!
  user.save!
end

['Ichiro'].each do |name|
  user = User.find_by_name(name)
  Admin.create(
    user: user,
    phone_number: ENV['OPTIONAL_TARGET_AMAZON_SNS_PHONE_NUMBER'],
    slack_username: ENV['OPTIONAL_TARGET_SLACK_USERNAME']
  )
end

User.all.each do |user|
  article = user.articles.create(
    title: "#{user.name}'s first article",
    body:  "This is the first #{user.name}'s article. Please read it!"
  )
  article.notify :users, send_email: false
end

Article.all.each do |article|
  User.all.each do |user|
    comment = article.comments.create(
      user: user,
      body:  "This is the first #{user.name}'s comment to #{article.user.name}'s article."
    )
    comment.notify :users, send_email: false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activity_notification-1.3.0 spec/rails_app/db/seeds.rb