Skip to content

Commit

Permalink
freeze string literals
Browse files Browse the repository at this point in the history
  • Loading branch information
andela-ydaniju committed Mar 9, 2017
1 parent f5c24ec commit 19fea4a
Show file tree
Hide file tree
Showing 70 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AllCops:
TargetRubyVersion: 2.3
Exclude:
- "vendor/**/*"
- "db/schema.rb"
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
source 'https://rubygems.org'
ruby '2.3.0'
gem 'rails', '4.2.6'
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path('../config/application', __FILE__)

Rails.application.load_tasks
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include SessionHandler
Expand Down
1 change: 1 addition & 0 deletions app/controllers/homes_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class HomesController < ApplicationController
def index
@display_top_links = Link.top_links
Expand Down
1 change: 1 addition & 0 deletions app/controllers/links_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class LinksController < ApplicationController
before_action :right_user, only: :destroy
def index
Expand Down
1 change: 1 addition & 0 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class SessionsController < ApplicationController
def new
end
Expand Down
1 change: 1 addition & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class UsersController < ApplicationController
def new
end
Expand Down
1 change: 1 addition & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module ApplicationHelper
def full_title(page_title = '')
base_title = 'for the finest of links'
Expand Down
1 change: 1 addition & 0 deletions app/helpers/sessions_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module SessionsHelper
def current_user
user_id = session[:user_id]
Expand Down
1 change: 1 addition & 0 deletions app/models/link.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Link < ActiveRecord::Base
URL_REGEX =
%r{\A(https?:\/\/)?([a-z0-9]+\.)?[a-z0-9\-]+\.[a-z]+.+[^\W\_]\z}
Expand Down
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class User < ActiveRecord::Base
attr_accessor :remember_token
has_many :links, dependent: :destroy
Expand Down
1 change: 1 addition & 0 deletions app/services/link_handler.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module LinkHandler
def bool_check(stringy_bool)
stringy_bool == 'true' ? true : false
Expand Down
1 change: 1 addition & 0 deletions app/services/session_handler.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module SessionHandler
def sign_in(user)
session[:user_id] = user.id
Expand Down
1 change: 1 addition & 0 deletions bin/bundle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env ruby.exe
# frozen_string_literal: true
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')
1 change: 1 addition & 0 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby.exe
# frozen_string_literal: true
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'
1 change: 1 addition & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby.exe
# frozen_string_literal: true
require_relative '../config/boot'
require 'rake'
Rake.application.run
1 change: 1 addition & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby.exe
# frozen_string_literal: true
require 'pathname'

# path to your application root.
Expand Down
1 change: 1 addition & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment', __FILE__)
Expand Down
1 change: 1 addition & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path('../boot', __FILE__)

require 'rails/all'
Expand Down
1 change: 1 addition & 0 deletions config/boot.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup' # Set up gems listed in the Gemfile.
1 change: 1 addition & 0 deletions config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Load the Rails application.
require File.expand_path('../application', __FILE__)

Expand Down
1 change: 1 addition & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in
# config/application.rb.
Expand Down
1 change: 1 addition & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in
# config/application.rb.
Expand Down
1 change: 1 addition & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in
# config/application.rb.
Expand Down
1 change: 1 addition & 0 deletions config/initializers/assets.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

# Version of your assets, change this if you want to expire all your assets.
Expand Down
1 change: 1 addition & 0 deletions config/initializers/backtrace_silencers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

# You can add backtrace silencers for libraries that you're using but don't wish
Expand Down
1 change: 1 addition & 0 deletions config/initializers/cookies_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

Rails.application.config.action_dispatch.cookies_serializer = :json
1 change: 1 addition & 0 deletions config/initializers/filter_parameter_logging.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

# Configure sensitive parameters which will be filtered from the log file.
Expand Down
1 change: 1 addition & 0 deletions config/initializers/inflections.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

# Add new inflection rules using the following format. Inflections
Expand Down
1 change: 1 addition & 0 deletions config/initializers/mime_types.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

# Add new mime types for use in respond_to blocks:
Expand Down
1 change: 1 addition & 0 deletions config/initializers/rails_env_favicon.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails-env-favicon'

RailsEnvFavicon.setup do |config|
Expand Down
1 change: 1 addition & 0 deletions config/initializers/session_store.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

Rails.application.config.session_store :cookie_store, key: '_pruner_session'
1 change: 1 addition & 0 deletions config/initializers/wrap_parameters.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

