initial database and rspec
This commit is contained in:
parent
1da63cf274
commit
d2c13471f2
6
Gemfile
6
Gemfile
|
|
@ -25,12 +25,12 @@ gem 'uglifier', '>= 1.3.0'
|
||||||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
||||||
gem 'jbuilder', '~> 2.5'
|
gem 'jbuilder', '~> 2.5'
|
||||||
# Use Redis adapter to run Action Cable in production
|
# Use Redis adapter to run Action Cable in production
|
||||||
# gem 'redis', '~> 4.0'
|
gem 'redis', '~> 4.0'
|
||||||
# Use ActiveModel has_secure_password
|
# Use ActiveModel has_secure_password
|
||||||
# gem 'bcrypt', '~> 3.1.7'
|
# gem 'bcrypt', '~> 3.1.7'
|
||||||
|
|
||||||
# Use ActiveStorage variant
|
# Use ActiveStorage variant
|
||||||
# gem 'mini_magick', '~> 4.8'
|
gem 'mini_magick', '~> 4.8'
|
||||||
|
|
||||||
# Use Capistrano for deployment
|
# Use Capistrano for deployment
|
||||||
# gem 'capistrano-rails', group: :development
|
# gem 'capistrano-rails', group: :development
|
||||||
|
|
@ -39,6 +39,8 @@ gem 'jbuilder', '~> 2.5'
|
||||||
gem 'bootsnap', '>= 1.1.0', require: false
|
gem 'bootsnap', '>= 1.1.0', require: false
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
|
gem 'rspec-rails'
|
||||||
|
gem 'factory_bot_rails'
|
||||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||||
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
33
Gemfile.lock
33
Gemfile.lock
|
|
@ -74,8 +74,14 @@ GEM
|
||||||
railties (>= 4.1.0, < 6.0)
|
railties (>= 4.1.0, < 6.0)
|
||||||
responders
|
responders
|
||||||
warden (~> 1.2.3)
|
warden (~> 1.2.3)
|
||||||
|
diff-lcs (1.3)
|
||||||
erubi (1.8.0)
|
erubi (1.8.0)
|
||||||
execjs (2.7.0)
|
execjs (2.7.0)
|
||||||
|
factory_bot (5.0.2)
|
||||||
|
activesupport (>= 4.2.0)
|
||||||
|
factory_bot_rails (5.0.2)
|
||||||
|
factory_bot (~> 5.0.2)
|
||||||
|
railties (>= 4.2.0)
|
||||||
ffi (1.10.0)
|
ffi (1.10.0)
|
||||||
globalid (0.4.2)
|
globalid (0.4.2)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
|
|
@ -98,6 +104,7 @@ GEM
|
||||||
mimemagic (~> 0.3.2)
|
mimemagic (~> 0.3.2)
|
||||||
method_source (0.9.2)
|
method_source (0.9.2)
|
||||||
mimemagic (0.3.3)
|
mimemagic (0.3.3)
|
||||||
|
mini_magick (4.9.3)
|
||||||
mini_mime (1.0.1)
|
mini_mime (1.0.1)
|
||||||
mini_portile2 (2.4.0)
|
mini_portile2 (2.4.0)
|
||||||
minitest (5.11.3)
|
minitest (5.11.3)
|
||||||
|
|
@ -141,10 +148,28 @@ GEM
|
||||||
rb-fsevent (0.10.3)
|
rb-fsevent (0.10.3)
|
||||||
rb-inotify (0.10.0)
|
rb-inotify (0.10.0)
|
||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
|
redis (4.1.0)
|
||||||
regexp_parser (1.4.0)
|
regexp_parser (1.4.0)
|
||||||
responders (2.4.1)
|
responders (2.4.1)
|
||||||
actionpack (>= 4.2.0, < 6.0)
|
actionpack (>= 4.2.0, < 6.0)
|
||||||
railties (>= 4.2.0, < 6.0)
|
railties (>= 4.2.0, < 6.0)
|
||||||
|
rspec-core (3.8.0)
|
||||||
|
rspec-support (~> 3.8.0)
|
||||||
|
rspec-expectations (3.8.3)
|
||||||
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
|
rspec-support (~> 3.8.0)
|
||||||
|
rspec-mocks (3.8.0)
|
||||||
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
|
rspec-support (~> 3.8.0)
|
||||||
|
rspec-rails (3.8.2)
|
||||||
|
actionpack (>= 3.0)
|
||||||
|
activesupport (>= 3.0)
|
||||||
|
railties (>= 3.0)
|
||||||
|
rspec-core (~> 3.8.0)
|
||||||
|
rspec-expectations (~> 3.8.0)
|
||||||
|
rspec-mocks (~> 3.8.0)
|
||||||
|
rspec-support (~> 3.8.0)
|
||||||
|
rspec-support (3.8.0)
|
||||||
ruby_dep (1.5.0)
|
ruby_dep (1.5.0)
|
||||||
rubyzip (1.2.2)
|
rubyzip (1.2.2)
|
||||||
selenium-webdriver (3.141.0)
|
selenium-webdriver (3.141.0)
|
||||||
|
|
@ -164,9 +189,6 @@ GEM
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
thor (0.20.3)
|
thor (0.20.3)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
turbolinks (5.2.0)
|
|
||||||
turbolinks-source (~> 5.2)
|
|
||||||
turbolinks-source (5.2.0)
|
|
||||||
tzinfo (1.2.5)
|
tzinfo (1.2.5)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
uglifier (4.1.20)
|
uglifier (4.1.20)
|
||||||
|
|
@ -193,15 +215,18 @@ DEPENDENCIES
|
||||||
capybara (>= 2.15)
|
capybara (>= 2.15)
|
||||||
chromedriver-helper
|
chromedriver-helper
|
||||||
devise
|
devise
|
||||||
|
factory_bot_rails
|
||||||
jbuilder (~> 2.5)
|
jbuilder (~> 2.5)
|
||||||
listen (>= 3.0.5, < 3.2)
|
listen (>= 3.0.5, < 3.2)
|
||||||
|
mini_magick (~> 4.8)
|
||||||
mysql2 (>= 0.4.4, < 0.6.0)
|
mysql2 (>= 0.4.4, < 0.6.0)
|
||||||
puma (~> 3.11)
|
puma (~> 3.11)
|
||||||
rails (~> 5.2.3)
|
rails (~> 5.2.3)
|
||||||
|
redis (~> 4.0)
|
||||||
|
rspec-rails
|
||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
spring
|
spring
|
||||||
spring-watcher-listen (~> 2.0.0)
|
spring-watcher-listen (~> 2.0.0)
|
||||||
turbolinks (~> 5)
|
|
||||||
tzinfo-data
|
tzinfo-data
|
||||||
uglifier (>= 1.3.0)
|
uglifier (>= 1.3.0)
|
||||||
web-console (>= 3.3.0)
|
web-console (>= 3.3.0)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
class Course < ApplicationRecord
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
class CourseLandingPage < ApplicationRecord
|
||||||
|
belongs_to :course
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
class EmailAccount < ApplicationRecord
|
||||||
|
enum authentication: %i[plain login cram_md5]
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
class LeadEmail < ApplicationRecord
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
class Lesson < ApplicationRecord
|
||||||
|
belongs_to :course
|
||||||
|
belongs_to :week
|
||||||
|
belongs_to :video
|
||||||
|
end
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
class User < ApplicationRecord
|
class User < ApplicationRecord
|
||||||
|
validates :email, uniqueness: true
|
||||||
# Include default devise modules. Others available are:
|
# Include default devise modules. Others available are:
|
||||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable,
|
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable,
|
||||||
# :registerable
|
# :registerable
|
||||||
devise :database_authenticatable, :confirmable, :trackable, :timeoutable,
|
devise :database_authenticatable, :confirmable, :trackable, :timeoutable,
|
||||||
:recoverable, :rememberable, :validatable, :lockable, :registerable
|
:recoverable, :rememberable, :validatable, :lockable, :registerable
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
class UserActivity < ApplicationRecord
|
||||||
|
belongs_to :user
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
class UserAdd < ApplicationRecord
|
||||||
|
belongs_to :user
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
class Video < ApplicationRecord
|
||||||
|
belongs_to :video_account
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
class VideoAccount < ApplicationRecord
|
||||||
|
belongs_to :account, polymorphic: true
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
class Week < ApplicationRecord
|
||||||
|
belongs_to :course
|
||||||
|
end
|
||||||
|
|
@ -31,9 +31,22 @@ Rails.application.configure do
|
||||||
config.active_storage.service = :local
|
config.active_storage.service = :local
|
||||||
|
|
||||||
# Don't care if the mailer can't send.
|
# Don't care if the mailer can't send.
|
||||||
config.action_mailer.raise_delivery_errors = false
|
|
||||||
|
|
||||||
config.action_mailer.perform_caching = false
|
config.action_mailer.perform_caching = false
|
||||||
|
config.action_mailer.delivery_method = :smtp
|
||||||
|
config.action_mailer.smtp_settings = {
|
||||||
|
address: 'smtp.gmail.com',
|
||||||
|
port: 587,
|
||||||
|
domain: 'akademiatechnologii.pl',
|
||||||
|
user_name: 'akademiatechnologii@gmail.com',
|
||||||
|
password: '12345%$#@!Adi',
|
||||||
|
authentication: 'plain',
|
||||||
|
enable_starttls_auto: true
|
||||||
|
}
|
||||||
|
config.action_mailer.perform_deliveries = true
|
||||||
|
config.action_mailer.raise_delivery_errors = true
|
||||||
|
config.action_mailer.default_options =
|
||||||
|
{ from: 'akademiatechnologii@gmail.com' }
|
||||||
|
|
||||||
|
|
||||||
# Print deprecation notices to the Rails logger.
|
# Print deprecation notices to the Rails logger.
|
||||||
config.active_support.deprecation = :log
|
config.active_support.deprecation = :log
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ Rails.application.configure do
|
||||||
|
|
||||||
# Print deprecation notices to the stderr.
|
# Print deprecation notices to the stderr.
|
||||||
config.active_support.deprecation = :stderr
|
config.active_support.deprecation = :stderr
|
||||||
|
config.action_mailer.default_url_options = { host: 'localhost' }
|
||||||
# Raises error for missing translations
|
# Raises error for missing translations
|
||||||
# config.action_view.raise_on_missing_translations = true
|
# config.action_view.raise_on_missing_translations = true
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
class CreateUserActivities < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :user_activities do |t|
|
||||||
|
t.references :user, foreign_key: true
|
||||||
|
t.integer :action
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
class CreateUserAdds < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :user_adds do |t|
|
||||||
|
t.references :user, foreign_key: true
|
||||||
|
t.string :first_name
|
||||||
|
t.string :last_name
|
||||||
|
t.string :company_name
|
||||||
|
t.string :nip, limit: 30
|
||||||
|
t.string :regon, limit: 30
|
||||||
|
t.string :city
|
||||||
|
t.string :zip_code
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
class CreateCourses < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :courses do |t|
|
||||||
|
t.string :name
|
||||||
|
t.text :description
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
class CreateWeeks < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :weeks do |t|
|
||||||
|
t.references :course, foreign_key: true
|
||||||
|
t.string :name
|
||||||
|
t.text :description
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
# This migration comes from active_storage (originally 20170806125915)
|
||||||
|
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :active_storage_blobs do |t|
|
||||||
|
t.string :key, null: false
|
||||||
|
t.string :filename, null: false
|
||||||
|
t.string :content_type
|
||||||
|
t.text :metadata
|
||||||
|
t.bigint :byte_size, null: false
|
||||||
|
t.string :checksum, null: false
|
||||||
|
t.datetime :created_at, null: false
|
||||||
|
|
||||||
|
t.index [ :key ], unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :active_storage_attachments do |t|
|
||||||
|
t.string :name, null: false
|
||||||
|
t.references :record, null: false, polymorphic: true, index: false
|
||||||
|
t.references :blob, null: false
|
||||||
|
|
||||||
|
t.datetime :created_at, null: false
|
||||||
|
|
||||||
|
t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
|
||||||
|
t.foreign_key :active_storage_blobs, column: :blob_id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
class CreateCourseLandingPages < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :course_landing_pages do |t|
|
||||||
|
t.references :course, foreign_key: true
|
||||||
|
t.string :name
|
||||||
|
t.longtext :body
|
||||||
|
t.boolean :active
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :course_landing_pages, :active
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
class CreateEmailAccounts < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :email_accounts do |t|
|
||||||
|
t.string :name
|
||||||
|
t.string :presented_name
|
||||||
|
t.string :adress
|
||||||
|
t.integer :port
|
||||||
|
t.string :domain
|
||||||
|
t.string :user_name
|
||||||
|
t.string :password
|
||||||
|
t.integer :authentication
|
||||||
|
t.boolean :e_starttls_auto
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
class CreateVideoAccounts < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :video_accounts do |t|
|
||||||
|
t.references :account, polymorphic: true
|
||||||
|
t.string :name
|
||||||
|
t.boolean :active
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :video_accounts, :active
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
class CreateVideos < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :videos do |t|
|
||||||
|
t.references :video_account, foreign_key: true
|
||||||
|
t.string :url
|
||||||
|
t.string :name
|
||||||
|
t.string :description
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :videos, :name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
class CreateLessons < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :lessons do |t|
|
||||||
|
t.references :course, foreign_key: true
|
||||||
|
t.references :week, foreign_key: true
|
||||||
|
t.references :video, foreign_key: true
|
||||||
|
t.string :name
|
||||||
|
t.text :description
|
||||||
|
t.text :informations
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
class CreateLeadEmails < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :lead_emails do |t|
|
||||||
|
t.string :name
|
||||||
|
t.boolean :active
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :lead_emails, :active
|
||||||
|
end
|
||||||
|
end
|
||||||
139
db/schema.rb
139
db/schema.rb
|
|
@ -10,7 +10,104 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2019_04_17_100642) do
|
ActiveRecord::Schema.define(version: 2019_05_02_114629) do
|
||||||
|
|
||||||
|
create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||||
|
t.string "name", null: false
|
||||||
|
t.string "record_type", null: false
|
||||||
|
t.bigint "record_id", null: false
|
||||||
|
t.bigint "blob_id", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
|
||||||
|
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "active_storage_blobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.string "filename", null: false
|
||||||
|
t.string "content_type"
|
||||||
|
t.text "metadata"
|
||||||
|
t.bigint "byte_size", null: false
|
||||||
|
t.string "checksum", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "course_landing_pages", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||||
|
t.bigint "course_id"
|
||||||
|
t.string "name"
|
||||||
|
t.text "body", limit: 4294967295
|
||||||
|
t.boolean "active"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["active"], name: "index_course_landing_pages_on_active"
|
||||||
|
t.index ["course_id"], name: "index_course_landing_pages_on_course_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "courses", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.text "description"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "email_accounts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.string "presented_name"
|
||||||
|
t.string "adress"
|
||||||
|
t.integer "port"
|
||||||
|
t.string "domain"
|
||||||
|
t.string "user_name"
|
||||||
|
t.string "password"
|
||||||
|
t.integer "authentication"
|
||||||
|
t.boolean "e_starttls_auto"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "lead_emails", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.boolean "active"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["active"], name: "index_lead_emails_on_active"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "lessons", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||||
|
t.bigint "course_id"
|
||||||
|
t.bigint "week_id"
|
||||||
|
t.bigint "video_id"
|
||||||
|
t.string "name"
|
||||||
|
t.text "description"
|
||||||
|
t.text "informations"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["course_id"], name: "index_lessons_on_course_id"
|
||||||
|
t.index ["video_id"], name: "index_lessons_on_video_id"
|
||||||
|
t.index ["week_id"], name: "index_lessons_on_week_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "user_activities", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||||
|
t.bigint "user_id"
|
||||||
|
t.integer "action"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["user_id"], name: "index_user_activities_on_user_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "user_adds", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||||
|
t.bigint "user_id"
|
||||||
|
t.string "first_name"
|
||||||
|
t.string "last_name"
|
||||||
|
t.string "company_name"
|
||||||
|
t.string "nip", limit: 30
|
||||||
|
t.string "regon", limit: 30
|
||||||
|
t.string "city"
|
||||||
|
t.string "zip_code"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["user_id"], name: "index_user_adds_on_user_id"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||||
t.string "email", default: "", null: false
|
t.string "email", default: "", null: false
|
||||||
|
|
@ -38,4 +135,44 @@ ActiveRecord::Schema.define(version: 2019_04_17_100642) do
|
||||||
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "video_accounts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||||
|
t.string "account_type"
|
||||||
|
t.bigint "account_id"
|
||||||
|
t.string "name"
|
||||||
|
t.boolean "active"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["account_type", "account_id"], name: "index_video_accounts_on_account_type_and_account_id"
|
||||||
|
t.index ["active"], name: "index_video_accounts_on_active"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "videos", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||||
|
t.bigint "video_account_id"
|
||||||
|
t.string "url"
|
||||||
|
t.string "name"
|
||||||
|
t.string "description"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["name"], name: "index_videos_on_name"
|
||||||
|
t.index ["video_account_id"], name: "index_videos_on_video_account_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "weeks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||||
|
t.bigint "course_id"
|
||||||
|
t.string "name"
|
||||||
|
t.text "description"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["course_id"], name: "index_weeks_on_course_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
||||||
|
add_foreign_key "course_landing_pages", "courses"
|
||||||
|
add_foreign_key "lessons", "courses"
|
||||||
|
add_foreign_key "lessons", "videos"
|
||||||
|
add_foreign_key "lessons", "weeks"
|
||||||
|
add_foreign_key "user_activities", "users"
|
||||||
|
add_foreign_key "user_adds", "users"
|
||||||
|
add_foreign_key "videos", "video_accounts"
|
||||||
|
add_foreign_key "weeks", "courses"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,5 @@
|
||||||
#
|
#
|
||||||
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
||||||
# Character.create(name: 'Luke', movie: movies.first)
|
# Character.create(name: 'Luke', movie: movies.first)
|
||||||
|
|
||||||
|
user = User.create(email: 'adhinz@gmail.com', password: 'qweqwe123')
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,8 @@
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :course_landing_page do
|
||||||
|
course { nil }
|
||||||
|
name { "MyString" }
|
||||||
|
body { "" }
|
||||||
|
active { false }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :course do
|
||||||
|
name { "MyString" }
|
||||||
|
description { "MyText" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :email_account do
|
||||||
|
name { "MyString" }
|
||||||
|
presented_name { "MyString" }
|
||||||
|
adress { "MyString" }
|
||||||
|
port { 1 }
|
||||||
|
domain { "MyString" }
|
||||||
|
user_name { "MyString" }
|
||||||
|
password { "MyString" }
|
||||||
|
authentication { 1 }
|
||||||
|
e_starttls_auto { false }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :lead_email do
|
||||||
|
name { "MyString" }
|
||||||
|
active { false }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :lesson do
|
||||||
|
course { nil }
|
||||||
|
week { nil }
|
||||||
|
video { nil }
|
||||||
|
name { "MyString" }
|
||||||
|
description { "MyText" }
|
||||||
|
informations { "MyText" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :user do
|
||||||
|
email { 'johndoe@gmail.com' }
|
||||||
|
password { 'blahblah' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :video_account do
|
||||||
|
account { nil }
|
||||||
|
name { "MyString" }
|
||||||
|
active { false }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :video do
|
||||||
|
video_account { nil }
|
||||||
|
url { "MyString" }
|
||||||
|
name { "MyString" }
|
||||||
|
description { "MyString" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :week do
|
||||||
|
course { nil }
|
||||||
|
name { "MyString" }
|
||||||
|
description { "MyText" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe CourseLandingPage, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Course, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe EmailAccount, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe LeadEmail, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Lesson, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe UserActivity, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe UserAdd, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
RSpec.describe User, type: :model do
|
||||||
|
before(:all) do
|
||||||
|
@user1 = create(:user)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'is valid with valid attributes' do
|
||||||
|
expect(@user1).to be_valid
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'is not valid without an email' do
|
||||||
|
user2 = build(:user, email: nil)
|
||||||
|
expect(user2).to_not be_valid
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'is not valid with bad email' do
|
||||||
|
user2 = build(:user, email: 'email@')
|
||||||
|
expect(user2).to_not be_valid
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe VideoAccount, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Video, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Week, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||||
|
require 'support/factory_bot'
|
||||||
|
require 'spec_helper'
|
||||||
|
ENV['RAILS_ENV'] ||= 'test'
|
||||||
|
require File.expand_path('../config/environment', __dir__)
|
||||||
|
# Prevent database truncation if the environment is production
|
||||||
|
abort('The Rails environment is running in production mode!') if Rails.env.production?
|
||||||
|
require 'rspec/rails'
|
||||||
|
require 'devise'
|
||||||
|
# Add additional requires below this line. Rails is not loaded until this point!
|
||||||
|
|
||||||
|
# Requires supporting ruby files with custom matchers and macros, etc, in
|
||||||
|
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
||||||
|
# run as spec files by default. This means that files in spec/support that end
|
||||||
|
# in _spec.rb will both be required and run as specs, causing the specs to be
|
||||||
|
# run twice. It is recommended that you do not name files matching this glob to
|
||||||
|
# end with _spec.rb. You can configure this pattern with the --pattern
|
||||||
|
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
||||||
|
#
|
||||||
|
# The following line is provided for convenience purposes. It has the downside
|
||||||
|
# of increasing the boot-up time by auto-requiring all files in the support
|
||||||
|
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
||||||
|
# require only the support files necessary.
|
||||||
|
#
|
||||||
|
# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
|
||||||
|
|
||||||
|
# Checks for pending migrations and applies them before tests are run.
|
||||||
|
# If you are not using ActiveRecord, you can remove these lines.
|
||||||
|
begin
|
||||||
|
ActiveRecord::Migration.maintain_test_schema!
|
||||||
|
rescue ActiveRecord::PendingMigrationError => e
|
||||||
|
puts e.to_s.strip
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
RSpec.configure do |config|
|
||||||
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||||
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||||
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||||
|
# examples within a transaction, remove the following line or assign false
|
||||||
|
# instead of true.
|
||||||
|
config.use_transactional_fixtures = true
|
||||||
|
|
||||||
|
# RSpec Rails can automatically mix in different behaviours to your tests
|
||||||
|
# based on their file location, for example enabling you to call `get` and
|
||||||
|
# `post` in specs under `spec/controllers`.
|
||||||
|
#
|
||||||
|
# You can disable this behaviour by removing the line below, and instead
|
||||||
|
# explicitly tag your specs with their type, e.g.:
|
||||||
|
#
|
||||||
|
# RSpec.describe UsersController, :type => :controller do
|
||||||
|
# # ...
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# The different available types are documented in the features, such as in
|
||||||
|
# https://relishapp.com/rspec/rspec-rails/docs
|
||||||
|
config.infer_spec_type_from_file_location!
|
||||||
|
|
||||||
|
# Filter lines from Rails gems in backtraces.
|
||||||
|
config.filter_rails_from_backtrace!
|
||||||
|
# arbitrary gems may also be filtered via:
|
||||||
|
# config.filter_gems_from_backtrace("gem name")
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
||||||
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
||||||
|
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
||||||
|
# this file to always be loaded, without a need to explicitly require it in any
|
||||||
|
# files.
|
||||||
|
#
|
||||||
|
# Given that it is always loaded, you are encouraged to keep this file as
|
||||||
|
# light-weight as possible. Requiring heavyweight dependencies from this file
|
||||||
|
# will add to the boot time of your test suite on EVERY test run, even for an
|
||||||
|
# individual file that may not need all of that loaded. Instead, consider making
|
||||||
|
# a separate helper file that requires the additional dependencies and performs
|
||||||
|
# the additional setup, and require it from the spec files that actually need
|
||||||
|
# it.
|
||||||
|
#
|
||||||
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
||||||
|
RSpec.configure do |config|
|
||||||
|
# rspec-expectations config goes here. You can use an alternate
|
||||||
|
# assertion/expectation library such as wrong or the stdlib/minitest
|
||||||
|
# assertions if you prefer.
|
||||||
|
config.expect_with :rspec do |expectations|
|
||||||
|
# This option will default to `true` in RSpec 4. It makes the `description`
|
||||||
|
# and `failure_message` of custom matchers include text for helper methods
|
||||||
|
# defined using `chain`, e.g.:
|
||||||
|
# be_bigger_than(2).and_smaller_than(4).description
|
||||||
|
# # => "be bigger than 2 and smaller than 4"
|
||||||
|
# ...rather than:
|
||||||
|
# # => "be bigger than 2"
|
||||||
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
||||||
|
end
|
||||||
|
|
||||||
|
# rspec-mocks config goes here. You can use an alternate test double
|
||||||
|
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
||||||
|
config.mock_with :rspec do |mocks|
|
||||||
|
# Prevents you from mocking or stubbing a method that does not exist on
|
||||||
|
# a real object. This is generally recommended, and will default to
|
||||||
|
# `true` in RSpec 4.
|
||||||
|
mocks.verify_partial_doubles = true
|
||||||
|
end
|
||||||
|
|
||||||
|
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
||||||
|
# have no way to turn it off -- the option exists only for backwards
|
||||||
|
# compatibility in RSpec 3). It causes shared context metadata to be
|
||||||
|
# inherited by the metadata hash of host groups and examples, rather than
|
||||||
|
# triggering implicit auto-inclusion in groups with matching metadata.
|
||||||
|
config.shared_context_metadata_behavior = :apply_to_host_groups
|
||||||
|
|
||||||
|
# The settings below are suggested to provide a good initial experience
|
||||||
|
# with RSpec, but feel free to customize to your heart's content.
|
||||||
|
# # This allows you to limit a spec run to individual examples or groups
|
||||||
|
# # you care about by tagging them with `:focus` metadata. When nothing
|
||||||
|
# # is tagged with `:focus`, all examples get run. RSpec also provides
|
||||||
|
# # aliases for `it`, `describe`, and `context` that include `:focus`
|
||||||
|
# # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
||||||
|
# config.filter_run_when_matching :focus
|
||||||
|
#
|
||||||
|
# # Allows RSpec to persist some state between runs in order to support
|
||||||
|
# # the `--only-failures` and `--next-failure` CLI options. We recommend
|
||||||
|
# # you configure your source control system to ignore this file.
|
||||||
|
# config.example_status_persistence_file_path = "spec/examples.txt"
|
||||||
|
#
|
||||||
|
# # Limits the available syntax to the non-monkey patched syntax that is
|
||||||
|
# # recommended. For more details, see:
|
||||||
|
# # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
||||||
|
# # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
||||||
|
# # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
||||||
|
# config.disable_monkey_patching!
|
||||||
|
#
|
||||||
|
# # Many RSpec users commonly either run the entire suite or an individual
|
||||||
|
# # file, and it's useful to allow more verbose output when running an
|
||||||
|
# # individual spec file.
|
||||||
|
# if config.files_to_run.one?
|
||||||
|
# # Use the documentation formatter for detailed output,
|
||||||
|
# # unless a formatter has already been configured
|
||||||
|
# # (e.g. via a command-line flag).
|
||||||
|
# config.default_formatter = "doc"
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# # Print the 10 slowest examples and example groups at the
|
||||||
|
# # end of the spec run, to help surface which specs are running
|
||||||
|
# # particularly slow.
|
||||||
|
# config.profile_examples = 10
|
||||||
|
#
|
||||||
|
# # Run specs in random order to surface order dependencies. If you find an
|
||||||
|
# # order dependency and want to debug it, you can fix the order by providing
|
||||||
|
# # the seed, which is printed after each run.
|
||||||
|
# # --seed 1234
|
||||||
|
# config.order = :random
|
||||||
|
#
|
||||||
|
# # Seed global randomization in this process using the `--seed` CLI option.
|
||||||
|
# # Setting this allows you to use `--seed` to deterministically reproduce
|
||||||
|
# # test failures related to randomization by passing the same `--seed` value
|
||||||
|
# # as the one that triggered the failure.
|
||||||
|
# Kernel.srand config.seed
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
module ControllerMacros
|
||||||
|
|
||||||
|
def login_user
|
||||||
|
before(:each) do
|
||||||
|
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
|
user = FactoryBot.create(:user)
|
||||||
|
user.confirm! # or set a confirmed_at inside the factory. Only necessary if you are using the "confirmable" module
|
||||||
|
sign_in user
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
require_relative 'support/controller_macros'
|
||||||
|
# or require_relative './controller_macros' if write in `spec/support/devise.rb`
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
# For Devise > 4.1.1
|
||||||
|
config.include Devise::Test::ControllerHelpers, type: :controller
|
||||||
|
# Use the following instead if you are on Devise <= 4.1.1
|
||||||
|
# config.include Devise::TestHelpers, :type => :controller
|
||||||
|
config.extend ControllerMacros, type: :controller
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
require 'factory_bot'
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.include FactoryBot::Syntax::Methods
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue