From d2c13471f2f4ea6b97bf05dfbad426f4760b037d Mon Sep 17 00:00:00 2001 From: Adrian Hinz Date: Thu, 2 May 2019 13:49:31 +0200 Subject: [PATCH] initial database and rspec --- .rspec | 1 + Gemfile | 6 +- Gemfile.lock | 33 ++++- app/models/course.rb | 2 + app/models/course_landing_page.rb | 3 + app/models/email_account.rb | 3 + app/models/lead_email.rb | 2 + app/models/lesson.rb | 5 + app/models/user.rb | 2 + app/models/user_activity.rb | 3 + app/models/user_add.rb | 3 + app/models/video.rb | 3 + app/models/video_account.rb | 3 + app/models/week.rb | 3 + config/environments/development.rb | 17 ++- config/environments/test.rb | 2 +- .../20190502090709_create_user_activities.rb | 10 ++ db/migrate/20190502095358_create_user_adds.rb | 16 ++ db/migrate/20190502100811_create_courses.rb | 10 ++ db/migrate/20190502101457_create_weeks.rb | 11 ++ ...te_active_storage_tables.active_storage.rb | 27 ++++ ...90502104000_create_course_landing_pages.rb | 13 ++ .../20190502104437_create_email_accounts.rb | 17 +++ .../20190502113303_create_video_accounts.rb | 12 ++ db/migrate/20190502113518_create_videos.rb | 13 ++ db/migrate/20190502113533_create_lessons.rb | 14 ++ .../20190502114629_create_lead_emails.rb | 11 ++ db/schema.rb | 139 +++++++++++++++++- db/seeds.rb | 2 + dox/projekt_platforma_kursow.docx | Bin 0 -> 22206 bytes spec/factories/course_landing_pages.rb | 8 + spec/factories/courses.rb | 6 + spec/factories/email_accounts.rb | 13 ++ spec/factories/lead_emails.rb | 6 + spec/factories/lessons.rb | 10 ++ spec/factories/users.rb | 6 + spec/factories/video_accounts.rb | 7 + spec/factories/videos.rb | 8 + spec/factories/weeks.rb | 7 + spec/models/course_landing_page_spec.rb | 5 + spec/models/course_spec.rb | 5 + spec/models/email_account_spec.rb | 5 + spec/models/lead_email_spec.rb | 5 + spec/models/lesson_spec.rb | 5 + spec/models/user_activity_spec.rb | 5 + spec/models/user_add_spec.rb | 5 + spec/models/user_spec.rb | 20 +++ spec/models/video_account_spec.rb | 5 + spec/models/video_spec.rb | 5 + spec/models/week_spec.rb | 5 + spec/rails_helper.rb | 62 ++++++++ spec/spec_helper.rb | 94 ++++++++++++ spec/support/controller_macros.rb | 11 ++ spec/support/devise.rb | 10 ++ spec/support/factory_bot.rb | 4 + 55 files changed, 698 insertions(+), 10 deletions(-) create mode 100644 .rspec create mode 100644 app/models/course.rb create mode 100644 app/models/course_landing_page.rb create mode 100644 app/models/email_account.rb create mode 100644 app/models/lead_email.rb create mode 100644 app/models/lesson.rb create mode 100644 app/models/user_activity.rb create mode 100644 app/models/user_add.rb create mode 100644 app/models/video.rb create mode 100644 app/models/video_account.rb create mode 100644 app/models/week.rb create mode 100644 db/migrate/20190502090709_create_user_activities.rb create mode 100644 db/migrate/20190502095358_create_user_adds.rb create mode 100644 db/migrate/20190502100811_create_courses.rb create mode 100644 db/migrate/20190502101457_create_weeks.rb create mode 100644 db/migrate/20190502102021_create_active_storage_tables.active_storage.rb create mode 100644 db/migrate/20190502104000_create_course_landing_pages.rb create mode 100644 db/migrate/20190502104437_create_email_accounts.rb create mode 100644 db/migrate/20190502113303_create_video_accounts.rb create mode 100644 db/migrate/20190502113518_create_videos.rb create mode 100644 db/migrate/20190502113533_create_lessons.rb create mode 100644 db/migrate/20190502114629_create_lead_emails.rb create mode 100644 dox/projekt_platforma_kursow.docx create mode 100644 spec/factories/course_landing_pages.rb create mode 100644 spec/factories/courses.rb create mode 100644 spec/factories/email_accounts.rb create mode 100644 spec/factories/lead_emails.rb create mode 100644 spec/factories/lessons.rb create mode 100644 spec/factories/users.rb create mode 100644 spec/factories/video_accounts.rb create mode 100644 spec/factories/videos.rb create mode 100644 spec/factories/weeks.rb create mode 100644 spec/models/course_landing_page_spec.rb create mode 100644 spec/models/course_spec.rb create mode 100644 spec/models/email_account_spec.rb create mode 100644 spec/models/lead_email_spec.rb create mode 100644 spec/models/lesson_spec.rb create mode 100644 spec/models/user_activity_spec.rb create mode 100644 spec/models/user_add_spec.rb create mode 100644 spec/models/user_spec.rb create mode 100644 spec/models/video_account_spec.rb create mode 100644 spec/models/video_spec.rb create mode 100644 spec/models/week_spec.rb create mode 100644 spec/rails_helper.rb create mode 100644 spec/spec_helper.rb create mode 100644 spec/support/controller_macros.rb create mode 100644 spec/support/devise.rb create mode 100644 spec/support/factory_bot.rb diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..c99d2e7 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--require spec_helper diff --git a/Gemfile b/Gemfile index 6942706..922df12 100644 --- a/Gemfile +++ b/Gemfile @@ -25,12 +25,12 @@ gem 'uglifier', '>= 1.3.0' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5' # Use Redis adapter to run Action Cable in production -# gem 'redis', '~> 4.0' +gem 'redis', '~> 4.0' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use ActiveStorage variant -# gem 'mini_magick', '~> 4.8' +gem 'mini_magick', '~> 4.8' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development @@ -39,6 +39,8 @@ gem 'jbuilder', '~> 2.5' gem 'bootsnap', '>= 1.1.0', require: false 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 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] end diff --git a/Gemfile.lock b/Gemfile.lock index d1183e6..dce889e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -74,8 +74,14 @@ GEM railties (>= 4.1.0, < 6.0) responders warden (~> 1.2.3) + diff-lcs (1.3) erubi (1.8.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) globalid (0.4.2) activesupport (>= 4.2.0) @@ -98,6 +104,7 @@ GEM mimemagic (~> 0.3.2) method_source (0.9.2) mimemagic (0.3.3) + mini_magick (4.9.3) mini_mime (1.0.1) mini_portile2 (2.4.0) minitest (5.11.3) @@ -141,10 +148,28 @@ GEM rb-fsevent (0.10.3) rb-inotify (0.10.0) ffi (~> 1.0) + redis (4.1.0) regexp_parser (1.4.0) responders (2.4.1) actionpack (>= 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) rubyzip (1.2.2) selenium-webdriver (3.141.0) @@ -164,9 +189,6 @@ GEM sprockets (>= 3.0.0) thor (0.20.3) thread_safe (0.3.6) - turbolinks (5.2.0) - turbolinks-source (~> 5.2) - turbolinks-source (5.2.0) tzinfo (1.2.5) thread_safe (~> 0.1) uglifier (4.1.20) @@ -193,15 +215,18 @@ DEPENDENCIES capybara (>= 2.15) chromedriver-helper devise + factory_bot_rails jbuilder (~> 2.5) listen (>= 3.0.5, < 3.2) + mini_magick (~> 4.8) mysql2 (>= 0.4.4, < 0.6.0) puma (~> 3.11) rails (~> 5.2.3) + redis (~> 4.0) + rspec-rails selenium-webdriver spring spring-watcher-listen (~> 2.0.0) - turbolinks (~> 5) tzinfo-data uglifier (>= 1.3.0) web-console (>= 3.3.0) diff --git a/app/models/course.rb b/app/models/course.rb new file mode 100644 index 0000000..25e8ed7 --- /dev/null +++ b/app/models/course.rb @@ -0,0 +1,2 @@ +class Course < ApplicationRecord +end diff --git a/app/models/course_landing_page.rb b/app/models/course_landing_page.rb new file mode 100644 index 0000000..63dec2a --- /dev/null +++ b/app/models/course_landing_page.rb @@ -0,0 +1,3 @@ +class CourseLandingPage < ApplicationRecord + belongs_to :course +end diff --git a/app/models/email_account.rb b/app/models/email_account.rb new file mode 100644 index 0000000..6bc1fa0 --- /dev/null +++ b/app/models/email_account.rb @@ -0,0 +1,3 @@ +class EmailAccount < ApplicationRecord + enum authentication: %i[plain login cram_md5] +end diff --git a/app/models/lead_email.rb b/app/models/lead_email.rb new file mode 100644 index 0000000..46e24d8 --- /dev/null +++ b/app/models/lead_email.rb @@ -0,0 +1,2 @@ +class LeadEmail < ApplicationRecord +end diff --git a/app/models/lesson.rb b/app/models/lesson.rb new file mode 100644 index 0000000..479023a --- /dev/null +++ b/app/models/lesson.rb @@ -0,0 +1,5 @@ +class Lesson < ApplicationRecord + belongs_to :course + belongs_to :week + belongs_to :video +end diff --git a/app/models/user.rb b/app/models/user.rb index d3d6985..45aa18a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,7 +1,9 @@ class User < ApplicationRecord + validates :email, uniqueness: true # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable, # :registerable devise :database_authenticatable, :confirmable, :trackable, :timeoutable, :recoverable, :rememberable, :validatable, :lockable, :registerable + end diff --git a/app/models/user_activity.rb b/app/models/user_activity.rb new file mode 100644 index 0000000..c36ed1e --- /dev/null +++ b/app/models/user_activity.rb @@ -0,0 +1,3 @@ +class UserActivity < ApplicationRecord + belongs_to :user +end diff --git a/app/models/user_add.rb b/app/models/user_add.rb new file mode 100644 index 0000000..9acc81a --- /dev/null +++ b/app/models/user_add.rb @@ -0,0 +1,3 @@ +class UserAdd < ApplicationRecord + belongs_to :user +end diff --git a/app/models/video.rb b/app/models/video.rb new file mode 100644 index 0000000..41a00ae --- /dev/null +++ b/app/models/video.rb @@ -0,0 +1,3 @@ +class Video < ApplicationRecord + belongs_to :video_account +end diff --git a/app/models/video_account.rb b/app/models/video_account.rb new file mode 100644 index 0000000..c252ba9 --- /dev/null +++ b/app/models/video_account.rb @@ -0,0 +1,3 @@ +class VideoAccount < ApplicationRecord + belongs_to :account, polymorphic: true +end diff --git a/app/models/week.rb b/app/models/week.rb new file mode 100644 index 0000000..6f786dd --- /dev/null +++ b/app/models/week.rb @@ -0,0 +1,3 @@ +class Week < ApplicationRecord + belongs_to :course +end diff --git a/config/environments/development.rb b/config/environments/development.rb index c91354f..5ebfb91 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -31,9 +31,22 @@ Rails.application.configure do config.active_storage.service = :local # 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.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. config.active_support.deprecation = :log diff --git a/config/environments/test.rb b/config/environments/test.rb index 0a38fd3..0d5d72f 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -40,7 +40,7 @@ Rails.application.configure do # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - + config.action_mailer.default_url_options = { host: 'localhost' } # Raises error for missing translations # config.action_view.raise_on_missing_translations = true end diff --git a/db/migrate/20190502090709_create_user_activities.rb b/db/migrate/20190502090709_create_user_activities.rb new file mode 100644 index 0000000..75ece09 --- /dev/null +++ b/db/migrate/20190502090709_create_user_activities.rb @@ -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 diff --git a/db/migrate/20190502095358_create_user_adds.rb b/db/migrate/20190502095358_create_user_adds.rb new file mode 100644 index 0000000..6602681 --- /dev/null +++ b/db/migrate/20190502095358_create_user_adds.rb @@ -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 diff --git a/db/migrate/20190502100811_create_courses.rb b/db/migrate/20190502100811_create_courses.rb new file mode 100644 index 0000000..6dd1b2b --- /dev/null +++ b/db/migrate/20190502100811_create_courses.rb @@ -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 diff --git a/db/migrate/20190502101457_create_weeks.rb b/db/migrate/20190502101457_create_weeks.rb new file mode 100644 index 0000000..0684a61 --- /dev/null +++ b/db/migrate/20190502101457_create_weeks.rb @@ -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 diff --git a/db/migrate/20190502102021_create_active_storage_tables.active_storage.rb b/db/migrate/20190502102021_create_active_storage_tables.active_storage.rb new file mode 100644 index 0000000..0b2ce25 --- /dev/null +++ b/db/migrate/20190502102021_create_active_storage_tables.active_storage.rb @@ -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 diff --git a/db/migrate/20190502104000_create_course_landing_pages.rb b/db/migrate/20190502104000_create_course_landing_pages.rb new file mode 100644 index 0000000..a4c58a7 --- /dev/null +++ b/db/migrate/20190502104000_create_course_landing_pages.rb @@ -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 diff --git a/db/migrate/20190502104437_create_email_accounts.rb b/db/migrate/20190502104437_create_email_accounts.rb new file mode 100644 index 0000000..8af3a34 --- /dev/null +++ b/db/migrate/20190502104437_create_email_accounts.rb @@ -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 diff --git a/db/migrate/20190502113303_create_video_accounts.rb b/db/migrate/20190502113303_create_video_accounts.rb new file mode 100644 index 0000000..129dea5 --- /dev/null +++ b/db/migrate/20190502113303_create_video_accounts.rb @@ -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 diff --git a/db/migrate/20190502113518_create_videos.rb b/db/migrate/20190502113518_create_videos.rb new file mode 100644 index 0000000..5e5d1bc --- /dev/null +++ b/db/migrate/20190502113518_create_videos.rb @@ -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 diff --git a/db/migrate/20190502113533_create_lessons.rb b/db/migrate/20190502113533_create_lessons.rb new file mode 100644 index 0000000..a9868c4 --- /dev/null +++ b/db/migrate/20190502113533_create_lessons.rb @@ -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 diff --git a/db/migrate/20190502114629_create_lead_emails.rb b/db/migrate/20190502114629_create_lead_emails.rb new file mode 100644 index 0000000..34454a0 --- /dev/null +++ b/db/migrate/20190502114629_create_lead_emails.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 3455946..677ed68 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,104 @@ # # 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| 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 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 diff --git a/db/seeds.rb b/db/seeds.rb index 1beea2a..b1e776b 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,5 @@ # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Character.create(name: 'Luke', movie: movies.first) + +user = User.create(email: 'adhinz@gmail.com', password: 'qweqwe123') diff --git a/dox/projekt_platforma_kursow.docx b/dox/projekt_platforma_kursow.docx new file mode 100644 index 0000000000000000000000000000000000000000..f2b219813a7ff21a02e74fee125c3c23b5a69b45 GIT binary patch literal 22206 zcmeFXgLiFDvo0KC$Igyz+qUgw#kOtRww)bYJGPzdI6Jm^^Lx*CzH{z4?>D|b;NCe# z&DGu2{j6GZRCUd+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8$~@U98A@DxK9 zcpv$YU=lE0Be;U;SmK1(@X$JK!iHetU3=ayoK`HL5=^6at;f%vhPA`y-EsUSkH_*fjlb5~-pj9d3Z z?B9_QE#8EE(_Qz-7 K5!Czr+y4MLa<4D| literal 0 HcmV?d00001 diff --git a/spec/factories/course_landing_pages.rb b/spec/factories/course_landing_pages.rb new file mode 100644 index 0000000..4686e6a --- /dev/null +++ b/spec/factories/course_landing_pages.rb @@ -0,0 +1,8 @@ +FactoryBot.define do + factory :course_landing_page do + course { nil } + name { "MyString" } + body { "" } + active { false } + end +end diff --git a/spec/factories/courses.rb b/spec/factories/courses.rb new file mode 100644 index 0000000..aaa5272 --- /dev/null +++ b/spec/factories/courses.rb @@ -0,0 +1,6 @@ +FactoryBot.define do + factory :course do + name { "MyString" } + description { "MyText" } + end +end diff --git a/spec/factories/email_accounts.rb b/spec/factories/email_accounts.rb new file mode 100644 index 0000000..15018d4 --- /dev/null +++ b/spec/factories/email_accounts.rb @@ -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 diff --git a/spec/factories/lead_emails.rb b/spec/factories/lead_emails.rb new file mode 100644 index 0000000..f4e409f --- /dev/null +++ b/spec/factories/lead_emails.rb @@ -0,0 +1,6 @@ +FactoryBot.define do + factory :lead_email do + name { "MyString" } + active { false } + end +end diff --git a/spec/factories/lessons.rb b/spec/factories/lessons.rb new file mode 100644 index 0000000..585aca4 --- /dev/null +++ b/spec/factories/lessons.rb @@ -0,0 +1,10 @@ +FactoryBot.define do + factory :lesson do + course { nil } + week { nil } + video { nil } + name { "MyString" } + description { "MyText" } + informations { "MyText" } + end +end diff --git a/spec/factories/users.rb b/spec/factories/users.rb new file mode 100644 index 0000000..fc89d5e --- /dev/null +++ b/spec/factories/users.rb @@ -0,0 +1,6 @@ +FactoryBot.define do + factory :user do + email { 'johndoe@gmail.com' } + password { 'blahblah' } + end +end diff --git a/spec/factories/video_accounts.rb b/spec/factories/video_accounts.rb new file mode 100644 index 0000000..d708e34 --- /dev/null +++ b/spec/factories/video_accounts.rb @@ -0,0 +1,7 @@ +FactoryBot.define do + factory :video_account do + account { nil } + name { "MyString" } + active { false } + end +end diff --git a/spec/factories/videos.rb b/spec/factories/videos.rb new file mode 100644 index 0000000..09d1ced --- /dev/null +++ b/spec/factories/videos.rb @@ -0,0 +1,8 @@ +FactoryBot.define do + factory :video do + video_account { nil } + url { "MyString" } + name { "MyString" } + description { "MyString" } + end +end diff --git a/spec/factories/weeks.rb b/spec/factories/weeks.rb new file mode 100644 index 0000000..63f24ef --- /dev/null +++ b/spec/factories/weeks.rb @@ -0,0 +1,7 @@ +FactoryBot.define do + factory :week do + course { nil } + name { "MyString" } + description { "MyText" } + end +end diff --git a/spec/models/course_landing_page_spec.rb b/spec/models/course_landing_page_spec.rb new file mode 100644 index 0000000..16ae1c2 --- /dev/null +++ b/spec/models/course_landing_page_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe CourseLandingPage, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/course_spec.rb b/spec/models/course_spec.rb new file mode 100644 index 0000000..e7880d0 --- /dev/null +++ b/spec/models/course_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Course, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/email_account_spec.rb b/spec/models/email_account_spec.rb new file mode 100644 index 0000000..32281b8 --- /dev/null +++ b/spec/models/email_account_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe EmailAccount, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/lead_email_spec.rb b/spec/models/lead_email_spec.rb new file mode 100644 index 0000000..8f235b4 --- /dev/null +++ b/spec/models/lead_email_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe LeadEmail, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/lesson_spec.rb b/spec/models/lesson_spec.rb new file mode 100644 index 0000000..2a54341 --- /dev/null +++ b/spec/models/lesson_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Lesson, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/user_activity_spec.rb b/spec/models/user_activity_spec.rb new file mode 100644 index 0000000..417dfa2 --- /dev/null +++ b/spec/models/user_activity_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe UserActivity, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/user_add_spec.rb b/spec/models/user_add_spec.rb new file mode 100644 index 0000000..d265d55 --- /dev/null +++ b/spec/models/user_add_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe UserAdd, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb new file mode 100644 index 0000000..6308ebd --- /dev/null +++ b/spec/models/user_spec.rb @@ -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 diff --git a/spec/models/video_account_spec.rb b/spec/models/video_account_spec.rb new file mode 100644 index 0000000..18dba11 --- /dev/null +++ b/spec/models/video_account_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe VideoAccount, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/video_spec.rb b/spec/models/video_spec.rb new file mode 100644 index 0000000..9ac8444 --- /dev/null +++ b/spec/models/video_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Video, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/week_spec.rb b/spec/models/week_spec.rb new file mode 100644 index 0000000..cd43cc0 --- /dev/null +++ b/spec/models/week_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Week, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb new file mode 100644 index 0000000..110fa07 --- /dev/null +++ b/spec/rails_helper.rb @@ -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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..15a3872 --- /dev/null +++ b/spec/spec_helper.rb @@ -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 diff --git a/spec/support/controller_macros.rb b/spec/support/controller_macros.rb new file mode 100644 index 0000000..51eaba1 --- /dev/null +++ b/spec/support/controller_macros.rb @@ -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 diff --git a/spec/support/devise.rb b/spec/support/devise.rb new file mode 100644 index 0000000..98de8be --- /dev/null +++ b/spec/support/devise.rb @@ -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 diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb new file mode 100644 index 0000000..a089330 --- /dev/null +++ b/spec/support/factory_bot.rb @@ -0,0 +1,4 @@ +require 'factory_bot' +RSpec.configure do |config| + config.include FactoryBot::Syntax::Methods +end