# This file contains settings for ActionController::ParamsWrapper which
Expand Down
1 change: 1 addition & 0 deletions config/puma.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
Rails.application.routes.draw do
root to: 'homes#index'
resources :sessions, only: [:new, :create, :destroy]
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20151220050725_create_users.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20151220060454_add_index_to_users_email.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class AddIndexToUsersEmail < ActiveRecord::Migration
def change
add_index :users, :email, unique: true
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20151220061714_add_password_digest_to_users.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class AddPasswordDigestToUsers < ActiveRecord::Migration
def change
add_column :users, :password_digest, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20151223140004_create_links.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class CreateLinks < ActiveRecord::Migration
def change
create_table :links do |t|
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20160101112957_add_shortened_link_to_links.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class AddShortenedLinkToLinks < ActiveRecord::Migration
def change
add_column :links, :shortened_link, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20160101214200_add_full_link_to_links.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class AddFullLinkToLinks < ActiveRecord::Migration
def change
add_column :links, :full_link, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20160103055115_add_user_reference_to_links.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class AddUserReferenceToLinks < ActiveRecord::Migration
def change
add_reference :links, :user, index: true, foreign_key: true
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20160106031703_add_remember_digest_to_users.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class AddRememberDigestToUsers < ActiveRecord::Migration
def change
add_column :users, :remember_digest, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20160106163538_remove_full_link_from_links.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class RemoveFullLinkFromLinks < ActiveRecord::Migration
def change
remove_column :links, :full_link, :string
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20160107052624_add_visits_to_links.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class AddVisitsToLinks < ActiveRecord::Migration
def change
add_column :links, :visits, :integer
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20160107053255_change_name_in_links.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class ChangeNameInLinks < ActiveRecord::Migration
def change
rename_column :links, :name, :url_input
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20160107062654_add_enabled_to_links.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class AddEnabledToLinks < ActiveRecord::Migration
def change
add_column :links, :enabled, :boolean
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20160111005342_add_erased_to_links.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class AddErasedToLinks < ActiveRecord::Migration
def change
add_column :links, :erased, :boolean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class AddDefaultValueToEnabledAttribute < ActiveRecord::Migration
def change
change_column :links, :enabled, :boolean, default: true
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20160112052637_add_links_count_to_users.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class AddLinksCountToUsers < ActiveRecord::Migration
def change
add_column :users, :links_count, :integer, default: 0
Expand Down
1 change: 1 addition & 0 deletions spec/controllers/sessions_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe SessionsController, type: :controller do
Expand Down
1 change: 1 addition & 0 deletions spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe UsersController, type: :controller do
context 'signup' do
Expand Down
1 change: 1 addition & 0 deletions spec/factories.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
FactoryGirl.define do
factory :link do
url_input 'MyString'
Expand Down
1 change: 1 addition & 0 deletions spec/features/destroy_link_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'the link deletion process', type: :feature do
before :each do
Expand Down
1 change: 1 addition & 0 deletions spec/features/disabled_link_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'the link disabling process', type: :feature do
before :each do
Expand Down
1 change: 1 addition & 0 deletions spec/features/edit_link_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'the link edit process', type: :feature do
before :each do
Expand Down
1 change: 1 addition & 0 deletions spec/features/link_redirection_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'the link redirection process', type: :feature do
before :each do
Expand Down
1 change: 1 addition & 0 deletions spec/features/new_link_anon_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'the link creation process', type: :feature do
it 'creates new link without vanity string' do
Expand Down
1 change: 1 addition & 0 deletions spec/features/new_link_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'the link creation process', type: :feature do
before :each do
Expand Down
1 change: 1 addition & 0 deletions spec/features/signin_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'the signin process', type: :feature do
before :each do
Expand Down
1 change: 1 addition & 0 deletions spec/features/signout_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'the signout process', type: :feature do
before :each do
Expand Down
1 change: 1 addition & 0 deletions spec/features/signup_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'the signup process', type: :feature do
it 'signs me up if entry is valid' do
Expand Down
1 change: 1 addition & 0 deletions spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
RSpec.describe ApplicationHelper, type: :helper do
describe '#full_title' do
it 'returns base_title if no page_title' do
Expand Down
1 change: 1 addition & 0 deletions spec/models/link_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe Link, type: :model do
Expand Down
1 change: 1 addition & 0 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe User, type: :model do
Expand Down
1 change: 1 addition & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'coveralls'
Coveralls.wear!

Expand Down
1 change: 1 addition & 0 deletions spec/support/factory_girl.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
end
Expand Down
1 change: 1 addition & 0 deletions spec/views/sessions/new.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe 'sessions/new.html.erb', type: :view do
Expand Down

0 comments on commit 19fea4a

Please sign in to comment.