30 | <%= f.label :current_password %> (we need your current password to confirm your changes)
31 | <%= f.password_field :current_password, autocomplete: "current-password" %>
32 |
33 |
34 |
35 | <%= f.submit "Update" %>
36 |
37 | <% end %>
38 |
39 |
Cancel my account
40 |
41 |
Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_PATH = File.expand_path('../config/application', __dir__)
3 | require_relative '../config/boot'
4 | require 'rails/commands'
5 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require_relative '../config/boot'
3 | require 'rake'
4 | Rake.application.run
5 |
--------------------------------------------------------------------------------
/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'fileutils'
3 | include FileUtils
4 |
5 | # path to your application root.
6 | APP_ROOT = File.expand_path('..', __dir__)
7 |
8 | def system!(*args)
9 | system(*args) || abort("\n== Command #{args} failed ==")
10 | end
11 |
12 | chdir APP_ROOT do
13 | # This script is a starting point to setup your application.
14 | # Add necessary setup steps to this file.
15 |
16 | puts '== Installing dependencies =='
17 | system! 'gem install bundler --conservative'
18 | system('bundle check') || system!('bundle install')
19 |
20 | # Install JavaScript dependencies if using Yarn
21 | # system('bin/yarn')
22 |
23 | # puts "\n== Copying sample files =="
24 | # unless File.exist?('config/database.yml')
25 | # cp 'config/database.yml.sample', 'config/database.yml'
26 | # end
27 |
28 | puts "\n== Preparing database =="
29 | system! 'bin/rails db:setup'
30 |
31 | puts "\n== Removing old logs and tempfiles =="
32 | system! 'bin/rails log:clear tmp:clear'
33 |
34 | puts "\n== Restarting application server =="
35 | system! 'bin/rails restart'
36 | end
37 |
--------------------------------------------------------------------------------
/bin/update:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'fileutils'
3 | include FileUtils
4 |
5 | # path to your application root.
6 | APP_ROOT = File.expand_path('..', __dir__)
7 |
8 | def system!(*args)
9 | system(*args) || abort("\n== Command #{args} failed ==")
10 | end
11 |
12 | chdir APP_ROOT do
13 | # This script is a way to update your development environment automatically.
14 | # Add necessary update steps to this file.
15 |
16 | puts '== Installing dependencies =='
17 | system! 'gem install bundler --conservative'
18 | system('bundle check') || system!('bundle install')
19 |
20 | # Install JavaScript dependencies if using Yarn
21 | # system('bin/yarn')
22 |
23 | puts "\n== Updating database =="
24 | system! 'bin/rails db:migrate'
25 |
26 | puts "\n== Removing old logs and tempfiles =="
27 | system! 'bin/rails log:clear tmp:clear'
28 |
29 | puts "\n== Restarting application server =="
30 | system! 'bin/rails restart'
31 | end
32 |
--------------------------------------------------------------------------------
/bin/yarn:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_ROOT = File.expand_path('..', __dir__)
3 | Dir.chdir(APP_ROOT) do
4 | begin
5 | exec "yarnpkg", *ARGV
6 | rescue Errno::ENOENT
7 | $stderr.puts "Yarn executable was not detected in the system."
8 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9 | exit 1
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # This file is used by Rack-based servers to start the application.
4 |
5 | require_relative 'config/environment'
6 |
7 | run Rails.application
8 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require_relative 'boot'
2 |
3 | require 'rails/all'
4 |
5 | # Require the gems listed in Gemfile, including any gems
6 | # you've limited to :test, :development, or :production.
7 | Bundler.require(*Rails.groups)
8 |
9 | module FacebookClone
10 | class Application < Rails::Application
11 | # Initialize configuration defaults for originally generated Rails version.
12 | config.load_defaults 5.2
13 |
14 | # Settings in config/environments/* take precedence over those specified here.
15 | # Application configuration can go into files in config/initializers
16 | # -- all .rb files in that directory are automatically loaded after loading
17 | # the framework and any gems in your application.
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2 |
3 | require 'bundler/setup' # Set up gems listed in the Gemfile.
4 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
5 |
--------------------------------------------------------------------------------
/config/cable.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: async
3 |
4 | test:
5 | adapter: async
6 |
7 | production:
8 | adapter: redis
9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10 | channel_prefix: facebook-clone_production
11 |
--------------------------------------------------------------------------------
/config/credentials.yml.enc:
--------------------------------------------------------------------------------
1 | sIwxYeG1hMmR5YGqfG/9Q+lX+PWlzKMHvjuihNpd9s9twwX6ochjJAtymwGoWyruoC8nyKYzPLQKPV3u/pnmzoelVif3037wDAFCTgTvq9BiOciFoYvndw+QPBTEvqf24ylbN50JN5V6VORj7pOnsiwoLEIPfEMKyOM2+PBm+vLmXUCgl7iKb+GwukiMC+ATZapwJumMbEC7vp4D6wNZSlo26UMgGg6yRVnNLETGnOnzFJoTa84qR3pxprvVlu2yzoMm3zOAzjl09Cz5rSCfwS+j/AilYP9pIsMIFJIw6xyRygvhjS6xlA1y+I5qRHqfWu6nrw1sm0r2xyN8gF9H9IkfiXumHw4w1udoY5723Ah02ceEGeC7sceAlD/e0J3Nx8ulpcb5QArZMF7I/8QZ3tESY4DG+AuPQvoR--/6kdJ92BziccxXc/--+yfrBD4U7ZhTHx9DgSXlmA==
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | # PostgreSQL. Versions 9.1 and up are supported.
2 | #
3 | # Install the pg driver:
4 | # gem install pg
5 | # On OS X with Homebrew:
6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7 | # On OS X with MacPorts:
8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9 | # On Windows:
10 | # gem install pg
11 | # Choose the win32 build.
12 | # Install PostgreSQL and put its /bin directory on your path.
13 | #
14 | # Configure Using Gemfile
15 | # gem 'pg'
16 | #
17 | default: &default
18 | adapter: postgresql
19 | encoding: unicode
20 | # For details on connection pooling, see Rails configuration guide
21 | # http://guides.rubyonrails.org/configuring.html#database-pooling
22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
23 |
24 | development:
25 | <<: *default
26 | database: fb_clone_development
27 | username: fb-clone
28 | password: foobar12345
29 |
30 | # The specified database role being used to connect to postgres.
31 | # To create additional roles in postgres see `$ createuser --help`.
32 | # When left blank, postgres will use the default role. This is
33 | # the same name as the operating system user that initialized the database.
34 | #username: facebook-clone
35 | # The password associated with the postgres role (username).
36 | #password:
37 | # Connect on a TCP socket. Omitted by default since the client uses a
38 | # domain socket that doesn't need configuration. Windows does not have
39 | # domain sockets, so uncomment these lines.
40 | #host: localhost
41 | # The TCP port the server listens on. Defaults to 5432.
42 | # If your server runs on a different port number, change accordingly.
43 | #port: 5432
44 | # Schema search path. The server defaults to $user,public
45 | #schema_search_path: myapp,sharedapp,public
46 | # Minimum log levels, in increasing order:
47 | # debug5, debug4, debug3, debug2, debug1,
48 | # log, notice, warning, error, fatal, and panic
49 | # Defaults to warning.
50 | #min_messages: notice
51 |
52 | # Warning: The database defined as "test" will be erased and
53 | # re-generated from your development database when you run "rake".
54 | # Do not set this db to the same as development or production.
55 | test:
56 | <<: *default
57 | database: fb_clone_test
58 | username: fb-clone
59 | password: foobar12345
60 |
61 | # As with config/secrets.yml, you never want to store sensitive information,
62 | # like your database password, in your source code. If your source code is
63 | # ever seen by anyone, they now have access to your database.
64 | #
65 | # Instead, provide the password as a unix environment variable when you boot
66 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
67 | # for a full rundown on how to provide these environment variables in a
68 | # production deployment.
69 | #
70 | # On Heroku and other platform providers, you may have a full connection URL
71 | # available as an environment variable. For example:
72 | #
73 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
74 | #
75 | # You can use this database configuration with:
76 | #
77 | # production:
78 | # url: <%= ENV['DATABASE_URL'] %>
79 | #
80 | # production:
81 | # <<: *default
82 | # database: fb_clone_production
83 | # username: fb-clone
84 | # password: foobar12345
85 | production:
86 | <<: *default
87 | database: fb_production
88 | username: fb
89 | password: <%= ENV['FB_DATABASE_PASSWORD'] %>
90 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require_relative 'application'
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | Rails.application.configure do
4 | # Settings specified here will take precedence over those in config/application.rb.
5 |
6 | # In the development environment your application's code is reloaded on
7 | # every request. This slows down response time but is perfect for development
8 | # since you don't have to restart the web server when you make code changes.
9 | config.cache_classes = false
10 |
11 | # Do not eager load code on boot.
12 | config.eager_load = false
13 |
14 | # Show full error reports.
15 | config.consider_all_requests_local = true
16 |
17 | # Enable/disable caching. By default caching is disabled.
18 | # Run rails dev:cache to toggle caching.
19 | if Rails.root.join('tmp', 'caching-dev.txt').exist?
20 | config.action_controller.perform_caching = true
21 |
22 | config.cache_store = :memory_store
23 | config.public_file_server.headers = {
24 | 'Cache-Control' => "public, max-age=#{2.days.to_i}"
25 | }
26 | else
27 | config.action_controller.perform_caching = false
28 |
29 | config.cache_store = :null_store
30 | end
31 |
32 | # Store uploaded files on the local file system (see config/storage.yml for options)
33 | config.active_storage.service = :local
34 |
35 | # Devise setup
36 | config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
37 | # Don't care if the mailer can't send.
38 | config.action_mailer.raise_delivery_errors = false
39 |
40 | config.action_mailer.perform_caching = false
41 |
42 | # Print deprecation notices to the Rails logger.
43 | config.active_support.deprecation = :log
44 |
45 | # Raise an error on page load if there are pending migrations.
46 | config.active_record.migration_error = :page_load
47 |
48 | # Highlight code that triggered database queries in logs.
49 | config.active_record.verbose_query_logs = true
50 |
51 | # Debug mode disables concatenation and preprocessing of assets.
52 | # This option may cause significant delays in view rendering with a large
53 | # number of complex assets.
54 | config.assets.debug = true
55 |
56 | # Suppress logger output for asset requests.
57 | config.assets.quiet = true
58 |
59 | # Raises error for missing translations
60 | # config.action_view.raise_on_missing_translations = true
61 |
62 | # Use an evented file watcher to asynchronously detect changes in source code,
63 | # routes, locales, etc. This feature depends on the listen gem.
64 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker
65 | end
66 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | Rails.application.configure do
4 | # Settings specified here will take precedence over those in config/application.rb.
5 |
6 | # Code is not reloaded between requests.
7 | config.cache_classes = true
8 |
9 | # Eager load code on boot. This eager loads most of Rails and
10 | # your application in memory, allowing both threaded web servers
11 | # and those relying on copy on write to perform better.
12 | # Rake tasks automatically ignore this option for performance.
13 | config.eager_load = true
14 |
15 | # Full error reports are disabled and caching is turned on.
16 | config.consider_all_requests_local = false
17 | config.action_controller.perform_caching = true
18 |
19 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
20 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
21 | # config.require_master_key = true
22 |
23 | # Disable serving static files from the `/public` folder by default since
24 | # Apache or NGINX already handles this.
25 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
26 |
27 | # Compress JavaScripts and CSS.
28 | config.assets.js_compressor = :uglifier
29 | # config.assets.css_compressor = :sass
30 |
31 | # Do not fallback to assets pipeline if a precompiled asset is missed.
32 | config.assets.compile = false
33 |
34 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
35 |
36 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
37 | # config.action_controller.asset_host = 'http://assets.example.com'
38 |
39 | # Specifies the header that your server uses for sending files.
40 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
41 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
42 |
43 | # Store uploaded files on the local file system (see config/storage.yml for options)
44 | config.active_storage.service = :local
45 |
46 | # Mount Action Cable outside main process or domain
47 | # config.action_cable.mount_path = nil
48 | # config.action_cable.url = 'wss://example.com/cable'
49 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
50 |
51 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
52 | # config.force_ssl = true
53 |
54 | # Use the lowest log level to ensure availability of diagnostic information
55 | # when problems arise.
56 | config.log_level = :debug
57 |
58 | # Prepend all log lines with the following tags.
59 | config.log_tags = [:request_id]
60 |
61 | # Use a different cache store in production.
62 | # config.cache_store = :mem_cache_store
63 |
64 | # Use a real queuing backend for Active Job (and separate queues per environment)
65 | # config.active_job.queue_adapter = :resque
66 | # config.active_job.queue_name_prefix = "facebook-clone_#{Rails.env}"
67 |
68 | config.action_mailer.perform_caching = false
69 |
70 | # Ignore bad email addresses and do not raise email delivery errors.
71 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
72 | # config.action_mailer.raise_delivery_errors = false
73 |
74 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
75 | # the I18n.default_locale when a translation cannot be found).
76 | config.i18n.fallbacks = true
77 |
78 | # Send deprecation notices to registered listeners.
79 | config.active_support.deprecation = :notify
80 |
81 | # Use default logging formatter so that PID and timestamp are not suppressed.
82 | config.log_formatter = ::Logger::Formatter.new
83 |
84 | # Use a different logger for distributed setups.
85 | # require 'syslog/logger'
86 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
87 |
88 | if ENV['RAILS_LOG_TO_STDOUT'].present?
89 | logger = ActiveSupport::Logger.new(STDOUT)
90 | logger.formatter = config.log_formatter
91 | config.logger = ActiveSupport::TaggedLogging.new(logger)
92 | end
93 |
94 | # Do not dump schema after migrations.
95 | config.active_record.dump_schema_after_migration = false
96 | end
97 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | Rails.application.configure do
4 | # Settings specified here will take precedence over those in config/application.rb.
5 |
6 | # The test environment is used exclusively to run your application's
7 | # test suite. You never need to work with it otherwise. Remember that
8 | # your test database is "scratch space" for the test suite and is wiped
9 | # and recreated between test runs. Don't rely on the data there!
10 | config.cache_classes = true
11 |
12 | # Do not eager load code on boot. This avoids loading your whole application
13 | # just for the purpose of running a single test. If you are using a tool that
14 | # preloads Rails for running tests, you may have to set it to true.
15 | config.eager_load = false
16 |
17 | # Configure public file server for tests with Cache-Control for performance.
18 | config.public_file_server.enabled = true
19 | config.public_file_server.headers = {
20 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
21 | }
22 |
23 | # Show full error reports and disable caching.
24 | config.consider_all_requests_local = true
25 | config.action_controller.perform_caching = false
26 |
27 | # Raise exceptions instead of rendering exception templates.
28 | config.action_dispatch.show_exceptions = false
29 |
30 | # Disable request forgery protection in test environment.
31 | config.action_controller.allow_forgery_protection = false
32 |
33 | # Store uploaded files on the local file system in a temporary directory
34 | config.active_storage.service = :test
35 |
36 | config.action_mailer.perform_caching = false
37 |
38 | # Tell Action Mailer not to deliver emails to the real world.
39 | # The :test delivery method accumulates sent emails in the
40 | # ActionMailer::Base.deliveries array.
41 | config.action_mailer.delivery_method = :test
42 |
43 | # Print deprecation notices to the stderr.
44 | config.active_support.deprecation = :stderr
45 |
46 | # Raises error for missing translations
47 | # config.action_view.raise_on_missing_translations = true
48 | end
49 |
--------------------------------------------------------------------------------
/config/initializers/application_controller_renderer.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # ActiveSupport::Reloader.to_prepare do
6 | # ApplicationController.renderer.defaults.merge!(
7 | # http_host: 'example.org',
8 | # https: false
9 | # )
10 | # end
11 |
--------------------------------------------------------------------------------
/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Version of your assets, change this if you want to expire all your assets.
6 | Rails.application.config.assets.version = '1.0'
7 |
8 | # Add additional assets to the asset load path.
9 | # Rails.application.config.assets.paths << Emoji.images_path
10 | # Add Yarn node_modules folder to the asset load path.
11 | Rails.application.config.assets.paths << Rails.root.join('node_modules')
12 |
13 | # Precompile additional assets.
14 | # application.js, application.css, and all non-JS/CSS in the app/assets
15 | # folder are already added.
16 | # Rails.application.config.assets.precompile += %w( admin.js admin.css )
17 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
6 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
7 |
8 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
9 | # Rails.backtrace_cleaner.remove_silencers!
10 |
--------------------------------------------------------------------------------
/config/initializers/content_security_policy.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Define an application-wide content security policy
6 | # For further information see the following documentation
7 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
8 |
9 | # Rails.application.config.content_security_policy do |policy|
10 | # policy.default_src :self, :https
11 | # policy.font_src :self, :https, :data
12 | # policy.img_src :self, :https, :data
13 | # policy.object_src :none
14 | # policy.script_src :self, :https
15 | # policy.style_src :self, :https
16 |
17 | # # Specify URI for violation reports
18 | # # policy.report_uri "/csp-violation-report-endpoint"
19 | # end
20 |
21 | # If you are using UJS then enable automatic nonce generation
22 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
23 |
24 | # Report CSP violations to a specified URI
25 | # For further information see the following documentation:
26 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
27 | # Rails.application.config.content_security_policy_report_only = true
28 |
--------------------------------------------------------------------------------
/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Specify a serializer for the signed and encrypted cookie jars.
6 | # Valid options are :json, :marshal, and :hybrid.
7 | Rails.application.config.action_dispatch.cookies_serializer = :json
8 |
--------------------------------------------------------------------------------
/config/initializers/devise.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Use this hook to configure devise mailer, warden hooks and so forth.
4 | # Many of these configuration options can be set straight in your model.
5 | Devise.setup do |config|
6 | # The secret key used by Devise. Devise uses this key to generate
7 | # random tokens. Changing this key will render invalid all existing
8 | # confirmation, reset password and unlock tokens in the database.
9 | # Devise will use the `secret_key_base` as its `secret_key`
10 | # by default. You can change it below and use your own secret key.
11 | # config.secret_key = 'a665e0b8559c28a3cd793e0d6aa36822780b941169d2d46a95d79bc76
12 | # c4d38b003c307dd601b679d8ae60510449e265244af73fd01202c69d8cb75692a60fedc'
13 |
14 | # ==> Controller configuration
15 | # Configure the parent class to the devise controllers.
16 | # config.parent_controller = 'DeviseController'
17 |
18 | # ==> Mailer Configuration
19 | # Configure the e-mail address which will be shown in Devise::Mailer,
20 | # note that it will be overwritten if you use your own mailer class
21 | # with default "from" parameter.
22 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
23 |
24 | # Configure the class responsible to send e-mails.
25 | # config.mailer = 'Devise::Mailer'
26 |
27 | # Configure the parent class responsible to send e-mails.
28 | # config.parent_mailer = 'ActionMailer::Base'
29 |
30 | # ==> ORM configuration
31 | # Load and configure the ORM. Supports :active_record (default) and
32 | # :mongoid (bson_ext recommended) by default. Other ORMs may be
33 | # available as additional gems.
34 | require 'devise/orm/active_record'
35 |
36 | # ==> Configuration for any authentication mechanism
37 | # Configure which keys are used when authenticating a user. The default is
38 | # just :email. You can configure it to use [:username, :subdomain], so for
39 | # authenticating a user, both parameters are required. Remember that those
40 | # parameters are used only when authenticating and not when retrieving from
41 | # session. If you need permissions, you should implement that in a before filter.
42 | # You can also supply a hash where the value is a boolean determining whether
43 | # or not authentication should be aborted when the value is not present.
44 | # config.authentication_keys = [:email]
45 |
46 | # Configure parameters from the request object used for authentication. Each entry
47 | # given should be a request method and it will automatically be passed to the
48 | # find_for_authentication method and considered in your model lookup. For instance,
49 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
50 | # The same considerations mentioned for authentication_keys also apply to request_keys.
51 | # config.request_keys = []
52 |
53 | # Configure which authentication keys should be case-insensitive.
54 | # These keys will be downcased upon creating or modifying a user and when used
55 | # to authenticate or find a user. Default is :email.
56 | config.case_insensitive_keys = [:email]
57 |
58 | # Configure which authentication keys should have whitespace stripped.
59 | # These keys will have whitespace before and after removed upon creating or
60 | # modifying a user and when used to authenticate or find a user. Default is :email.
61 | config.strip_whitespace_keys = [:email]
62 |
63 | # Tell if authentication through request.params is enabled. True by default.
64 | # It can be set to an array that will enable params authentication only for the
65 | # given strategies, for example, `config.params_authenticatable = [:database]` will
66 | # enable it only for database (email + password) authentication.
67 | # config.params_authenticatable = true
68 |
69 | # Tell if authentication through HTTP Auth is enabled. False by default.
70 | # It can be set to an array that will enable http authentication only for the
71 | # given strategies, for example, `config.http_authenticatable = [:database]` will
72 | # enable it only for database authentication. The supported strategies are:
73 | # :database = Support basic authentication with authentication key + password
74 | # config.http_authenticatable = true
75 | # config.http_authenticatable = [:database]
76 | # If 401 status code should be returned for AJAX requests. True by default.
77 | # config.http_authenticatable_on_xhr = true
78 |
79 | # The realm used in Http Basic Authentication. 'Application' by default.
80 | # config.http_authentication_realm = 'Application'
81 |
82 | # It will change confirmation, password recovery and other workflows
83 | # to behave the same regardless if the e-mail provided was right or wrong.
84 | # Does not affect registerable.
85 | # config.paranoid = true
86 |
87 | # By default Devise will store the user in session. You can skip storage for
88 | # particular strategies by setting this option.
89 | # Notice that if you are skipping storage for all authentication paths, you
90 | # may want to disable generating routes to Devise's sessions controller by
91 | # passing skip: :sessions to `devise_for` in your config/routes.rb
92 | config.skip_session_storage = [:http_auth]
93 |
94 | # By default, Devise cleans up the CSRF token on authentication to
95 | # avoid CSRF token fixation attacks. This means that, when using AJAX
96 | # requests for sign in and sign up, you need to get a new CSRF token
97 | # from the server. You can disable this option at your own risk.
98 | # config.clean_up_csrf_token_on_authentication = true
99 |
100 | # When false, Devise will not attempt to reload routes on eager load.
101 | # This can reduce the time taken to boot the app but if your application
102 | # requires the Devise mappings to be loaded during boot time the application
103 | # won't boot properly.
104 | # config.reload_routes = true
105 |
106 | # ==> Configuration for :database_authenticatable
107 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If
108 | # using other algorithms, it sets how many times you want the password to be hashed.
109 | #
110 | # Limiting the stretches to just one in testing will increase the performance of
111 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
112 | # a value less than 10 in other environments. Note that, for bcrypt (the default
113 | # algorithm), the cost increases exponentially with the number of stretches (e.g.
114 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
115 | config.stretches = Rails.env.test? ? 1 : 11
116 |
117 | # Set up a pepper to generate the hashed password.
118 | # config.pepper = 'ff4e3002573751ecb6f5362cfc272d895a4c71d12e68f9f1333a987f542d598c36416ac86ee2c
119 | # a6d8fe3132bbcd2509de4e3a445880e250b3584eac39573ce54'
120 |
121 | # Send a notification to the original email when the user's email is changed.
122 | # config.send_email_changed_notification = false
123 |
124 | # Send a notification email when the user's password is changed.
125 | # config.send_password_change_notification = false
126 |
127 | # ==> Configuration for :confirmable
128 | # A period that the user is allowed to access the website even without
129 | # confirming their account. For instance, if set to 2.days, the user will be
130 | # able to access the website for two days without confirming their account,
131 | # access will be blocked just in the third day.
132 | # You can also set it to nil, which will allow the user to access the website
133 | # without confirming their account.
134 | # Default is 0.days, meaning the user cannot access the website without
135 | # confirming their account.
136 | # config.allow_unconfirmed_access_for = 2.days
137 |
138 | # A period that the user is allowed to confirm their account before their
139 | # token becomes invalid. For example, if set to 3.days, the user can confirm
140 | # their account within 3 days after the mail was sent, but on the fourth day
141 | # their account can't be confirmed with the token any more.
142 | # Default is nil, meaning there is no restriction on how long a user can take
143 | # before confirming their account.
144 | # config.confirm_within = 3.days
145 |
146 | # If true, requires any email changes to be confirmed (exactly the same way as
147 | # initial account confirmation) to be applied. Requires additional unconfirmed_email
148 | # db field (see migrations). Until confirmed, new email is stored in
149 | # unconfirmed_email column, and copied to email column on successful confirmation.
150 | config.reconfirmable = true
151 |
152 | # Defines which key will be used when confirming an account
153 | # config.confirmation_keys = [:email]
154 |
155 | # ==> Configuration for :rememberable
156 | # The time the user will be remembered without asking for credentials again.
157 | # config.remember_for = 2.weeks
158 |
159 | # Invalidates all the remember me tokens when the user signs out.
160 | config.expire_all_remember_me_on_sign_out = true
161 |
162 | # If true, extends the user's remember period when remembered via cookie.
163 | # config.extend_remember_period = false
164 |
165 | # Options to be passed to the created cookie. For instance, you can set
166 | # secure: true in order to force SSL only cookies.
167 | # config.rememberable_options = {}
168 |
169 | # ==> Configuration for :validatable
170 | # Range for password length.
171 | config.password_length = 6..128
172 |
173 | # Email regex used to validate email formats. It simply asserts that
174 | # one (and only one) @ exists in the given string. This is mainly
175 | # to give user feedback and not to assert the e-mail validity.
176 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
177 |
178 | # ==> Configuration for :timeoutable
179 | # The time you want to timeout the user session without activity. After this
180 | # time the user will be asked for credentials again. Default is 30 minutes.
181 | # config.timeout_in = 30.minutes
182 |
183 | # ==> Configuration for :lockable
184 | # Defines which strategy will be used to lock an account.
185 | # :failed_attempts = Locks an account after a number of failed attempts to sign in.
186 | # :none = No lock strategy. You should handle locking by yourself.
187 | # config.lock_strategy = :failed_attempts
188 |
189 | # Defines which key will be used when locking and unlocking an account
190 | # config.unlock_keys = [:email]
191 |
192 | # Defines which strategy will be used to unlock an account.
193 | # :email = Sends an unlock link to the user email
194 | # :time = Re-enables login after a certain amount of time (see :unlock_in below)
195 | # :both = Enables both strategies
196 | # :none = No unlock strategy. You should handle unlocking by yourself.
197 | # config.unlock_strategy = :both
198 |
199 | # Number of authentication tries before locking an account if lock_strategy
200 | # is failed attempts.
201 | # config.maximum_attempts = 20
202 |
203 | # Time interval to unlock the account if :time is enabled as unlock_strategy.
204 | # config.unlock_in = 1.hour
205 |
206 | # Warn on the last attempt before the account is locked.
207 | # config.last_attempt_warning = true
208 |
209 | # ==> Configuration for :recoverable
210 | #
211 | # Defines which key will be used when recovering the password for an account
212 | # config.reset_password_keys = [:email]
213 |
214 | # Time interval you can reset your password with a reset password key.
215 | # Don't put a too small interval or your users won't have the time to
216 | # change their passwords.
217 | config.reset_password_within = 6.hours
218 |
219 | # When set to false, does not sign a user in automatically after their password is
220 | # reset. Defaults to true, so a user is signed in automatically after a reset.
221 | # config.sign_in_after_reset_password = true
222 |
223 | # ==> Configuration for :encryptable
224 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
225 | # You can use :sha1, :sha512 or algorithms from others authentication tools as
226 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
227 | # for default behavior) and :restful_authentication_sha1 (then you should set
228 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
229 | #
230 | # Require the `devise-encryptable` gem when using anything other than bcrypt
231 | # config.encryptor = :sha512
232 |
233 | # ==> Scopes configuration
234 | # Turn scoped views on. Before rendering "sessions/new", it will first check for
235 | # "users/sessions/new". It's turned off by default because it's slower if you
236 | # are using only default views.
237 | # config.scoped_views = false
238 |
239 | # Configure the default scope given to Warden. By default it's the first
240 | # devise role declared in your routes (usually :user).
241 | # config.default_scope = :user
242 |
243 | # Set this configuration to false if you want /users/sign_out to sign out
244 | # only the current scope. By default, Devise signs out all scopes.
245 | # config.sign_out_all_scopes = true
246 |
247 | # ==> Navigation configuration
248 | # Lists the formats that should be treated as navigational. Formats like
249 | # :html, should redirect to the sign in page when the user does not have
250 | # access, but formats like :xml or :json, should return 401.
251 | #
252 | # If you have any extra navigational formats, like :iphone or :mobile, you
253 | # should add them to the navigational formats lists.
254 | #
255 | # The "*/*" below is required to match Internet Explorer requests.
256 | # config.navigational_formats = ['*/*', :html]
257 |
258 | # The default HTTP method used to sign out a resource. Default is :delete.
259 | config.sign_out_via = :delete
260 |
261 | # ==> OmniAuth
262 | # Add a new OmniAuth provider. Check the wiki for more information on setting
263 | # up on your models and hooks.
264 | <<<<<<< HEAD
265 | config.omniauth :facebook, '3451859098219919', 'a640e7cb82ee1f48b88775ad4686525c', callback_url: 'https://secret-sea-76381.herokuapp.com/auth/facebook/callback'
266 |
267 | # ==> Warden configuration
268 | =======
269 | # config.omniauth :facebook, '3451859098219919', 'a640e7cb82ee1f48b88775ad4686525c', callback_url: 'https://secret-sea-76381.herokuapp.com/auth/facebook/callback'
270 | config.omniauth :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET'], callback_url: 'https://secret-sea-76381.herokuapp.com/users/auth/facebook/callback'
271 | # ==> Warden configuration
272 | >>>>>>> master
273 | # If you want to use other strategies, that are not supported by Devise, or
274 | # change the failure app, you can configure them inside the config.warden block.
275 | #
276 | # config.warden do |manager|
277 | # manager.intercept_401 = false
278 | # manager.default_strategies(scope: :user).unshift :some_external_strategy
279 | # end
280 |
281 | # ==> Mountable engine configurations
282 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine
283 | # is mountable, there are some extra configurations to be taken into account.
284 | # The following options are available, assuming the engine is mounted as:
285 | #
286 | # mount MyEngine, at: '/my_engine'
287 | #
288 | # The router that invoked `devise_for`, in the example above, would be:
289 | # config.router_name = :my_engine
290 | #
291 | # When using OmniAuth, Devise cannot automatically set OmniAuth path,
292 | # so you need to do it manually. For the users scope, it would be:
293 | # config.omniauth_path_prefix = '/my_engine/users/auth'
294 |
295 | # ==> Turbolinks configuration
296 | # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
297 | #
298 | # ActiveSupport.on_load(:devise_failure_app) do
299 | # include Turbolinks::Controller
300 | # end
301 |
302 | # ==> Configuration for :registerable
303 |
304 | # When set to false, does not sign a user in automatically after their password is
305 | # changed. Defaults to true, so a user is signed in automatically after changing a password.
306 | # config.sign_in_after_change_password = true
307 | end
308 |
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Configure sensitive parameters which will be filtered from the log file.
6 | Rails.application.config.filter_parameters += [:password]
7 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Add new inflection rules using the following format. Inflections
6 | # are locale specific, and you may define rules for as many different
7 | # locales as you wish. All of these examples are active by default:
8 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
9 | # inflect.plural /^(ox)$/i, '\1en'
10 | # inflect.singular /^(ox)en/i, '\1'
11 | # inflect.irregular 'person', 'people'
12 | # inflect.uncountable %w( fish sheep )
13 | # end
14 |
15 | # These inflection rules are supported but not enabled by default:
16 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
17 | # inflect.acronym 'RESTful'
18 | # end
19 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Add new mime types for use in respond_to blocks:
6 | # Mime::Type.register "text/richtext", :rtf
7 |
--------------------------------------------------------------------------------
/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # This file contains settings for ActionController::ParamsWrapper which
6 | # is enabled by default.
7 |
8 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
9 | ActiveSupport.on_load(:action_controller) do
10 | wrap_parameters format: [:json]
11 | end
12 |
13 | # To enable root element in JSON for ActiveRecord objects.
14 | # ActiveSupport.on_load(:active_record) do
15 | # self.include_root_in_json = true
16 | # end
17 |
--------------------------------------------------------------------------------
/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2 |
3 | en:
4 | devise:
5 | confirmations:
6 | confirmed: "Your email address has been successfully confirmed."
7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9 | failure:
10 | already_authenticated: "You are already signed in."
11 | inactive: "Your account is not activated yet."
12 | invalid: "Invalid %{authentication_keys} or password."
13 | locked: "Your account is locked."
14 | last_attempt: "You have one more attempt before your account is locked."
15 | not_found_in_database: "Invalid %{authentication_keys} or password."
16 | timeout: "Your session expired. Please sign in again to continue."
17 | unauthenticated: "You need to sign in or sign up before continuing."
18 | unconfirmed: "You have to confirm your email address before continuing."
19 | mailer:
20 | confirmation_instructions:
21 | subject: "Confirmation instructions"
22 | reset_password_instructions:
23 | subject: "Reset password instructions"
24 | unlock_instructions:
25 | subject: "Unlock instructions"
26 | email_changed:
27 | subject: "Email Changed"
28 | password_change:
29 | subject: "Password Changed"
30 | omniauth_callbacks:
31 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
32 | success: "Successfully authenticated from %{kind} account."
33 | passwords:
34 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
35 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
36 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
37 | updated: "Your password has been changed successfully. You are now signed in."
38 | updated_not_active: "Your password has been changed successfully."
39 | registrations:
40 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
41 | signed_up: "Welcome! You have signed up successfully."
42 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
43 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
44 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
45 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
46 | updated: "Your account has been updated successfully."
47 | updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again"
48 | sessions:
49 | signed_in: "Signed in successfully."
50 | signed_out: "Signed out successfully."
51 | already_signed_out: "Signed out successfully."
52 | unlocks:
53 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
54 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
55 | unlocked: "Your account has been unlocked successfully. Please sign in to continue."
56 | errors:
57 | messages:
58 | already_confirmed: "was already confirmed, please try signing in"
59 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
60 | expired: "has expired, please request a new one"
61 | not_found: "not found"
62 | not_locked: "was not locked"
63 | not_saved:
64 | one: "1 error prohibited this %{resource} from being saved:"
65 | other: "%{count} errors prohibited this %{resource} from being saved:"
66 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # The following keys must be escaped otherwise they will not be retrieved by
20 | # the default I18n backend:
21 | #
22 | # true, false, on, off, yes, no
23 | #
24 | # Instead, surround them with single quotes.
25 | #
26 | # en:
27 | # 'true': 'foo'
28 | #
29 | # To learn more, please read the Rails Internationalization guide
30 | # available at http://guides.rubyonrails.org/i18n.html.
31 |
32 | en:
33 | hello: "Hello world"
34 |
--------------------------------------------------------------------------------
/config/puma.rb:
--------------------------------------------------------------------------------
1 | # Puma can serve each request in a thread from an internal thread pool.
2 | # The `threads` method setting takes two numbers: a minimum and maximum.
3 | # Any libraries that use thread pools should be configured to match
4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum
5 | # and maximum; this matches the default thread size of Active Record.
6 | #
7 | workers Integer(ENV['WEB_CONCURRENCY'] || 2)
8 | threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
9 | threads threads_count, threads_count
10 |
11 | preload_app!
12 |
13 | rackup DefaultRackup
14 | port ENV['PORT'] || 3000
15 | environment ENV['RACK_ENV'] || 'development'
16 |
17 | on_worker_boot do
18 | # Worker specific setup for Rails 4.1+
19 | # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
20 | ActiveRecord::Base.establish_connection
21 | end
22 |
23 | # threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
24 | # threads threads_count, threads_count
25 |
26 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
27 | #
28 | # port ENV.fetch("PORT") { 3000 }
29 |
30 | # Specifies the `environment` that Puma will run in.
31 | #
32 | # environment ENV.fetch("RAILS_ENV") { "development" }
33 |
34 | # Specifies the number of `workers` to boot in clustered mode.
35 | # Workers are forked webserver processes. If using threads and workers together
36 | # the concurrency of the application would be max `threads` * `workers`.
37 | # Workers do not work on JRuby or Windows (both of which do not support
38 | # processes).
39 | #
40 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
41 |
42 | # Use the `preload_app!` method when specifying a `workers` number.
43 | # This directive tells Puma to first boot the application and load code
44 | # before forking the application. This takes advantage of Copy On Write
45 | # process behavior so workers use less memory.
46 | #
47 | # preload_app!
48 |
49 | # Allow puma to be restarted by `rails restart` command.
50 | plugin :tmp_restart
51 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 |
3 | root to: 'users#index'
4 | # root to: "devise/registrations#new"
5 | devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
6 | resources :users, only: [:index, :show]
7 | resources :posts
8 | resources :comments#, only: [:create, :show]
9 | resources :likes
10 |
11 | post '/cancelfriend', to: 'friendships#cancel', as: 'cancelfriend'
12 | post '/acceptfriend', to: 'friendships#create'
13 | post '/deletefriend', to: 'friendships#destroy'
14 | resources :friendships, only: [:index, :show, :update]
15 | get 'friends', to: 'users#friends'
16 | # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
17 | end
18 |
--------------------------------------------------------------------------------
/config/spring.rb:
--------------------------------------------------------------------------------
1 | %w[
2 | .ruby-version
3 | .rbenv-vars
4 | tmp/restart.txt
5 | tmp/caching-dev.txt
6 | ].each { |path| Spring.watch(path) }
7 |
--------------------------------------------------------------------------------
/config/storage.yml:
--------------------------------------------------------------------------------
1 | test:
2 | service: Disk
3 | root: <%= Rails.root.join("tmp/storage") %>
4 |
5 | local:
6 | service: Disk
7 | root: <%= Rails.root.join("storage") %>
8 |
9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10 | # amazon:
11 | # service: S3
12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14 | # region: us-east-1
15 | # bucket: your_own_bucket
16 |
17 | # Remember not to checkin your GCS keyfile to a repository
18 | # google:
19 | # service: GCS
20 | # project: your_project
21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22 | # bucket: your_own_bucket
23 |
24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25 | # microsoft:
26 | # service: AzureStorage
27 | # storage_account_name: your_account_name
28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29 | # container: your_container_name
30 |
31 | # mirror:
32 | # service: Mirror
33 | # primary: local
34 | # mirrors: [ amazon, google, microsoft ]
35 |
--------------------------------------------------------------------------------
/db/migrate/20191218100616_devise_create_users.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class DeviseCreateUsers < ActiveRecord::Migration[5.2]
4 | def change
5 | create_table :users do |t|
6 | ## Database authenticatable
7 | t.string :email, null: false, default: ''
8 | t.string :encrypted_password, null: false, default: ''
9 |
10 | ## Recoverable
11 | t.string :reset_password_token
12 | t.datetime :reset_password_sent_at
13 |
14 | ## Rememberable
15 | t.datetime :remember_created_at
16 |
17 | ## Trackable
18 | # t.integer :sign_in_count, default: 0, null: false
19 | # t.datetime :current_sign_in_at
20 | # t.datetime :last_sign_in_at
21 | # t.inet :current_sign_in_ip
22 | # t.inet :last_sign_in_ip
23 |
24 | ## Confirmable
25 | # t.string :confirmation_token
26 | # t.datetime :confirmed_at
27 | # t.datetime :confirmation_sent_at
28 | # t.string :unconfirmed_email # Only if using reconfirmable
29 |
30 | ## Lockable
31 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
32 | # t.string :unlock_token # Only if unlock strategy is :email or :both
33 | # t.datetime :locked_at
34 |
35 | t.timestamps null: false
36 | end
37 |
38 | add_index :users, :email, unique: true
39 | add_index :users, :reset_password_token, unique: true
40 | # add_index :users, :confirmation_token, unique: true
41 | # add_index :users, :unlock_token, unique: true
42 | end
43 | end
44 |
--------------------------------------------------------------------------------
/db/migrate/20191218101601_add_name_to_user.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class AddNameToUser < ActiveRecord::Migration[5.2]
4 | def change
5 | add_column :users, :first_name, :string
6 | add_column :users, :last_name, :string
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/db/migrate/20191220094351_create_posts.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreatePosts < ActiveRecord::Migration[5.2]
4 | def change
5 | create_table :posts do |t|
6 | t.text :post_text
7 | t.integer :user_id
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/db/migrate/20200110091652_create_comments.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreateComments < ActiveRecord::Migration[5.2]
4 | def change
5 | create_table :comments do |t|
6 | t.references :user
7 | t.references :post
8 | t.text :comment_text
9 |
10 | t.timestamps
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/db/migrate/20200113135148_create_likes.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreateLikes < ActiveRecord::Migration[5.2]
4 | def change
5 | create_table :likes do |t|
6 | t.references :user, foreign_key: true
7 | t.references :post, foreign_key: true
8 |
9 | t.timestamps
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/db/migrate/20200116091354_create_friendships.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreateFriendships < ActiveRecord::Migration[5.2]
4 | def change
5 | create_table :friendships do |t|
6 | t.references :user, index: true, foreign_key: true
7 | t.references :friend, index: true
8 | t.boolean :confirmed
9 |
10 | t.timestamps
11 | end
12 | add_foreign_key :friendships, :users, column: :friend_id
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/db/migrate/20200124103907_add_omniauth_to_users.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class AddOmniauthToUsers < ActiveRecord::Migration[5.2]
4 | def change
5 | add_column :users, :provider, :string
6 | add_column :users, :uid, :string
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # This file is auto-generated from the current state of the database. Instead
2 | # of editing this file, please use the migrations feature of Active Record to
3 | # incrementally modify your database, and then regenerate this schema definition.
4 | #
5 | # Note that this schema.rb definition is the authoritative source for your
6 | # database schema. If you need to create the application database on another
7 | # system, you should be using db:schema:load, not running all the migrations
8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 | # you'll amass, the slower it'll run and the greater likelihood for issues).
10 | #
11 | # It's strongly recommended that you check this file into your version control system.
12 |
13 | ActiveRecord::Schema.define(version: 2020_01_24_103907) do
14 |
15 | # These are extensions that must be enabled in order to support this database
16 | enable_extension "plpgsql"
17 |
18 | create_table "comments", force: :cascade do |t|
19 | t.bigint "user_id"
20 | t.bigint "post_id"
21 | t.text "comment_text"
22 | t.datetime "created_at", null: false
23 | t.datetime "updated_at", null: false
24 | t.index ["post_id"], name: "index_comments_on_post_id"
25 | t.index ["user_id"], name: "index_comments_on_user_id"
26 | end
27 |
28 | create_table "friendships", force: :cascade do |t|
29 | t.bigint "user_id"
30 | t.bigint "friend_id"
31 | t.boolean "confirmed"
32 | t.datetime "created_at", null: false
33 | t.datetime "updated_at", null: false
34 | t.index ["friend_id"], name: "index_friendships_on_friend_id"
35 | t.index ["user_id"], name: "index_friendships_on_user_id"
36 | end
37 |
38 | create_table "likes", force: :cascade do |t|
39 | t.bigint "user_id"
40 | t.bigint "post_id"
41 | t.datetime "created_at", null: false
42 | t.datetime "updated_at", null: false
43 | t.index ["post_id"], name: "index_likes_on_post_id"
44 | t.index ["user_id"], name: "index_likes_on_user_id"
45 | end
46 |
47 | create_table "posts", force: :cascade do |t|
48 | t.text "post_text"
49 | t.integer "user_id"
50 | end
51 |
52 | create_table "users", force: :cascade do |t|
53 | t.string "email", default: "", null: false
54 | t.string "encrypted_password", default: "", null: false
55 | t.string "reset_password_token"
56 | t.datetime "reset_password_sent_at"
57 | t.datetime "remember_created_at"
58 | t.datetime "created_at", null: false
59 | t.datetime "updated_at", null: false
60 | t.string "first_name"
61 | t.string "last_name"
62 | t.string "provider"
63 | t.string "uid"
64 | t.index ["email"], name: "index_users_on_email", unique: true
65 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
66 | end
67 |
68 | add_foreign_key "friendships", "users"
69 | add_foreign_key "friendships", "users", column: "friend_id"
70 | add_foreign_key "likes", "posts"
71 | add_foreign_key "likes", "users"
72 | end
73 |
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7 | # Character.create(name: 'Luke', movie: movies.first)
8 | User.create(
9 | first_name: "Nick",
10 | last_name: "Haras",
11 | email: 'nick@test.com' ,
12 | password: '123456' ,
13 | password_confirmation: '123456'
14 | )
15 |
16 | User.create(
17 | first_name: "Daniel",
18 | last_name: "Addo",
19 | email: 'daniel@test.com' ,
20 | password: '123456' ,
21 | password_confirmation: '123456'
22 | )
23 |
24 | User.create(
25 | first_name: "Michael",
26 | last_name: "Schumacher",
27 | email: 'michael@test.com' ,
28 | password: '123456' ,
29 | password_confirmation: '123456'
30 | )
31 |
32 | Post.create( post_text: 'Seed first post' ,
33 | user_id: 1 )
34 |
35 | Post.create( post_text: 'Seed Second post' ,
36 | user_id: 2)
--------------------------------------------------------------------------------
/docs/Milestone 1.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/docs/Milestone 1.pdf
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/lib/assets/.keep
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/lib/tasks/.keep
--------------------------------------------------------------------------------
/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/log/.keep
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "facebook-clone",
3 | "private": true,
4 | "dependencies": {}
5 | }
6 |
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/public/apple-touch-icon-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/public/apple-touch-icon-precomposed.png
--------------------------------------------------------------------------------
/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/public/apple-touch-icon.png
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/public/favicon.ico
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 |
--------------------------------------------------------------------------------
/spec/controllers/likes_controller_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'rails_helper'
4 |
5 | RSpec.describe LikesController, type: :controller do
6 | end
7 |
--------------------------------------------------------------------------------
/spec/features/comment_create_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'rails_helper'
4 | require 'spec_helper'
5 |
6 | feature 'Comments can be created' do
7 | scenario 'successfully' do
8 | visit '/users/sign_in'
9 | fill_in 'Email', with: 'nick@test.com'
10 | fill_in 'Password', with: '123456'
11 | click_button 'Log in'
12 | visit '/posts'
13 | fill_in 'comment-1', with: 'This is a test comment'
14 | click_button 'button-1'
15 | expect(page).to have_content('This is a test comment')
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/features/friendship_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'rails_helper'
4 | require 'spec_helper'
5 |
6 | RSpec.describe 'Testing friend request send, confirm and remove' do
7 | feature 'User can' do
8 | scenario 'send friend request successfully' do
9 | visit '/users/sign_in'
10 | fill_in 'Email', with: 'nick@test.com'
11 | fill_in 'Password', with: '123456'
12 | click_button 'Log in'
13 | visit root_path
14 | click_button 'button-2'
15 | expect(page).to have_content('Friend request sent successfully')
16 | end
17 |
18 | scenario 'confirm friend request successfully' do
19 | visit '/users/sign_in'
20 | fill_in 'Email', with: 'daniel@test.com'
21 | fill_in 'Password', with: '123456'
22 | click_button 'Log in'
23 | visit friendships_path
24 | click_button 'Confirm friend'
25 | expect(page).to have_content('Friendship confirmed')
26 | end
27 | end
28 |
29 | feature 'User can' do
30 | scenario 'remove friend successfully' do
31 | visit '/users/sign_in'
32 | fill_in 'Email', with: 'daniel@test.com'
33 | fill_in 'Password', with: '123456'
34 | click_button 'Log in'
35 | visit '/friends'
36 | click_button 'button-1'
37 | expect(page).to have_content('Friend removed successfully')
38 | end
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/spec/features/like_post_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'rails_helper'
4 | require 'spec_helper'
5 |
6 | feature 'User can like post' do
7 | scenario 'successfully' do
8 | visit '/users/sign_in'
9 | fill_in 'Email', with: 'nick@test.com'
10 | fill_in 'Password', with: '123456'
11 | click_button 'Log in'
12 | visit '/posts'
13 | click_button 'like-1'
14 | expect(page).to have_text('1')
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/spec/features/post_create_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # require 'rails_helper'
4 | # require 'spec_helper'
5 |
6 | # feature 'User can create a Post' do
7 | # scenario 'Successfully' do
8 | # visit '/posts/'
9 | # fill_in 'Post', with: 'This is a test post'
10 | # click_button 'Create Post'
11 | # expect(page).to have_content('This is a test post')
12 | # end
13 |
14 | # end
15 |
--------------------------------------------------------------------------------
/spec/features/user_actions_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'rails_helper'
4 | require 'spec_helper'
5 |
6 | def rnd_str
7 | (0...8).map { rand(97..122).chr }.join.capitalize
8 | end
9 |
10 | fname = rnd_str
11 |
12 | feature 'User' do
13 | scenario 'can create an account using the signup form' do
14 | visit '/users/sign_up'
15 | fill_in 'First name', with: fname
16 | fill_in 'Last name', with: rnd_str
17 | fill_in 'Email', with: "#{fname}@test.com"
18 | fill_in 'Password', with: 'foobar'
19 | fill_in 'Password confirmation', with: 'foobar'
20 | click_button 'Sign up'
21 | expect(page).to have_content('Welcome! You have signed up successfully')
22 | end
23 |
24 | scenario 'can log in using the log in form' do
25 | visit '/users/sign_in'
26 | fill_in 'Email', with: "#{fname}@test.com"
27 | fill_in 'Password', with: 'foobar'
28 | click_button 'Log in'
29 | expect(page).to have_content('Signed in successfully.')
30 | end
31 | end
32 |
33 | feature 'User also' do
34 | scenario 'can create a post' do
35 | visit '/users/sign_in'
36 | fill_in 'Email', with: "#{fname}@test.com"
37 | fill_in 'Password', with: 'foobar'
38 | click_button 'Log in'
39 | visit '/posts'
40 | fill_in 'post_post_text', with: 'This is a test post'
41 | click_button 'Create Post'
42 | expect(page).to have_content('This is a test post')
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/spec/models/comment_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'rails_helper'
4 |
5 | RSpec.describe Comment, type: :model do
6 | before(:all) do
7 | @comment = Comment.new(comment_text: 'this is a test', post_id: 1, user_id: 1)
8 | end
9 |
10 | context 'validates comment field' do
11 | it 'is not valid without a comment text' do
12 | @comment.comment_text = nil
13 | @comment.save
14 | expect(@comment.errors.full_messages).to include("Comment text can't be blank")
15 | @comment.comment_text = 'Some text for the comment'
16 | end
17 |
18 | it 'is not valid without a user_id' do
19 | @comment.user_id = nil
20 | @comment.save
21 | expect(@comment.errors.full_messages).to include('User must exist')
22 | end
23 |
24 | it 'is not valid without a post_id' do
25 | @comment.post_id = nil
26 | @comment.save
27 | expect(@comment.errors.full_messages).to include('Post must exist')
28 | end
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/spec/models/friendship_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'rails_helper'
4 |
5 | RSpec.describe Friendship, type: :model do
6 | before :each do
7 | @user1 = User.create(first_name: 'daniel', last_name: 'addo', email: 'daniel@test.com', password: '123456')
8 | @user2 = User.create(first_name: 'nick', last_name: 'haras', email: 'nick@test.com', password: '123456')
9 | end
10 |
11 | describe '#sender' do
12 | it 'have receiver' do
13 | request = @user2.friendships.build
14 | request.valid?
15 | expect(request.errors.full_messages).to include('Friend must exist')
16 |
17 | request = Friendship.new(user_id: @user1.id, friend_id: @user2.id)
18 | expect(request.valid?).to be(true)
19 | expect(request.errors.full_messages).to be_empty
20 | end
21 |
22 | it 'creates friendship request' do
23 | request = Friendship.new(user_id: @user1.id, friend_id: @user2.id)
24 | expect(request.valid?).to be(true)
25 | expect(request.user_id).to be @user1.id
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/spec/models/like_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'rails_helper'
4 |
5 | RSpec.describe Like, type: :model do
6 | before(:all) do
7 | @like = Like.new(user_id: 1, post_id: 1)
8 | end
9 |
10 | context 'validates like record' do
11 | it 'is not valid without a user_id' do
12 | @like.user_id = nil
13 | @like.save
14 | expect(@like.errors.full_messages).to include('User must exist')
15 | end
16 |
17 | it 'is not valid without a post_id' do
18 | @like.post_id = nil
19 | @like.save
20 | expect(@like.errors.full_messages).to include('Post must exist')
21 | end
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/spec/models/post_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'rails_helper'
4 |
5 | RSpec.describe Post, type: :model do
6 | before(:all) do
7 | @post = Post.new(post_text: 'Some text for the post', user_id: 4)
8 | end
9 |
10 | context 'validates post fields' do
11 | it 'is not valid without a post text' do
12 | @post.post_text = nil
13 | @post.save
14 | expect(@post.errors.full_messages).to include("Post text can't be blank")
15 | @post.post_text = 'Some text for the post'
16 | end
17 |
18 | it 'is not valid without a user_id' do
19 | @post.user_id = nil
20 | @post.save
21 | expect(@post.errors.full_messages).to include('User must exist')
22 | @post.user_id = 1
23 | end
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/spec/models/user_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'rails_helper'
4 |
5 | RSpec.describe User, type: :model do
6 | before(:all) do
7 | @user1 = User.new(first_name: 'Daniel', last_name: 'Addo', email: 'nick@gmail.com', password: 'foobar')
8 | end
9 |
10 | context 'validates user fields' do
11 | it 'is not valid without a first_name' do
12 | @user1.first_name = nil
13 | @user1.save
14 | expect(@user1.errors.full_messages).to include("First name can't be blank")
15 | @user1.first_name = 'Daniel'
16 | end
17 |
18 | it 'is not valid without a last_name' do
19 | @user1.last_name = nil
20 | @user1.save
21 | expect(@user1.errors.full_messages).to include("Last name can't be blank")
22 | @user1.last_name = 'Addo'
23 | end
24 |
25 | it 'is not valid without an email' do
26 | @user1.email = nil
27 | @user1.save
28 | expect(@user1.errors.full_messages).to include("Email can't be blank")
29 | @user1.email = 'test@test.com'
30 | end
31 |
32 | it 'is not valid without an password' do
33 | @user1.password = nil
34 | @user1.save
35 | expect(@user1.errors.full_messages).to include("Password can't be blank")
36 | @user1.password = 'foobar'
37 | end
38 | end
39 | end
40 |
--------------------------------------------------------------------------------
/spec/rails_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # This file is copied to spec/ when you run 'rails generate rspec:install'
4 | require 'spec_helper'
5 | require 'capybara/rspec'
6 | require 'database_cleaner'
7 | ENV['RAILS_ENV'] ||= 'test'
8 |
9 | require File.expand_path('../config/environment', __dir__)
10 |
11 | # Prevent database truncation if the environment is production
12 | abort('The Rails environment is running in production mode!') if Rails.env.production?
13 | require 'rspec/rails'
14 | # Add additional requires below this line. Rails is not loaded until this point!
15 |
16 | # Requires supporting ruby files with custom matchers and macros, etc, in
17 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
18 | # run as spec files by default. This means that files in spec/support that end
19 | # in _spec.rb will both be required and run as specs, causing the specs to be
20 | # run twice. It is recommended that you do not name files matching this glob to
21 | # end with _spec.rb. You can configure this pattern with the --pattern
22 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
23 | #
24 | # The following line is provided for convenience purposes. It has the downside
25 | # of increasing the boot-up time by auto-requiring all files in the support
26 | # directory. Alternatively, in the individual `*_spec.rb` files, manually
27 | # require only the support files necessary.
28 | #
29 | # Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
30 |
31 | # Checks for pending migrations and applies them before tests are run.
32 | # If you are not using ActiveRecord, you can remove these lines.
33 | begin
34 | ActiveRecord::Migration.maintain_test_schema!
35 | rescue ActiveRecord::PendingMigrationError => e
36 | puts e.to_s.strip
37 | exit 1
38 | end
39 | RSpec.configure do |config|
40 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
41 |
42 | config.fixture_path = "#{::Rails.root}/spec/fixtures"
43 |
44 | # If you're not using ActiveRecord, or you'd prefer not to run each of your
45 | # examples within a transaction, remove the following line or assign false
46 | # instead of true.
47 | config.use_transactional_fixtures = true
48 |
49 | # RSpec Rails can automatically mix in different behaviours to your tests
50 | # based on their file location, for example enabling you to call `get` and
51 | # `post` in specs under `spec/controllers`.
52 | #
53 | # You can disable this behaviour by removing the line below, and instead
54 | # explicitly tag your specs with their type, e.g.:
55 | #
56 | # RSpec.describe UsersController, :type => :controller do
57 | # # ...
58 | # end
59 | #
60 | # The different available types are documented in the features, such as in
61 | # https://relishapp.com/rspec/rspec-rails/docs
62 | config.infer_spec_type_from_file_location!
63 |
64 | # Filter lines from Rails gems in backtraces.
65 | config.filter_rails_from_backtrace!
66 | # arbitrary gems may also be filtered via:
67 | # config.filter_gems_from_backtrace("gem name")
68 | end
69 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'capybara/rspec'
4 | require 'selenium/webdriver'
5 |
6 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all
7 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
8 | # The generated `.rspec` file contains `--require spec_helper` which will cause
9 | # this file to always be loaded, without a need to explicitly require it in any
10 | # files.
11 |
12 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
13 | RSpec.configure do |config|
14 | # rspec-expectations config goes here. You can use an alternate
15 | # assertion/expectation library such as wrong or the stdlib/minitest
16 | # assertions if you prefer.
17 | config.expect_with :rspec do |expectations|
18 | # This option will default to `true` in RSpec 4. It makes the `description`
19 | # and `failure_message` of custom matchers include text for helper methods
20 | # defined using `chain`, e.g.:
21 | # be_bigger_than(2).and_smaller_than(4).description
22 | # # => "be bigger than 2 and smaller than 4"
23 | # ...rather than:
24 | # # => "be bigger than 2"
25 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true
26 | end
27 |
28 | # rspec-mocks config goes here. You can use an alternate test double
29 | # library (such as bogus or mocha) by changing the `mock_with` option here.
30 | config.mock_with :rspec do |mocks|
31 | # Prevents you from mocking or stubbing a method that does not exist on
32 | # a real object. This is generally recommended, and will default to
33 | # `true` in RSpec 4.
34 | mocks.verify_partial_doubles = true
35 | end
36 |
37 | # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
38 | # have no way to turn it off -- the option exists only for backwards
39 | # compatibility in RSpec 3). It causes shared context metadata to be
40 | # inherited by the metadata hash of host groups and examples, rather than
41 | # triggering implicit auto-inclusion in groups with matching metadata.
42 | config.shared_context_metadata_behavior = :apply_to_host_groups
43 | config.disable_monkey_patching = false
44 | # The settings below are suggested to provide a good initial experience
45 | # with RSpec, but feel free to customize to your heart's content.
46 | # # This allows you to limit a spec run to individual examples or groups
47 | # # you care about by tagging them with `:focus` metadata. When nothing
48 | # # is tagged with `:focus`, all examples get run. RSpec also provides
49 | # # aliases for `it`, `describe`, and `context` that include `:focus`
50 | # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
51 | # config.filter_run_when_matching :focus
52 | #
53 | # # Allows RSpec to persist some state between runs in order to support
54 | # # the `--only-failures` and `--next-failure` CLI options. We recommend
55 | # # you configure your source control system to ignore this file.
56 | # config.example_status_persistence_file_path = "spec/examples.txt"
57 | #
58 | # # Limits the available syntax to the non-monkey patched syntax that is
59 | # # recommended. For more details, see:
60 | # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
61 | # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
62 | # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
63 | # config.disable_monkey_patching!
64 | #
65 | # # Many RSpec users commonly either run the entire suite or an individual
66 | # # file, and it's useful to allow more verbose output when running an
67 | # # individual spec file.
68 | # if config.files_to_run.one?
69 | # # Use the documentation formatter for detailed output,
70 | # # unless a formatter has already been configured
71 | # # (e.g. via a command-line flag).
72 | # config.default_formatter = "doc"
73 | # end
74 | #
75 | # # Print the 10 slowest examples and example groups at the
76 | # # end of the spec run, to help surface which specs are running
77 | # # particularly slow.
78 | # config.profile_examples = 10
79 | #
80 | # # Run specs in random order to surface order dependencies. If you find an
81 | # # order dependency and want to debug it, you can fix the order by providing
82 | # # the seed, which is printed after each run.
83 | # # --seed 1234
84 | # config.order = :random
85 | #
86 | # # Seed global randomization in this process using the `--seed` CLI option.
87 | # # Setting this allows you to use `--seed` to deterministically reproduce
88 | # # test failures related to randomization by passing the same `--seed` value
89 | # # as the one that triggered the failure.
90 | # Kernel.srand config.seed
91 | end
92 |
93 | Capybara.register_driver :selenium do |app|
94 | Capybara::Selenium::Driver.new(app, browser: :chrome)
95 | end
96 |
97 | Capybara.configure do |config|
98 | config.run_server = false
99 | config.default_driver = :selenium
100 | config.app_host = 'localhost:3000' # change url
101 | end
102 |
--------------------------------------------------------------------------------
/storage/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/storage/.keep
--------------------------------------------------------------------------------
/test/application_system_test_case.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'test_helper'
4 |
5 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
6 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
7 | end
8 |
--------------------------------------------------------------------------------
/test/controllers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/test/controllers/.keep
--------------------------------------------------------------------------------
/test/controllers/users_controller_test.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'test_helper'
4 |
5 | class UsersControllerTest < ActionDispatch::IntegrationTest
6 | # test "the truth" do
7 | # assert true
8 | # end
9 | end
10 |
--------------------------------------------------------------------------------
/test/fixtures/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/test/fixtures/.keep
--------------------------------------------------------------------------------
/test/fixtures/files/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/test/fixtures/files/.keep
--------------------------------------------------------------------------------
/test/fixtures/users.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | # This model initially had no columns defined. If you add columns to the
4 | # model remove the '{}' from the fixture names and add the columns immediately
5 | # below each fixture, per the syntax in the comments below
6 | #
7 | one: {}
8 | # column: value
9 | #
10 | two: {}
11 | # column: value
12 |
--------------------------------------------------------------------------------
/test/helpers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/test/helpers/.keep
--------------------------------------------------------------------------------
/test/integration/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/test/integration/.keep
--------------------------------------------------------------------------------
/test/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/test/mailers/.keep
--------------------------------------------------------------------------------
/test/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/test/models/.keep
--------------------------------------------------------------------------------
/test/models/user_test.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'test_helper'
4 |
5 | class UserTest < ActiveSupport::TestCase
6 | # test "the truth" do
7 | # assert true
8 | # end
9 | end
10 |
--------------------------------------------------------------------------------
/test/system/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/test/system/.keep
--------------------------------------------------------------------------------
/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ENV['RAILS_ENV'] ||= 'test'
4 | require_relative '../config/environment'
5 | require 'rails/test_help'
6 |
7 | class ActiveSupport::TestCase
8 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
9 | fixtures :all
10 |
11 | # Add more helper methods to be used by all tests here...
12 | end
13 |
--------------------------------------------------------------------------------
/tmp/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/tmp/.keep
--------------------------------------------------------------------------------
/vendor/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/addod19/facebook-clone/69faa6903893947c3d024ace61377ba711575f4a/vendor/.keep
--------------------------------------------------------------------------------