3 |
4 | <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
5 | <%= devise_error_messages! %>
6 |
7 |
19 |
--------------------------------------------------------------------------------
/app/views/users/mailer/confirmation_instructions.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
Welcome <%= @email %>!
3 |
4 |
You can confirm your account email through the link below:
5 |
6 |
<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>
7 |
8 |
--------------------------------------------------------------------------------
/app/views/users/mailer/email_changed.html.erb:
--------------------------------------------------------------------------------
1 |
Hello <%= @email %>!
2 |
3 | <% if @resource.try(:unconfirmed_email?) %>
4 |
We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.
5 | <% else %>
6 |
We're contacting you to notify you that your email has been changed to <%= @resource.email %>.
7 | <% end %>
8 |
--------------------------------------------------------------------------------
/app/views/users/mailer/password_change.html.erb:
--------------------------------------------------------------------------------
1 |
Hello <%= @resource.email %>!
2 |
3 |
We're contacting you to notify you that your password has been changed.
4 |
--------------------------------------------------------------------------------
/app/views/users/mailer/reset_password_instructions.html.erb:
--------------------------------------------------------------------------------
1 |
Hello <%= @resource.email %>!
2 |
3 |
Someone has requested a link to change your password. You can do this through the link below.
4 |
5 |
<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>
6 |
7 |
If you didn't request this, please ignore this email.
8 |
Your password won't change until you access the link above and create a new one.
9 |
--------------------------------------------------------------------------------
/app/views/users/mailer/unlock_instructions.html.erb:
--------------------------------------------------------------------------------
1 |
Hello <%= @resource.email %>!
2 |
3 |
Your account has been locked due to an excessive number of unsuccessful sign in attempts.
4 |
5 |
Click the link below to unlock your account:
6 |
7 |
<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>
8 |
--------------------------------------------------------------------------------
/app/views/users/passwords/edit.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
Change your password
3 |
4 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
5 | <%= devise_error_messages! %>
6 | <%= f.hidden_field :reset_password_token %>
7 |
8 |
9 | <%= f.label :password, "New password" %>
10 | <% if @minimum_password_length %>
11 | (<%= @minimum_password_length %> characters minimum)
12 | <% end %>
13 | <%= f.password_field :password, autofocus: true, autocomplete: "off" %>
14 |
15 |
16 |
17 | <%= f.label :password_confirmation, "Confirm new password" %>
18 | <%= f.password_field :password_confirmation, autocomplete: "off" %>
19 |
20 |
21 |
22 | <%= f.submit "Change my password" %>
23 |
24 | <% end %>
25 |
26 | <%= render "devise/shared/links" %>
27 |
28 |
--------------------------------------------------------------------------------
/app/views/users/passwords/new.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
Forgot your password?
3 |
4 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
5 | <%= devise_error_messages! %>
6 |
7 |
8 | <%= f.label :email %>
9 | <%= f.email_field :email, autofocus: true %>
10 |
11 |
12 |
13 | <%= f.submit "Send me reset password instructions" %>
14 |
15 | <% end %>
16 |
17 | <%= render "devise/shared/links" %>
18 |
19 |
--------------------------------------------------------------------------------
/app/views/users/registrations/edit.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
Change Password/Email
3 |
54 |
55 |
--------------------------------------------------------------------------------
/app/views/users/registrations/new.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
Sign up
3 |
4 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
5 | <%= devise_error_messages! %>
6 |
7 |
8 | <%= f.label :email %>
9 | <%= f.email_field :email, autofocus: true %>
10 |
11 |
12 |
13 | <%= f.label :password %>
14 | <% if @minimum_password_length %>
15 | (<%= @minimum_password_length %> characters minimum)
16 | <% end %>
17 | <%= f.password_field :password, autocomplete: "off" %>
18 |
19 |
20 |
21 | <%= f.label :password_confirmation %>
22 | <%= f.password_field :password_confirmation, autocomplete: "off" %>
23 |
24 |
25 |
26 | <%= f.submit "Sign up" %>
27 |
28 | <% end %>
29 |
30 | <%= render "devise/shared/links" %>
31 |
32 |
--------------------------------------------------------------------------------
/app/views/users/sessions/new.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
Log in
3 |
4 | <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, autofocus: true %>
8 |
9 |
10 |
11 | <%= f.label :password %>
12 | <%= f.password_field :password, autocomplete: "off" %>
13 |
14 |
15 | <% if devise_mapping.rememberable? -%>
16 |
17 | <%= f.label :remember_me %>
18 | <%= f.check_box :remember_me %>
19 |
20 | <% end -%>
21 |
22 |
23 | <%= f.submit "Log in" %>
24 |
25 | <% end %>
26 |
27 | <%= render "devise/shared/links" %>
28 |
29 |
--------------------------------------------------------------------------------
/app/views/users/shared/_links.html.erb:
--------------------------------------------------------------------------------
1 | <%- if controller_name != 'sessions' %>
2 | <%= link_to "Log in", new_session_path(resource_name) %>
3 | <% end -%>
4 |
5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end -%>
8 |
9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end -%>
12 |
13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end -%>
16 |
17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end -%>
20 |
21 | <%- if devise_mapping.omniauthable? %>
22 | <%- resource_class.omniauth_providers.each do |provider| %>
23 | <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
24 | <% end -%>
25 | <% end -%>
26 |
--------------------------------------------------------------------------------
/app/views/users/unlocks/new.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
Resend unlock instructions
3 |
4 | <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
5 | <%= devise_error_messages! %>
6 |
7 |
8 | <%= f.label :email %>
9 | <%= f.email_field :email, autofocus: true %>
10 |
11 |
12 |
13 | <%= f.submit "Resend unlock instructions" %>
14 |
15 | <% end %>
16 |
17 | <%= render "devise/shared/links" %>
18 |
19 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path('../spring', __FILE__)
4 | rescue LoadError => e
5 | raise unless e.message.include?('spring')
6 | end
7 | APP_PATH = File.expand_path('../config/application', __dir__)
8 | require_relative '../config/boot'
9 | require 'rails/commands'
10 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path('../spring', __FILE__)
4 | rescue LoadError => e
5 | raise unless e.message.include?('spring')
6 | end
7 | require_relative '../config/boot'
8 | require 'rake'
9 | Rake.application.run
10 |
--------------------------------------------------------------------------------
/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'pathname'
3 | require 'fileutils'
4 | include FileUtils
5 |
6 | # path to your application root.
7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8 |
9 | def system!(*args)
10 | system(*args) || abort("\n== Command #{args} failed ==")
11 | end
12 |
13 | chdir APP_ROOT do
14 | # This script is a starting point to setup your application.
15 | # Add necessary setup steps to this file.
16 |
17 | puts '== Installing dependencies =='
18 | system! 'gem install bundler --conservative'
19 | system('bundle check') || system!('bundle install')
20 |
21 | # Install JavaScript dependencies if using Yarn
22 | # system('bin/yarn')
23 |
24 |
25 | # puts "\n== Copying sample files =="
26 | # unless File.exist?('config/database.yml')
27 | # cp 'config/database.yml.sample', 'config/database.yml'
28 | # end
29 |
30 | puts "\n== Preparing database =="
31 | system! 'bin/rails db:setup'
32 |
33 | puts "\n== Removing old logs and tempfiles =="
34 | system! 'bin/rails log:clear tmp:clear'
35 |
36 | puts "\n== Restarting application server =="
37 | system! 'bin/rails restart'
38 | end
39 |
--------------------------------------------------------------------------------
/bin/spring:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # This file loads spring without using Bundler, in order to be fast.
4 | # It gets overwritten when you run the `spring binstub` command.
5 |
6 | unless defined?(Spring)
7 | require 'rubygems'
8 | require 'bundler'
9 |
10 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
11 | spring = lockfile.specs.detect { |spec| spec.name == "spring" }
12 | if spring
13 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
14 | gem 'spring', spring.version
15 | require 'spring/binstub'
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/bin/update:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'pathname'
3 | require 'fileutils'
4 | include FileUtils
5 |
6 | # path to your application root.
7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8 |
9 | def system!(*args)
10 | system(*args) || abort("\n== Command #{args} failed ==")
11 | end
12 |
13 | chdir APP_ROOT do
14 | # This script is a way to update your development environment automatically.
15 | # Add necessary update steps to this file.
16 |
17 | puts '== Installing dependencies =='
18 | system! 'gem install bundler --conservative'
19 | system('bundle check') || system!('bundle install')
20 |
21 | puts "\n== Updating database =="
22 | system! 'bin/rails db:migrate'
23 |
24 | puts "\n== Removing old logs and tempfiles =="
25 | system! 'bin/rails log:clear tmp:clear'
26 |
27 | puts "\n== Restarting application server =="
28 | system! 'bin/rails restart'
29 | end
30 |
--------------------------------------------------------------------------------
/bin/yarn:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | VENDOR_PATH = File.expand_path('..', __dir__)
3 | Dir.chdir(VENDOR_PATH) do
4 | begin
5 | exec "yarnpkg #{ARGV.join(" ")}"
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 | # This file is used by Rack-based servers to start the application.
2 |
3 | require_relative 'config/environment'
4 |
5 | run Rails.application
6 |
--------------------------------------------------------------------------------
/config/application.example.yml:
--------------------------------------------------------------------------------
1 | MAILGUN_API_KEY: YOUR KEY
2 | MAILGUN_DOMAIN: YOUR DOMAIN
3 | S3_KEY: YOUR KEY
4 | S3_SECRET: YOUR SECRET
5 | S3_REGION: YOUR REGION
6 | S3_BUCKET: YOUR BUCKET
7 |
--------------------------------------------------------------------------------
/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 MyDevPortalDashboard
10 | class Application < Rails::Application
11 | # Initialize configuration defaults for originally generated Rails version.
12 | config.load_defaults 5.1
13 |
14 | # Settings in config/environments/* take precedence over those specified here.
15 | # Application configuration should go into files in config/initializers
16 | # -- all .rb files in that directory are automatically loaded.
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/config/cable.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: async
3 |
4 | test:
5 | adapter: async
6 |
7 | production:
8 | adapter: redis
9 | url: redis://localhost:6379/1
10 | channel_prefix: my_dev_portal_dashboard_production
11 |
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | # SQLite version 3.x
2 | # gem install sqlite3
3 | #
4 | # Ensure the SQLite 3 gem is defined in your Gemfile
5 | # gem 'sqlite3'
6 | #
7 | default: &default
8 | adapter: postgresql
9 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10 | timeout: 5000
11 |
12 |
13 | development:
14 | <<: *default
15 | database: my_dev_portal_development
16 |
17 | # Warning: The database defined as "test" will be erased and
18 | # re-generated from your development database when you run "rake".
19 | # Do not set this db to the same as development or production.
20 | test:
21 | <<: *default
22 | database: my_dev_portal_test
23 |
24 | production:
25 | <<: *default
26 | database: my_dev_portal_production
27 |
--------------------------------------------------------------------------------
/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 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Do not eager load code on boot.
10 | config.eager_load = false
11 |
12 | # Show full error reports.
13 | config.consider_all_requests_local = true
14 |
15 | # Enable/disable caching. By default caching is disabled.
16 | if Rails.root.join('tmp/caching-dev.txt').exist?
17 | config.action_controller.perform_caching = true
18 |
19 | config.cache_store = :memory_store
20 | config.public_file_server.headers = {
21 | 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
22 | }
23 | else
24 | config.action_controller.perform_caching = false
25 |
26 | config.cache_store = :null_store
27 | end
28 |
29 | config.action_mailer.perform_deliveries = true
30 | config.action_mailer.raise_delivery_errors = true
31 | config.action_mailer.default :charset => "utf-8"
32 | config.action_mailer.default_url_options = { host: 'localhost:3000' }
33 | config.action_mailer.delivery_method = :smtp
34 | config.action_mailer.mailgun_settings = {
35 | api_key: ENV['MAILGUN_API_KEY'],
36 | domain: ENV['MAILGUN_DOMAIN']
37 | }
38 |
39 | # Don't care if the mailer can't send.
40 | config.action_mailer.raise_delivery_errors = false
41 |
42 | config.action_mailer.perform_caching = false
43 |
44 | # Print deprecation notices to the Rails logger.
45 | config.active_support.deprecation = :log
46 |
47 | # Raise an error on page load if there are pending migrations.
48 | config.active_record.migration_error = :page_load
49 |
50 | # Debug mode disables concatenation and preprocessing of assets.
51 | # This option may cause significant delays in view rendering with a large
52 | # number of complex assets.
53 | config.assets.debug = true
54 |
55 | # Suppress logger output for asset requests.
56 | config.assets.quiet = true
57 |
58 | # Raises error for missing translations
59 | # config.action_view.raise_on_missing_translations = true
60 |
61 | # Use an evented file watcher to asynchronously detect changes in source code,
62 | # routes, locales, etc. This feature depends on the listen gem.
63 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker
64 | end
65 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure public file server for tests with Cache-Control for performance.
16 | config.public_file_server.enabled = true
17 | config.public_file_server.headers = {
18 | 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
19 | }
20 |
21 | # Show full error reports and disable caching.
22 | config.consider_all_requests_local = true
23 | config.action_controller.perform_caching = false
24 |
25 | # Raise exceptions instead of rendering exception templates.
26 | config.action_dispatch.show_exceptions = false
27 |
28 | # Disable request forgery protection in test environment.
29 | config.action_controller.allow_forgery_protection = false
30 | config.action_mailer.perform_caching = false
31 |
32 | # Tell Action Mailer not to deliver emails to the real world.
33 | # The :test delivery method accumulates sent emails in the
34 | # ActionMailer::Base.deliveries array.
35 | config.action_mailer.delivery_method = :test
36 |
37 | # Print deprecation notices to the stderr.
38 | config.active_support.deprecation = :stderr
39 |
40 | # Raises error for missing translations
41 | # config.action_view.raise_on_missing_translations = true
42 | end
43 |
--------------------------------------------------------------------------------
/config/initializers/application_controller_renderer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # ActiveSupport::Reloader.to_prepare do
4 | # ApplicationController.renderer.defaults.merge!(
5 | # http_host: 'example.org',
6 | # https: false
7 | # )
8 | # end
9 |
--------------------------------------------------------------------------------
/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | Rails.application.config.assets.version = '1.0'
5 |
6 | # Add additional assets to the asset load path.
7 | # Rails.application.config.assets.paths << Emoji.images_path
8 | # Add Yarn node_modules folder to the asset load path.
9 | Rails.application.config.assets.paths << Rails.root.join('node_modules')
10 |
11 | # Precompile additional assets.
12 | # application.js, application.css, and all non-JS/CSS in the app/assets
13 | # folder are already added.
14 | Rails.application.config.assets.precompile += %w[application-dashboard.css
15 | application-themes.css
16 | component-slider.css
17 | dashboard.js
18 | portfolio.js
19 | filterrific/filterrific-spinner.gif]
20 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/config/initializers/carrier_wave.rb:
--------------------------------------------------------------------------------
1 | require 'carrierwave/orm/activerecord'
2 | # put this in config/initializers/carrierwave.rb
3 | module CarrierWave
4 | module MiniMagick
5 | def quality(percentage)
6 | manipulate! do |img|
7 | img.quality(percentage.to_s)
8 | img = yield(img) if block_given?
9 | img
10 | end
11 | end
12 | end
13 | end
14 |
15 | CarrierWave.configure do |config|
16 | config.fog_provider = 'fog/aws'
17 | config.fog_credentials = {
18 | provider: 'AWS',
19 | aws_access_key_id: ENV['S3_KEY'],
20 | aws_secret_access_key: ENV['S3_SECRET'],
21 | region: ENV['S3_REGION'],
22 | }
23 | config.fog_directory = ENV['S3_BUCKET']
24 | end
25 |
--------------------------------------------------------------------------------
/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Specify a serializer for the signed and encrypted cookie jars.
4 | # Valid options are :json, :marshal, and :hybrid.
5 | Rails.application.config.action_dispatch.cookies_serializer = :json
6 |
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/config/initializers/themes.rb:
--------------------------------------------------------------------------------
1 | # Creats an array of themes from the app/views/portfolios/themes
2 | class Themes
3 | def self.array
4 | @array ||= Dir['app/views/front_end/portfolio/themes/*']
5 | .map { |file| file.rpartition('/').last.partition('.').first[1..-1] }
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActiveSupport.on_load(:action_controller) do
8 | wrap_parameters format: [:json]
9 | end
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/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 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8 | threads threads_count, threads_count
9 |
10 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11 | #
12 | port ENV.fetch("PORT") { 3000 }
13 |
14 | # Specifies the `environment` that Puma will run in.
15 | #
16 | environment ENV.fetch("RAILS_ENV") { "development" }
17 |
18 | # Specifies the number of `workers` to boot in clustered mode.
19 | # Workers are forked webserver processes. If using threads and workers together
20 | # the concurrency of the application would be max `threads` * `workers`.
21 | # Workers do not work on JRuby or Windows (both of which do not support
22 | # processes).
23 | #
24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25 |
26 | # Use the `preload_app!` method when specifying a `workers` number.
27 | # This directive tells Puma to first boot the application and load code
28 | # before forking the application. This takes advantage of Copy On Write
29 | # process behavior so workers use less memory. If you use this option
30 | # you need to make sure to reconnect any threads in the `on_worker_boot`
31 | # block.
32 | #
33 | # preload_app!
34 |
35 | # If you are preloading your application and using Active Record, it's
36 | # recommended that you close any connections to the database before workers
37 | # are forked to prevent connection leakage.
38 | #
39 | # before_fork do
40 | # ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
41 | # end
42 |
43 | # The code in the `on_worker_boot` will be called if you are using
44 | # clustered mode by specifying a number of `workers`. After each worker
45 | # process is booted, this block will be run. If you are using the `preload_app!`
46 | # option, you will want to use this block to reconnect to any threads
47 | # or connections that may have been created at application boot, as Ruby
48 | # cannot share connections between processes.
49 | #
50 | # on_worker_boot do
51 | # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
52 | # end
53 | #
54 |
55 | # Allow puma to be restarted by `rails restart` command.
56 | plugin :tmp_restart
57 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | root 'home#index'
3 | patch 'select_active_portfolio' => 'dashboard/users#update'
4 | get ':portfolio' => 'front_end/portfolio#show'
5 | get 'preview/:portfolio' => 'front_end/portfolio#preview'
6 |
7 | scope module: 'dashboard' do
8 | resources :portfolios, only: %i[] do
9 | resources :projects
10 | resources :technologies
11 | resources :portfolio_headers, only: %i[create update edit]
12 | resources :abouts
13 | end
14 | resources :users, only: %i[update] do
15 | resources :job_applications
16 | resources :portfolios, only: %i[create update destroy edit new]
17 | resources :dashboard, only: %i[index]
18 | resources :blogs, only: %i[show]
19 | end
20 | end
21 |
22 | devise_for :users, controllers: { sessions: 'users/sessions',
23 | registrations: 'users/registrations',
24 | passwords: 'users/passwords' }
25 | end
26 |
--------------------------------------------------------------------------------
/config/secrets.yml:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key is used for verifying the integrity of signed cookies.
4 | # If you change this key, all old signed cookies will become invalid!
5 |
6 | # Make sure the secret is at least 30 characters and all random,
7 | # no regular words or you'll be exposed to dictionary attacks.
8 | # You can use `rails secret` to generate a secure secret key.
9 |
10 | # Make sure the secrets in this file are kept private
11 | # if you're sharing your code publicly.
12 |
13 | # Shared secrets are available across all environments.
14 |
15 | # shared:
16 | # api_key: a1B2c3D4e5F6
17 |
18 | # Environmental secrets are only available for that specific environment.
19 |
20 | development:
21 | secret_key_base: 717a49eeb45ea23e8c045270aba101550dab360be8a1d9903d4f1e68ca69c8188a712daf7788571a47666006d71a61dab1948de6c7d9969073e3a4533fc41b7e
22 |
23 | test:
24 | secret_key_base: 361f9c6119bb20bc94a3c5679e383c6b7376ea9f714f167574dc2ecd07b5408cd6b27f1e69017fcccafefe360df30335ac2f1c4a60a37ed5412086c357a6ee62
25 |
26 | # Do not keep production secrets in the unencrypted secrets file.
27 | # Instead, either read values from the environment.
28 | # Or, use `bin/rails secrets:setup` to configure encrypted secrets
29 | # and move the `production:` environment over there.
30 |
31 | production:
32 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
33 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/db/migrate/20171204231450_devise_create_users.rb:
--------------------------------------------------------------------------------
1 | class DeviseCreateUsers < ActiveRecord::Migration[5.1]
2 | def change
3 | create_table :users do |t|
4 | ## Database authenticatable
5 | t.string :email, null: false, default: ""
6 | t.string :encrypted_password, null: false, default: ""
7 |
8 | ## Recoverable
9 | t.string :reset_password_token
10 | t.datetime :reset_password_sent_at
11 |
12 | ## Rememberable
13 | t.datetime :remember_created_at
14 |
15 | ## Trackable
16 | t.integer :sign_in_count, default: 0, null: false
17 | t.datetime :current_sign_in_at
18 | t.datetime :last_sign_in_at
19 | t.string :current_sign_in_ip
20 | t.string :last_sign_in_ip
21 |
22 | ## Confirmable
23 | # t.string :confirmation_token
24 | # t.datetime :confirmed_at
25 | # t.datetime :confirmation_sent_at
26 | # t.string :unconfirmed_email # Only if using reconfirmable
27 |
28 | ## Lockable
29 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30 | # t.string :unlock_token # Only if unlock strategy is :email or :both
31 | # t.datetime :locked_at
32 |
33 |
34 | t.timestamps null: false
35 | end
36 |
37 | add_index :users, :email, unique: true
38 | add_index :users, :reset_password_token, unique: true
39 | # add_index :users, :confirmation_token, unique: true
40 | # add_index :users, :unlock_token, unique: true
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/db/migrate/20171205193732_create_portfolios.rb:
--------------------------------------------------------------------------------
1 | class CreatePortfolios < ActiveRecord::Migration[5.1]
2 | def change
3 | create_table :portfolios do |t|
4 | t.references :user, foreign_key: true
5 | t.string :url
6 | t.string :theme
7 | t.string :color_one
8 | t.string :color_two
9 | t.string :color_three
10 | t.string :color_four
11 | t.string :font_color_one
12 | t.string :font_color_two
13 | t.boolean :show_cover_image
14 | t.boolean :show_avatar_image
15 | t.boolean :show_years_exp
16 | t.boolean :show_proficiency
17 |
18 | t.timestamps
19 | end
20 | add_index :portfolios, :url, unique: true
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/db/migrate/20171207235120_create_projects.rb:
--------------------------------------------------------------------------------
1 | class CreateProjects < ActiveRecord::Migration[5.1]
2 | def change
3 | create_table :projects do |t|
4 | t.references :portfolio, foreign_key: true
5 | t.string :title
6 | t.string :link
7 | t.text :description
8 | t.string :image
9 | t.text :tech
10 | t.string :role
11 | t.integer :order
12 |
13 | t.timestamps
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/db/migrate/20171210212628_create_technologies.rb:
--------------------------------------------------------------------------------
1 | class CreateTechnologies < ActiveRecord::Migration[5.1]
2 | def change
3 | create_table :technologies do |t|
4 | t.string :name, limit: 20
5 | t.references :portfolio, foreign_key: true
6 | t.integer :years_exp
7 | t.integer :proficiency
8 |
9 | t.timestamps
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/db/migrate/20171211213207_create_portfolio_headers.rb:
--------------------------------------------------------------------------------
1 | class CreatePortfolioHeaders < ActiveRecord::Migration[5.1]
2 | def change
3 | create_table :portfolio_headers do |t|
4 | t.belongs_to :portfolio, index: true
5 | t.string :header_one
6 | t.string :header_one_color
7 | t.string :header_two
8 | t.string :header_two_color
9 | t.string :cover_image
10 | t.string :avatar_image
11 |
12 | t.timestamps
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/db/migrate/20171212225416_create_abouts.rb:
--------------------------------------------------------------------------------
1 | class CreateAbouts < ActiveRecord::Migration[5.1]
2 | def change
3 | create_table :abouts do |t|
4 | t.references :portfolio, foreign_key: true
5 | t.text :about_me
6 | t.string :location
7 | t.string :about_me_brief
8 | t.string :email
9 | t.string :github
10 | t.string :linkedin
11 | t.string :twitter
12 | t.string :facebook
13 | t.string :website
14 |
15 | t.timestamps
16 | end
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/db/migrate/20171219205323_change_column_name.rb:
--------------------------------------------------------------------------------
1 | class ChangeColumnName < ActiveRecord::Migration[5.1]
2 | def change
3 | rename_column :projects, :descrption, :description
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/db/migrate/20171226173830_create_job_applications.rb:
--------------------------------------------------------------------------------
1 | class CreateJobApplications < ActiveRecord::Migration[5.1]
2 | def change
3 | create_table :job_applications do |t|
4 | t.references :user, foreign_key: true
5 | t.date :first_contact_date
6 | t.string :company_name
7 | t.string :company_website
8 | t.string :job_location
9 | t.string :enthusiasm
10 | t.string :job_title
11 | t.string :job_link
12 | t.string :referral
13 | t.string :referral_type
14 | t.string :status
15 | t.string :industry
16 | t.text :notes
17 |
18 | t.timestamps
19 | end
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/db/migrate/20171231161435_add_options_to_users.rb:
--------------------------------------------------------------------------------
1 | class AddOptionsToUsers < ActiveRecord::Migration[5.1]
2 | def change
3 | add_column :users, :options, :text
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/lib/assets/.keep
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/lib/tasks/.keep
--------------------------------------------------------------------------------
/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/log/.keep
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "my_dev_portal_dashboard",
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.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
The change you wanted was rejected (422)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The change you wanted was rejected.
62 |
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
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/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/apple-touch-icon-precomposed.png
--------------------------------------------------------------------------------
/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/apple-touch-icon.png
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/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 |
--------------------------------------------------------------------------------
/public/uploads/project/image/1/large_test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/uploads/project/image/1/large_test.jpg
--------------------------------------------------------------------------------
/public/uploads/project/image/1/medium_test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/uploads/project/image/1/medium_test.jpg
--------------------------------------------------------------------------------
/public/uploads/project/image/1/small_test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/uploads/project/image/1/small_test.jpg
--------------------------------------------------------------------------------
/public/uploads/project/image/1/test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/uploads/project/image/1/test.jpg
--------------------------------------------------------------------------------
/public/uploads/project/image/1/thumb_test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/uploads/project/image/1/thumb_test.jpg
--------------------------------------------------------------------------------
/public/uploads/tmp/1512691563-15357-0002-7928/IMG_0736.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/uploads/tmp/1512691563-15357-0002-7928/IMG_0736.JPG
--------------------------------------------------------------------------------
/public/uploads/tmp/1512691563-15357-0002-7928/thumb_IMG_0736.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/uploads/tmp/1512691563-15357-0002-7928/thumb_IMG_0736.JPG
--------------------------------------------------------------------------------
/public/uploads/tmp/1512691666-15357-0003-7880/IMG_0736.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/uploads/tmp/1512691666-15357-0003-7880/IMG_0736.JPG
--------------------------------------------------------------------------------
/public/uploads/tmp/1512691666-15357-0003-7880/thumb_IMG_0736.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/uploads/tmp/1512691666-15357-0003-7880/thumb_IMG_0736.JPG
--------------------------------------------------------------------------------
/public/uploads/tmp/1512692438-16702-0001-5998/IMG_0736.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/uploads/tmp/1512692438-16702-0001-5998/IMG_0736.JPG
--------------------------------------------------------------------------------
/public/uploads/tmp/1512692438-16702-0001-5998/thumb_IMG_0736.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/uploads/tmp/1512692438-16702-0001-5998/thumb_IMG_0736.JPG
--------------------------------------------------------------------------------
/public/uploads/tmp/1512692498-16702-0002-9124/IMG_0736.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/uploads/tmp/1512692498-16702-0002-9124/IMG_0736.JPG
--------------------------------------------------------------------------------
/public/uploads/tmp/1512692498-16702-0002-9124/thumb_IMG_0736.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/public/uploads/tmp/1512692498-16702-0002-9124/thumb_IMG_0736.JPG
--------------------------------------------------------------------------------
/spec/controllers/dashboard/abouts_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe Dashboard::AboutsController, type: :controller do
4 | login_user
5 | let(:portfolio) { FactoryGirl.create(:portfolio, user: subject.current_user) }
6 |
7 | let(:attributes) do
8 | { about_me: 'testing title',
9 | about_me_brief: 'exiting stuff',
10 | location: 'here',
11 | github: '',
12 | linkedin: '',
13 | facebook: '',
14 | twitter: '',
15 | website: '' }
16 | end
17 |
18 | describe 'about#create' do
19 | it 'Allows user to create a new project' do
20 | post :create, params: { portfolio_id: portfolio.id,
21 | about: attributes }
22 | record = About.new
23 | record.portfolio_id = portfolio.id
24 | record.valid?
25 |
26 | expect(About.all.count).to eq(1)
27 | end
28 | it 'Redirects to about view' do
29 | post :create, params: { portfolio_id: portfolio.id,
30 | about: attributes }
31 | expect(response).to redirect_to(portfolio_abouts_path(portfolio))
32 | end
33 | end
34 |
35 | describe 'about#update' do
36 | it 'Allows use to update project' do
37 | post :create, params: { portfolio_id: portfolio.id,
38 | about: attributes }
39 | patch :update, params: { portfolio_id: portfolio.id,
40 | id: About.first.id,
41 | about: { about_me: 'working' } }
42 | expect(About.first.about_me).to eq('working')
43 | end
44 | it 'Redirects to about view' do
45 | post :create, params: { portfolio_id: portfolio.id,
46 | about: attributes }
47 | patch :update, params: { portfolio_id: portfolio.id,
48 | id: About.first.id,
49 | about: { about_me: 'working' } }
50 | expect(response).to redirect_to(portfolio_abouts_path(portfolio))
51 | end
52 | end
53 | end
54 |
--------------------------------------------------------------------------------
/spec/controllers/dashboard/dashboard_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe Dashboard::DashboardController, type: :controller do
4 |
5 | end
6 |
--------------------------------------------------------------------------------
/spec/controllers/dashboard/portfolio_headers_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe Dashboard::PortfolioHeadersController, type: :controller do
4 | login_user
5 | let(:portfolio) { FactoryGirl.create(:portfolio, user: subject.current_user) }
6 |
7 | let(:attributes) do
8 | { header_one: 'testing title',
9 | header_two: 'exiting stuff',
10 | header_two_color: '#ffffff',
11 | header_one_color: '#ffffff' }
12 | end
13 |
14 | describe 'portfolio_header#create' do
15 | it 'Allows user to create a new project' do
16 | post :create, params: { portfolio_id: portfolio.id,
17 | portfolio_header: attributes }
18 | expect(PortfolioHeader.all.count).to eq(1)
19 | end
20 | it 'Redirects to portfolio_header view' do
21 | post :create, params: { portfolio_id: portfolio.id,
22 | portfolio_header: attributes }
23 | expect(response).to redirect_to(edit_user_portfolio_path(subject.current_user, portfolio))
24 | end
25 | end
26 |
27 | describe 'portfolio_header#update' do
28 | it 'Allows use to update project' do
29 | post :create, params: { portfolio_id: portfolio.id,
30 | portfolio_header: attributes }
31 | patch :update, params: { portfolio_id: portfolio.id,
32 | id: PortfolioHeader.first.id,
33 | portfolio_header: { header_one: 'working' } }
34 | expect(PortfolioHeader.first.header_one).to eq('working')
35 | end
36 | it 'Redirects to project view' do
37 | post :create, params: { portfolio_id: portfolio.id,
38 | portfolio_header: attributes }
39 | patch :update, params: { portfolio_id: portfolio.id,
40 | id: PortfolioHeader.first.id,
41 | portfolio_header: { header_one: 'working' } }
42 | expect(response).to redirect_to(edit_user_portfolio_path(subject.current_user, portfolio))
43 | end
44 | end
45 | end
46 |
--------------------------------------------------------------------------------
/spec/controllers/dashboard/portfolios_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe Dashboard::PortfoliosController, type: :controller do
4 | login_user
5 | let(:attributes) do
6 | { url: 'testing',
7 | color_one: '#ffffff',
8 | color_two: '#ffffff',
9 | color_three: '#ffffff',
10 | color_four: '#ffffff',
11 | font_color_one: '#ffffff',
12 | font_color_two: '#ffffff',
13 | theme: 'default',
14 | id: 1 }
15 | end
16 | let(:attributes2) do
17 | { url: 'test',
18 | color_one: '#ffffff',
19 | color_two: '#ffffff',
20 | color_three: '#ffffff',
21 | color_four: '#ffffff',
22 | font_color_one: '#ffffff',
23 | font_color_two: '#ffffff',
24 | theme: 'default',
25 | id: 1 }
26 | end
27 |
28 | describe 'portfolio#create' do
29 | it 'Lets new user create a portfolio' do
30 | subject.current_user.portfolios.create(attributes2)
31 | post :create, params: {user_id: subject.current_user.id, portfolio: attributes }
32 | expect(subject.current_user.portfolios[0].url).to eq('testing')
33 | end
34 | it 'Redirects to dashboard#index' do
35 | subject.current_user.portfolios.create(attributes2)
36 | post :create, params: {user_id: subject.current_user.id, portfolio: attributes }
37 | expect(response).to redirect_to(user_dashboard_index_path(subject.current_user))
38 | end
39 | end
40 |
41 | describe 'portfolio#update' do
42 | let(:portfolio) { subject.current_user.portfolios.create(attributes) }
43 | it 'Lets user edit portfolio URL' do
44 | patch :update, params: { user_id: subject.current_user.id,
45 | id: portfolio.id,
46 | portfolio: { url: 'test' },
47 | user: subject.current_user }
48 | expect(subject.current_user.portfolios.first.url).to eq('test')
49 | end
50 | it 'on success it reloads the same page' do
51 | patch :update, params: { user_id: subject.current_user.id,
52 | id: portfolio.id,
53 | portfolio: { url: 'test' },
54 | user: subject.current_user }
55 | puts portfolio.errors.full_messages
56 | expect(response).to redirect_to(edit_user_portfolio_path(subject.current_user, portfolio))
57 | end
58 | end
59 | end
60 |
--------------------------------------------------------------------------------
/spec/controllers/dashboard/projects_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe Dashboard::ProjectsController, type: :controller do
4 | login_user
5 | let(:portfolio) { FactoryGirl.create(:portfolio, user: subject.current_user) }
6 |
7 | let(:valid_attributes) do
8 | { title: 'testing title',
9 | description: 'exiting stuff',
10 | role: 'BMOC',
11 | tech: 'fancey things',
12 | link: 'a place',
13 | order: 1 }
14 | end
15 |
16 | describe 'projects#create' do
17 | it 'Allows user to create a new project' do
18 | post :create, params: { portfolio_id: portfolio.id,
19 | project: valid_attributes }
20 | expect(portfolio.projects.all.count).to eq(1)
21 | end
22 | it 'Redirects to project view' do
23 | post :create, params: { portfolio_id: portfolio.id,
24 | project: valid_attributes }
25 | expect(response).to redirect_to(portfolio_projects_path(portfolio))
26 | end
27 | end
28 |
29 | describe 'projects#update' do
30 | it 'Allows use to update project' do
31 | post :create, params: { portfolio_id: portfolio.id,
32 | project: valid_attributes }
33 | patch :update, params: { portfolio_id: portfolio.id,
34 | id: portfolio.projects.first.id,
35 | project: { title: 'working' } }
36 | expect(portfolio.projects.first.title).to eq('working')
37 | end
38 | it 'Redirects to project view' do
39 | post :create, params: { portfolio_id: portfolio.id,
40 | project: valid_attributes }
41 | patch :update, params: { portfolio_id: portfolio.id,
42 | id: portfolio.projects.first.id,
43 | project: { title: 'working' } }
44 | expect(response).to redirect_to(portfolio_projects_path(portfolio))
45 | end
46 | end
47 |
48 | describe 'projects#destroy' do
49 | it 'Allows user to delete project' do
50 | post :create, params: { portfolio_id: portfolio.id,
51 | project: valid_attributes }
52 | delete :destroy, params: { portfolio_id: portfolio.id,
53 | id: portfolio.projects.first.id }
54 | expect(portfolio.projects.all.count).to eq(0)
55 | end
56 | it 'Redirects to project view' do
57 | post :create, params: { portfolio_id: portfolio.id,
58 | project: valid_attributes }
59 | delete :destroy, params: { portfolio_id: portfolio.id,
60 | id: portfolio.projects.first.id }
61 | expect(response).to redirect_to(portfolio_projects_path(portfolio))
62 | end
63 | end
64 | end
65 |
--------------------------------------------------------------------------------
/spec/controllers/dashboard/technologies_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe Dashboard::TechnologiesController, type: :controller do
4 | login_user
5 | let(:portfolio) { FactoryGirl.create(:portfolio, user: subject.current_user) }
6 | let(:valid_attributes) do
7 | { name: 'Ruby',
8 | years_exp: 1,
9 | proficiency: 8,
10 | show_years_exp: true,
11 | show_proficiency: true }
12 | end
13 |
14 | describe 'technologies#create' do
15 | it 'Allows user to create a new technology' do
16 | post :create, params: { portfolio_id: portfolio.id,
17 | technology: valid_attributes }
18 | expect(portfolio.technologies.all.count).to eq(1)
19 | end
20 | it 'Redirects to technologies view' do
21 | post :create, params: { portfolio_id: portfolio.id,
22 | technology: valid_attributes }
23 | expect(response).to redirect_to(portfolio_technologies_path(portfolio))
24 | end
25 | end
26 |
27 | describe 'technologies#update' do
28 | it 'Allows use to update project' do
29 | post :create, params: { portfolio_id: portfolio.id,
30 | technology: valid_attributes }
31 | patch :update, params: { portfolio_id: portfolio.id,
32 | id: portfolio.technologies.first.id,
33 | technology: { name: 'Ruby on Rails' } }
34 | expect(portfolio.technologies.first.name).to eq('Ruby on Rails')
35 | end
36 | it 'Redirects to technologies view' do
37 | post :create, params: { portfolio_id: portfolio.id,
38 | technology: valid_attributes }
39 | patch :update, params: { portfolio_id: portfolio.id,
40 | id: portfolio.technologies.first.id,
41 | technology: { name: 'Ruby on Rails' } }
42 | expect(response).to redirect_to(portfolio_technologies_path(portfolio))
43 | end
44 | end
45 |
46 | describe 'technologies#destroy' do
47 | it 'Allows user to delete project' do
48 | post :create, params: { portfolio_id: portfolio.id,
49 | technology: valid_attributes }
50 | delete :destroy, params: { portfolio_id: portfolio.id,
51 | id: portfolio.technologies.first.id }
52 | expect(portfolio.technologies.all.count).to eq(0)
53 | end
54 | it 'Redirects to technologies view' do
55 | post :create, params: { portfolio_id: portfolio.id,
56 | technology: valid_attributes }
57 | delete :destroy, params: { portfolio_id: portfolio.id,
58 | id: portfolio.technologies.first.id }
59 | expect(response).to redirect_to(portfolio_technologies_path(portfolio))
60 | end
61 | end
62 |
63 | end
64 |
--------------------------------------------------------------------------------
/spec/controllers/home_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe HomeController, type: :controller do
4 |
5 | end
6 |
--------------------------------------------------------------------------------
/spec/factories.rb:
--------------------------------------------------------------------------------
1 | require 'faker'
2 |
3 | FactoryGirl.define do
4 | factory :job_application do
5 | first_contact_date "2017-12-26"
6 | company_name "MyString"
7 | company_website "MyString"
8 | job_location "MyString"
9 | enthusiasm "MyString"
10 | job_title "MyString"
11 | job_link "MyString"
12 | referral "MyString"
13 | referral_type "MyString"
14 | status "MyString"
15 | industry "MyString"
16 | notes "MyText"
17 | end
18 | factory :about do
19 | portfolio nil
20 | about_me "MyText"
21 | location "MyString"
22 | about_me_brief "MyString"
23 | end
24 | factory :portfolio_header do
25 | portfolio nil
26 | header_one "MyString"
27 | header_two "MyString"
28 | cover_image "MyString"
29 | avatar_image "MyString"
30 | end
31 | factory :technology do
32 | name "MyString"
33 | portfolio nil
34 | years_exp 1
35 | proficiency 1
36 | show_years_exp false
37 | show_proficiency false
38 | end
39 | factory :portfolio do
40 | url "myurl"
41 | color_one '#ffffff'
42 | color_two '#ffffff'
43 | color_three '#ffffff'
44 | color_four '#ffffff'
45 | font_color_one '#ffffff'
46 | font_color_two '#ffffff'
47 | theme 'default'
48 | user 1
49 | id 1
50 | end
51 | factory :user do
52 | email { Faker::Internet.email }
53 | password "password"
54 | password_confirmation "password"
55 | # confirmed_at Date.today
56 | end
57 | end
58 |
--------------------------------------------------------------------------------
/spec/fixtures/images/test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/spec/fixtures/images/test.jpg
--------------------------------------------------------------------------------
/spec/models/about_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe About, type: :model do
4 | let(:user) { FactoryGirl.create(:user) }
5 | let(:portfolio) { FactoryGirl.create(:portfolio, user: user) }
6 | let(:attributes) do
7 | { about_me: 'testing title',
8 | about_me_brief: 'exiting stuff',
9 | location: 'here',
10 | portfolio_id: portfolio.id,
11 | email: 'myemail',
12 | github: '',
13 | linkedin: '',
14 | facebook: '',
15 | twitter: '',
16 | website: '' }
17 | end
18 |
19 | describe '#create' do
20 | it 'creates new about' do
21 | About.create(attributes)
22 | expect(About.all.count).to eq(1)
23 | end
24 | end
25 |
26 | describe '#update' do
27 | let(:about) { About.create(attributes) }
28 | it 'updates a about' do
29 | about.update(about_me: 'updated')
30 | expect(About.first.about_me).to eq('updated')
31 | end
32 | end
33 |
34 | describe '#about_me' do
35 | it do
36 | should validate_length_of(:about_me)
37 | .is_at_most(2000)
38 | end
39 | end
40 |
41 | describe '#about_me_brief' do
42 | it do
43 | should validate_length_of(:about_me_brief)
44 | .is_at_most(150)
45 | end
46 | end
47 |
48 | describe '#portfolio' do
49 | it { should belong_to(:portfolio) }
50 | end
51 |
52 | describe '#linkedin' do
53 | is_valid_url(:linkedin, About.new)
54 | it do
55 | should validate_length_of(:linkedin)
56 | .is_at_most(100)
57 | end
58 | end
59 |
60 | describe '#github' do
61 | is_valid_url(:github, About.new)
62 | it do
63 | should validate_length_of(:github)
64 | .is_at_most(100)
65 | end
66 | end
67 |
68 | describe '#twitter' do
69 | is_valid_url(:twitter, About.new)
70 | it do
71 | should validate_length_of(:twitter)
72 | .is_at_most(100)
73 | end
74 | end
75 |
76 | describe '#facebook' do
77 | is_valid_url(:facebook, About.new)
78 | it do
79 | should validate_length_of(:facebook)
80 | .is_at_most(100)
81 | end
82 | end
83 |
84 | describe '#website' do
85 | is_valid_url(:website, About.new)
86 | it do
87 | should validate_length_of(:website)
88 | .is_at_most(100)
89 | end
90 | end
91 | end
92 |
--------------------------------------------------------------------------------
/spec/models/job_application_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe JobApplication, type: :model do
4 | let(:user) { FactoryGirl.create(:user) }
5 | let(:valid_attributes) do
6 | { first_contact_date: '2017-08-04',
7 | company_name: 'The First Order',
8 | job_location: 'Remote',
9 | enthusiasm: 'high',
10 | job_title: 'Supreme Leader',
11 | referral: 'Snoke',
12 | referral_type: 'mentor',
13 | status: 'applied',
14 | industry: 'ruling the galaxy' }
15 | end
16 |
17 | describe '#create' do
18 | it 'creates new project' do
19 | user.job_applications.create(valid_attributes)
20 | expect(user.job_applications.all.count).to eq(1)
21 | end
22 | end
23 |
24 | describe '#update' do
25 | let(:job_application) { user.job_applications.create(valid_attributes) }
26 | it 'updates a project' do
27 | job_application.update(company_name: 'Rebal Alliance')
28 | expect(user.job_applications.first.company_name).to eq('Rebal Alliance')
29 | end
30 | end
31 |
32 | describe '#user' do
33 | it { should belong_to(:user) }
34 | end
35 |
36 | describe '#enthusiasm' do
37 | it do
38 | should validate_inclusion_of(:enthusiasm)
39 | .in_array(%w[high medium low])
40 | end
41 | end
42 |
43 | describe '#status' do
44 | it do
45 | should validate_inclusion_of(:status)
46 | .in_array(%w[researching applied interviewing rejected offer])
47 | end
48 | end
49 |
50 | describe '#referral_type' do
51 | it do
52 | should validate_inclusion_of(:referral_type)
53 | .in_array(['cold outreach', 'mentor', 'personal connection', 'new connection', 'career website'])
54 | end
55 | end
56 |
57 | describe '#company_name' do
58 | it do
59 | should validate_length_of(:company_name)
60 | .is_at_most(100)
61 | end
62 | end
63 |
64 | describe '#company_website' do
65 | it do
66 | should validate_length_of(:company_website)
67 | .is_at_most(100)
68 | end
69 | end
70 |
71 | describe '#job_location' do
72 | it do
73 | should validate_length_of(:job_location)
74 | .is_at_most(100)
75 | end
76 | end
77 |
78 | describe '#job_title' do
79 | it do
80 | should validate_length_of(:job_title)
81 | .is_at_most(100)
82 | end
83 | end
84 |
85 | describe '#referral' do
86 | it do
87 | should validate_length_of(:referral)
88 | .is_at_most(100)
89 | end
90 | end
91 |
92 | describe '#industry' do
93 | it do
94 | should validate_length_of(:industry)
95 | .is_at_most(100)
96 | end
97 | end
98 |
99 | describe '#notes' do
100 | it do
101 | should validate_length_of(:notes)
102 | .is_at_most(1000)
103 | end
104 | end
105 |
106 | describe '#job_link' do
107 | it do
108 | should validate_length_of(:job_link)
109 | .is_at_most(250)
110 | end
111 | end
112 | end
113 |
--------------------------------------------------------------------------------
/spec/models/portfolio_header_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe PortfolioHeader, type: :model do
4 | let(:user) { FactoryGirl.create(:user) }
5 | let(:portfolio) { FactoryGirl.create(:portfolio, user: user) }
6 | let(:attributes) do
7 | { header_one: 'testing title',
8 | header_two: 'exiting stuff',
9 | header_two_color: '#ffffff',
10 | header_one_color: '#ffffff',
11 | portfolio_id: portfolio.id }
12 | end
13 |
14 | describe '#create' do
15 | it 'creates new portfolio_header' do
16 | PortfolioHeader.create(attributes)
17 | expect(PortfolioHeader.all.count).to eq(1)
18 | end
19 | it 'uploads image using CoverImageUploader' do
20 | image = fixture_file_upload('images/test.jpg')
21 | record = PortfolioHeader.new(attributes)
22 | record.cover_image = image
23 | record.save
24 | expect(PortfolioHeader.first.cover_image.is_a?(CoverImageUploader)).to eq(true)
25 | end
26 | it 'uploads image using AvatarImageUploader' do
27 | image = fixture_file_upload('images/test.jpg')
28 | record = PortfolioHeader.new(attributes)
29 | record.avatar_image = image
30 | record.save
31 | expect(PortfolioHeader.first.avatar_image.is_a?(AvatarImageUploader)).to eq(true)
32 | end
33 | end
34 |
35 | describe '#update' do
36 | let(:portfolio_header) { PortfolioHeader.create(attributes) }
37 | it 'updates a portfolio_header' do
38 | portfolio_header.update(header_one: 'updated')
39 | expect(PortfolioHeader.first.header_one).to eq('updated')
40 | end
41 | end
42 |
43 | describe '#header_one' do
44 | it do
45 | should validate_length_of(:header_one)
46 | .is_at_most(100)
47 | end
48 | end
49 |
50 | describe '#header_two' do
51 | it do
52 | should validate_length_of(:header_two)
53 | .is_at_most(100)
54 | end
55 | end
56 |
57 | describe '#header_two_color' do
58 | is_valid_css_hex_color(:header_two_color, PortfolioHeader.new)
59 | end
60 |
61 | describe '#header_one_color' do
62 | is_valid_css_hex_color(:header_one_color, PortfolioHeader.new)
63 | end
64 |
65 | describe '#portfolio' do
66 | it { should belong_to(:portfolio) }
67 | end
68 | end
69 |
--------------------------------------------------------------------------------
/spec/models/portfolio_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe Portfolio, type: :model do
4 | let(:user) { FactoryGirl.create(:user) }
5 | let(:attributes) do
6 | { url: 'testing',
7 | color_one: '#ffffff',
8 | color_two: '#ffffff',
9 | color_three: '#ffffff',
10 | color_four: '#ffffff',
11 | theme: 'default' }
12 | end
13 |
14 | describe 'Create Portfolio' do
15 | it 'creates a new portfolio' do
16 | user.portfolios.create(attributes)
17 | expect(user.portfolios.first.url).to eq('testing')
18 | end
19 | end
20 |
21 | describe 'Update Portfolio' do
22 | let(:portfolio) { user.portfolios.create(attributes) }
23 | it 'edits portfolio URL' do
24 | portfolio.update(url: 'test')
25 | expect(user.portfolios.first.url).to eq('test')
26 | end
27 | end
28 |
29 | describe '#user' do
30 | it { should belong_to(:user) }
31 | end
32 |
33 | describe '#url' do
34 | it { should validate_presence_of(:url) }
35 | it { should validate_uniqueness_of(:url) }
36 | it do
37 | should validate_length_of(:url)
38 | .is_at_least(3)
39 | end
40 | it 'should only containe lowercase alphanumeric characters' do
41 | record = Portfolio.new
42 | invalid_characters = %w[! @ A B # $ % ^ & * ( ) = + / \ { } [ ] < > ' " ` ~]
43 | invalid_characters.each do |char|
44 | record.url = "test#{char}"
45 | record.valid?
46 | expect(record.errors[:url]).to eq(['must only contain lowercase alphanumeric characters, hyphens, or underscores'])
47 | end
48 | record.url = 'myurl'
49 | record.valid?
50 | expect(record.errors[:url]).to eq([])
51 | end
52 | end
53 |
54 | describe '#color_one' do
55 | is_valid_css_hex_color(:color_one, Portfolio.new)
56 | end
57 |
58 | describe '#color_two' do
59 | is_valid_css_hex_color(:color_two, Portfolio.new)
60 | end
61 |
62 | describe '#color_three' do
63 | is_valid_css_hex_color(:color_three, Portfolio.new)
64 | end
65 |
66 | describe '#color_three' do
67 | is_valid_css_hex_color(:color_four, Portfolio.new)
68 | end
69 |
70 | describe '#theme' do
71 | it do
72 | should validate_inclusion_of(:theme)
73 | .in_array(Themes.array)
74 | end
75 | end
76 | end
77 |
--------------------------------------------------------------------------------
/spec/models/project_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe Project, type: :model do
4 | let(:user) { FactoryGirl.create(:user) }
5 | let(:portfolio) { FactoryGirl.create(:portfolio, user: user) }
6 | let(:project_input) do
7 | { title: 'My title',
8 | description: 'So many words',
9 | role: 'supreme leader',
10 | link: 'the-fun-place',
11 | tech: 'mostly interent explorer',
12 | order: 1 }
13 | end
14 | let(:project) { portfolio.projects.new(project_input) }
15 |
16 | describe '#create' do
17 | it 'creates new project' do
18 | portfolio.projects.create(project_input)
19 | expect(portfolio.projects.all.count).to eq(1)
20 | end
21 | it 'uploads image using ImageUploader' do
22 | image = fixture_file_upload('images/test.jpg')
23 | portfolio.projects.create(image: image)
24 | expect(portfolio.projects.first.image.is_a?(ImageUploader)).to eq(true)
25 | end
26 | end
27 |
28 | describe '#update' do
29 | let(:project) { portfolio.projects.create(project_input) }
30 | it 'updates a project' do
31 | project.update(title: 'updated')
32 | expect(portfolio.projects.first.title).to eq('updated')
33 | end
34 | end
35 |
36 | describe '#portfolio' do
37 | it { should belong_to(:portfolio) }
38 | end
39 |
40 | describe '#order' do
41 | it 'validates order as a number' do
42 | record = portfolio.projects.new(project_input)
43 | record.order = '2'
44 | record.valid?
45 | expect(record.errors[:order]).to eq([])
46 | record.order = 'two'
47 | record.valid?
48 | expect(record.errors[:order]).to eq(['is not a number'])
49 | end
50 | it 'validates order as greater than 0' do
51 | record = portfolio.projects.new(project_input)
52 | record.order = 1
53 | record.valid?
54 | expect(record.errors[:order]).to eq([])
55 | record.order = 0
56 | record.valid?
57 | expect(record.errors[:order]).to eq(['must be greater than 0'])
58 | end
59 | it 'validates order as less than 20' do
60 | record = portfolio.projects.new(project_input)
61 | record.order = 19
62 | record.valid?
63 | expect(record.errors[:order]).to eq([])
64 | record.order = 20
65 | record.valid?
66 | expect(record.errors[:order]).to eq(['must be less than 20'])
67 | end
68 | end
69 |
70 | describe '#link' do
71 | project_attribute_has_maximum_length_of(200, :link)
72 | end
73 |
74 | describe '#role' do
75 | project_attribute_has_maximum_length_of(200, :role)
76 | end
77 |
78 | describe '#tech' do
79 | project_attribute_has_maximum_length_of(500, :tech)
80 | end
81 |
82 | describe '#description' do
83 | project_attribute_has_maximum_length_of(2000, :description)
84 | end
85 |
86 | describe '#title' do
87 | project_attribute_has_maximum_length_of(40, :title)
88 | end
89 | end
90 |
--------------------------------------------------------------------------------
/spec/models/technology_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe Technology, type: :model do
4 | let(:user) { FactoryGirl.create(:user) }
5 | let(:portfolio) { FactoryGirl.create(:portfolio, user: user) }
6 | let(:attributes) do
7 | { name: 'Ruby',
8 | years_exp: 1,
9 | proficiency: 8 }
10 | end
11 |
12 | describe '#update' do
13 | it 'creates new technology' do
14 | portfolio.technologies.create(attributes)
15 | expect(portfolio.technologies.all.count).to eq(1)
16 | end
17 | end
18 |
19 | describe '#create' do
20 | it 'updates new technology' do
21 | record = portfolio.technologies.create(attributes)
22 | record.update(name: 'updated')
23 | expect(record.name).to eq('updated')
24 | end
25 | end
26 |
27 | describe '#portfolio' do
28 | it { should belong_to(:portfolio) }
29 | end
30 |
31 | describe '#proficiency' do
32 | it { should validate_numericality_of(:proficiency) }
33 | end
34 |
35 | describe '#years_exp' do
36 | it { should validate_numericality_of(:years_exp) }
37 | end
38 |
39 | describe '#name' do
40 | it { should validate_presence_of(:name) }
41 | it do
42 | should validate_length_of(:name)
43 | .is_at_most(20)
44 | end
45 | end
46 | end
47 |
--------------------------------------------------------------------------------
/spec/routing/job_applications_routing_spec.rb:
--------------------------------------------------------------------------------
1 | # require "rails_helper"
2 | #
3 | # RSpec.describe Dashboard::JobApplicationsController, type: :routing do
4 | # describe "routing" do
5 | #
6 | # it "routes to #index" do
7 | # expect(:get => "/job_applications").to route_to("job_applications#index")
8 | # end
9 | #
10 | # it "routes to #new" do
11 | # expect(:get => "/job_applications/new").to route_to("job_applications#new")
12 | # end
13 | #
14 | # it "routes to #show" do
15 | # expect(:get => "/job_applications/1").to route_to("job_applications#show", :id => "1")
16 | # end
17 | #
18 | # it "routes to #edit" do
19 | # expect(:get => "/job_applications/1/edit").to route_to("job_applications#edit", :id => "1")
20 | # end
21 | #
22 | # it "routes to #create" do
23 | # expect(:post => "/job_applications").to route_to("job_applications#create")
24 | # end
25 | #
26 | # it "routes to #update via PUT" do
27 | # expect(:put => "/job_applications/1").to route_to("job_applications#update", :id => "1")
28 | # end
29 | #
30 | # it "routes to #update via PATCH" do
31 | # expect(:patch => "/job_applications/1").to route_to("job_applications#update", :id => "1")
32 | # end
33 | #
34 | # it "routes to #destroy" do
35 | # expect(:delete => "/job_applications/1").to route_to("job_applications#destroy", :id => "1")
36 | # end
37 | #
38 | # end
39 | # end
40 |
--------------------------------------------------------------------------------
/spec/support/controller_macros.rb:
--------------------------------------------------------------------------------
1 | module ControllerMacros
2 | def login_admin
3 | before(:each) do
4 | @request.env["devise.mapping"] = Devise.mappings[:admin]
5 | sign_in FactoryGirl.create(:admin) # Using factory girl as an example
6 | end
7 | end
8 |
9 | def login_user
10 | before(:each) do
11 | @request.env["devise.mapping"] = Devise.mappings[:user]
12 | user = FactoryGirl.create(:user)
13 | sign_in user
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/spec/support/custom_validations.rb:
--------------------------------------------------------------------------------
1 | module CustomValidationsSpec
2 | def is_valid_css_hex_color(attribute, record)
3 | it 'is a valid CSS hex color' do
4 | record.send("#{attribute}=", '#kjhadk')
5 | record.valid?
6 | expect(record.errors[attribute]).to eq(['must be a valid CSS hex color code'])
7 |
8 | record.send("#{attribute}=", 123456)
9 | record.valid?
10 | expect(record.errors[attribute]).to eq(['must be a valid CSS hex color code'])
11 |
12 | record.send("#{attribute}=", '#123456')
13 | record.valid?
14 | expect(record.errors[attribute]).to eq([])
15 | end
16 | end
17 |
18 | def is_valid_url(attribute, record)
19 | it 'is a valid URL' do
20 | record.send("#{attribute}=", 'kjhadk')
21 | record.valid?
22 | expect(record.errors[attribute]).to eq(["must be a valid URL (URLs must start with 'http://')"])
23 |
24 | record.send("#{attribute}=", 'www.facebook.com')
25 | record.valid?
26 | expect(record.errors[attribute]).to eq(["must be a valid URL (URLs must start with 'http://')"])
27 |
28 | record.send("#{attribute}=", 'http://www.facebook.com')
29 | record.valid?
30 | expect(record.errors[attribute]).to eq([])
31 | end
32 | end
33 |
34 | def project_attribute_has_maximum_length_of(length, attribute)
35 | let(:user) { FactoryGirl.create(:user) }
36 | let(:portfolio) { FactoryGirl.create(:portfolio, user: user) }
37 | let(:attribute) do
38 | { header_one: 'testing title',
39 | header_two: 'exiting stuff',
40 | header_two_color: '#ffffff',
41 | header_one_color: '#ffffff',
42 | portfolio_id: portfolio.id }
43 | end
44 |
45 | short_string = build_string(length)
46 | long_string = build_string(length + 1)
47 |
48 | it "has a maximum length of #{length}" do
49 | record = portfolio.projects.new(project_input)
50 | record.send("#{attribute}=", short_string)
51 | record.valid?
52 | expect(record.errors[attribute]).to eq([])
53 | record.send("#{attribute}=", long_string)
54 | record.valid?
55 | expect(record.errors[attribute].length).to eq(1)
56 | end
57 | end
58 |
59 | def build_string(length)
60 | string = ''
61 | length.times do
62 | string << 'a'
63 | end
64 | string
65 | end
66 | end
67 |
--------------------------------------------------------------------------------
/tmp/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/tmp/.keep
--------------------------------------------------------------------------------
/vendor/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-wendell/my_dev_portal/1af14e5922880aeac9b7808aae88cf626e9b3165/vendor/.keep
--------------------------------------------------------------------------------