diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 000000000..320e1d14a --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,222 @@ +AllCops: + TargetRubyVersion: 2.5 + # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop + # to ignore them, so only the ones explicitly set in this file are enabled. + DisabledByDefault: true + Exclude: + - '**/templates/**/*' + - '**/vendor/**/*' + - 'actionpack/lib/action_dispatch/journey/parser.rb' + - 'railties/test/fixtures/tmp/**/*' + - 'node_modules/**/*' + - 'bin/*' + +Performance: + Exclude: + - '**/test/**/*' + +Rails: + Enabled: true + +# Prefer assert_not over assert ! +Rails/AssertNot: + Include: + - '**/test/**/*' + +# Prefer assert_not_x over refute_x +Rails/RefuteMethods: + Include: + - '**/test/**/*' + +# Prefer &&/|| over and/or. +Style/AndOr: + Enabled: true + +# Do not use braces for hash literals when they are the last argument of a +# method call. +Style/BracesAroundHashParameters: + Enabled: true + EnforcedStyle: context_dependent + +# Align `when` with `case`. +Layout/CaseIndentation: + Enabled: true + +# Align comments with method definitions. +Layout/CommentIndentation: + Enabled: true + +Layout/ElseAlignment: + Enabled: true + +# Align `end` with the matching keyword or starting expression except for +# assignments, where it should be aligned with the LHS. +Layout/EndAlignment: + Enabled: true + EnforcedStyleAlignWith: variable + AutoCorrect: true + +Layout/EmptyLineAfterMagicComment: + Enabled: true + +Layout/EmptyLinesAroundBlockBody: + Enabled: true + +# In a regular class definition, no empty lines around the body. +Layout/EmptyLinesAroundClassBody: + Enabled: true + +# In a regular method definition, no empty lines around the body. +Layout/EmptyLinesAroundMethodBody: + Enabled: true + +# In a regular module definition, no empty lines around the body. +Layout/EmptyLinesAroundModuleBody: + Enabled: true + +Layout/FirstParameterIndentation: + Enabled: true + +# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. +Style/HashSyntax: + Enabled: true + +# Method definitions after `private` or `protected` isolated calls need one +# extra level of indentation. +Layout/IndentationConsistency: + Enabled: true + EnforcedStyle: rails + +# Two spaces, no tabs (for indentation). +Layout/IndentationWidth: + Enabled: true + +Layout/LeadingCommentSpace: + Enabled: true + +Layout/SpaceAfterColon: + Enabled: true + +Layout/SpaceAfterComma: + Enabled: true + +Layout/SpaceAroundEqualsInParameterDefault: + Enabled: true + +Layout/SpaceAroundKeyword: + Enabled: true + +Layout/SpaceAroundOperators: + Enabled: true + +Layout/SpaceBeforeComma: + Enabled: true + +Layout/SpaceBeforeFirstArg: + Enabled: true + +Style/DefWithParentheses: + Enabled: true + +# Defining a method with parameters needs parentheses. +Style/MethodDefParentheses: + Enabled: true + +Style/FrozenStringLiteralComment: + Enabled: true + EnforcedStyle: always + Exclude: + - 'actionview/test/**/*.builder' + - 'actionview/test/**/*.ruby' + - 'actionpack/test/**/*.builder' + - 'actionpack/test/**/*.ruby' + - 'activestorage/db/migrate/**/*.rb' + +Style/RedundantFreeze: + Enabled: true + Exclude: + - 'actionpack/lib/action_dispatch/journey/router/utils.rb' + - 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb' + +# Use `foo {}` not `foo{}`. +Layout/SpaceBeforeBlockBraces: + Enabled: true + +# Use `foo { bar }` not `foo {bar}`. +Layout/SpaceInsideBlockBraces: + Enabled: true + EnforcedStyleForEmptyBraces: space + +# Use `{ a: 1 }` not `{a:1}`. +Layout/SpaceInsideHashLiteralBraces: + Enabled: true + +Layout/SpaceInsideParens: + Enabled: true + +# Check quotes usage according to lint rule below. +Style/StringLiterals: + Enabled: true + EnforcedStyle: double_quotes + +# Detect hard tabs, no hard tabs. +Layout/Tab: + Enabled: true + +# Blank lines should not have any spaces. +Layout/TrailingBlankLines: + Enabled: true + +# No trailing whitespace. +Layout/TrailingWhitespace: + Enabled: true + +# Use quotes for string literals when they are enough. +Style/UnneededPercentQ: + Enabled: true + +# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg. +Lint/RequireParentheses: + Enabled: true + +Lint/StringConversionInInterpolation: + Enabled: true + +Lint/UriEscapeUnescape: + Enabled: true + +Style/ParenthesesAroundCondition: + Enabled: true + +Style/RedundantReturn: + Enabled: true + AllowMultipleReturnValues: true + +Style/Semicolon: + Enabled: true + AllowAsExpressionSeparator: true + +# Prefer Foo.method over Foo::method +Style/ColonMethodCall: + Enabled: true + +Style/TrivialAccessors: + Enabled: true + +Performance/FlatMap: + Enabled: true + +Performance/RedundantMerge: + Enabled: true + +Performance/StartWith: + Enabled: true + +Performance/EndWith: + Enabled: true + +Performance/RegexpMatch: + Enabled: true + +Performance/UnfreezeString: + Enabled: true diff --git a/Gemfile b/Gemfile index 07ac1bd11..2107c8912 100644 --- a/Gemfile +++ b/Gemfile @@ -1,52 +1,55 @@ -source 'https://rubygems.org' +# frozen_string_literal: true + +source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.5.3' +ruby "2.5.3" -gem 'active_link_to', '~> 1.0.5' -gem 'bootsnap', '>= 1.1.0', require: false -gem 'cable_ready', '~> 2.0.6' -gem 'country_select' -gem 'devise' -gem 'jbuilder', '~> 2.5' -gem 'pg', '>= 0.18', '< 2.0' -gem 'puma', '~> 3.11' -gem 'rails', '~> 5.2.1' -gem 'redis', '~> 4.0' -gem 'sass-rails', '~> 5.0' -gem 'simple_form', '~> 4.0' -gem 'stimulus_reflex', '~> 0.1.8' -gem 'tag_columns', '~> 0.1.6' -gem 'turbolinks', '~> 5' -gem 'uglifier', '>= 1.3.0' -gem 'webpacker', '~> 3.5' +gem "active_link_to", "~> 1.0.5" +gem "bootsnap", ">= 1.1.0", require: false +gem "cable_ready", "~> 2.0.6" +gem "country_select" +gem "devise" +gem "jbuilder", "~> 2.5" +gem "pg", ">= 0.18", "< 2.0" +gem "puma", "~> 3.11" +gem "rails", "~> 5.2.1" +gem "redis", "~> 4.0" +gem "sass-rails", "~> 5.0" +gem "simple_form", "~> 4.0" +gem "stimulus_reflex", "~> 0.1.8" +gem "tag_columns", "~> 0.1.6" +gem "turbolinks", "~> 5" +gem "uglifier", ">= 1.3.0" +gem "webpacker", "~> 3.5" group :development, :test do - gem 'awesome_print' - gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] - gem 'dotenv' - gem 'pry' - gem 'pry-byebug' - gem 'pry-rails' + gem "awesome_print" + gem "byebug", platforms: [:mri, :mingw, :x64_mingw] + gem "dotenv" + gem "pry" + gem "pry-byebug" + gem "pry-rails" end group :development do - #gem 'spring' - #gem 'spring-watcher-listen', '~> 2.0.0' - gem 'annotate' - gem 'listen', '>= 3.0.5', '< 3.2' - gem 'magic_frozen_string_literal' - gem 'model_probe' - gem 'rufo' - gem 'teamocil' - gem 'web-console', '>= 3.3.0' + # gem 'spring' + # gem 'spring-watcher-listen', '~> 2.0.0' + gem "annotate" + gem "listen", ">= 3.0.5", "< 3.2" + gem "magic_frozen_string_literal" + gem "model_probe" + gem "rubocop" + gem "rufo" + gem "teamocil" + gem "web-console", ">= 3.3.0" end group :test do - gem 'capybara', '>= 2.15' - gem 'chromedriver-helper' - gem 'selenium-webdriver' + gem "capybara", ">= 2.15" + gem "chromedriver-helper" + gem "selenium-webdriver" end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem -gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] +gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/Gemfile.lock b/Gemfile.lock index 2b8e7354e..56e4ccbf2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -53,6 +53,7 @@ GEM archive-zip (0.11.0) io-like (~> 0.3.0) arel (9.0.0) + ast (2.4.0) awesome_print (1.8.0) bcrypt (3.1.12) bindex (0.5.0) @@ -101,6 +102,7 @@ GEM concurrent-ruby (~> 1.0) i18n_data (0.8.0) io-like (0.3.0) + jaro_winkler (1.5.1) jbuilder (2.7.0) activesupport (>= 4.2.0) multi_json (>= 1.2) @@ -130,7 +132,11 @@ GEM nokogiri (1.8.5) mini_portile2 (~> 2.3.0) orm_adapter (0.5.0) + parallel (1.12.1) + parser (2.5.1.2) + ast (~> 2.4.0) pg (1.1.3) + powerpack (0.1.2) pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) @@ -170,6 +176,7 @@ GEM method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) + rainbow (3.0.0) rake (12.3.1) rb-fsevent (0.10.3) rb-inotify (0.9.10) @@ -178,6 +185,15 @@ GEM responders (2.4.0) actionpack (>= 4.2.0, < 5.3) railties (>= 4.2.0, < 5.3) + rubocop (0.59.2) + jaro_winkler (~> 1.5.1) + parallel (~> 1.10) + parser (>= 2.5, != 2.5.1.1) + powerpack (~> 0.1) + rainbow (>= 2.2.2, < 4.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.10.0) ruby_dep (1.5.0) rubyzip (1.2.2) rufo (0.4.0) @@ -227,6 +243,7 @@ GEM thread_safe (~> 0.1) uglifier (4.1.19) execjs (>= 0.3.0, < 3) + unicode-display_width (1.4.0) unicode_utils (1.4.0) warden (1.2.7) rack (>= 1.0) @@ -271,6 +288,7 @@ DEPENDENCIES puma (~> 3.11) rails (~> 5.2.1) redis (~> 4.0) + rubocop rufo sass-rails (~> 5.0) selenium-webdriver diff --git a/Rakefile b/Rakefile index 488c551fe..d2a78aa25 100644 --- a/Rakefile +++ b/Rakefile @@ -3,6 +3,6 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require_relative 'config/application' +require_relative "config/application" Rails.application.load_tasks diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index d3a44b944..4ca76010b 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb @@ -65,13 +65,13 @@ def destroy private - # Use callbacks to share common setup or constraints between actions. - def set_asset - @asset = Asset.find(params[:id]) - end + # Use callbacks to share common setup or constraints between actions. + def set_asset + @asset = Asset.find(params[:id]) + end - # Never trust parameters from the scary internet, only allow the white list through. - def asset_params - params.fetch(:asset, {}) - end + # Never trust parameters from the scary internet, only allow the white list through. + def asset_params + params.fetch(:asset, {}) + end end diff --git a/app/controllers/campaigns_controller.rb b/app/controllers/campaigns_controller.rb index 06a92fbcb..d9cd93bfe 100644 --- a/app/controllers/campaigns_controller.rb +++ b/app/controllers/campaigns_controller.rb @@ -65,13 +65,13 @@ def destroy private - # Use callbacks to share common setup or constraints between actions. - def set_campaign - @campaign = Campaign.find(params[:id]) - end + # Use callbacks to share common setup or constraints between actions. + def set_campaign + @campaign = Campaign.find(params[:id]) + end - # Never trust parameters from the scary internet, only allow the white list through. - def campaign_params - params.fetch(:campaign, {}) - end + # Never trust parameters from the scary internet, only allow the white list through. + def campaign_params + params.fetch(:campaign, {}) + end end diff --git a/app/controllers/creatives_controller.rb b/app/controllers/creatives_controller.rb index 3952157f7..89ec27865 100644 --- a/app/controllers/creatives_controller.rb +++ b/app/controllers/creatives_controller.rb @@ -65,13 +65,13 @@ def destroy private - # Use callbacks to share common setup or constraints between actions. - def set_creative - @creative = Creative.find(params[:id]) - end + # Use callbacks to share common setup or constraints between actions. + def set_creative + @creative = Creative.find(params[:id]) + end - # Never trust parameters from the scary internet, only allow the white list through. - def creative_params - params.fetch(:creative, {}) - end + # Never trust parameters from the scary internet, only allow the white list through. + def creative_params + params.fetch(:creative, {}) + end end diff --git a/app/controllers/distributions_controller.rb b/app/controllers/distributions_controller.rb index f5206f19e..ef57eb388 100644 --- a/app/controllers/distributions_controller.rb +++ b/app/controllers/distributions_controller.rb @@ -65,13 +65,13 @@ def destroy private - # Use callbacks to share common setup or constraints between actions. - def set_distribution - @distribution = Distribution.find(params[:id]) - end + # Use callbacks to share common setup or constraints between actions. + def set_distribution + @distribution = Distribution.find(params[:id]) + end - # Never trust parameters from the scary internet, only allow the white list through. - def distribution_params - params.fetch(:distribution, {}) - end + # Never trust parameters from the scary internet, only allow the white list through. + def distribution_params + params.fetch(:distribution, {}) + end end diff --git a/app/controllers/impressions_controller.rb b/app/controllers/impressions_controller.rb index 42fc54044..679281cde 100644 --- a/app/controllers/impressions_controller.rb +++ b/app/controllers/impressions_controller.rb @@ -65,13 +65,13 @@ def destroy private - # Use callbacks to share common setup or constraints between actions. - def set_impression - @impression = Impression.find(params[:id]) - end + # Use callbacks to share common setup or constraints between actions. + def set_impression + @impression = Impression.find(params[:id]) + end - # Never trust parameters from the scary internet, only allow the white list through. - def impression_params - params.fetch(:impression, {}) - end + # Never trust parameters from the scary internet, only allow the white list through. + def impression_params + params.fetch(:impression, {}) + end end diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index 402203cc9..dd91cabb8 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -65,13 +65,13 @@ def destroy private - # Use callbacks to share common setup or constraints between actions. - def set_invitation - @invitation = Invitation.find(params[:id]) - end + # Use callbacks to share common setup or constraints between actions. + def set_invitation + @invitation = Invitation.find(params[:id]) + end - # Never trust parameters from the scary internet, only allow the white list through. - def invitation_params - params.fetch(:invitation, {}) - end + # Never trust parameters from the scary internet, only allow the white list through. + def invitation_params + params.fetch(:invitation, {}) + end end diff --git a/app/controllers/properties_controller.rb b/app/controllers/properties_controller.rb index 08dc8c392..a1593b248 100644 --- a/app/controllers/properties_controller.rb +++ b/app/controllers/properties_controller.rb @@ -65,13 +65,13 @@ def destroy private - # Use callbacks to share common setup or constraints between actions. - def set_property - @property = Property.find(params[:id]) - end + # Use callbacks to share common setup or constraints between actions. + def set_property + @property = Property.find(params[:id]) + end - # Never trust parameters from the scary internet, only allow the white list through. - def property_params - params.fetch(:property, {}) - end + # Never trust parameters from the scary internet, only allow the white list through. + def property_params + params.fetch(:property, {}) + end end diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index 5022192f1..1cfeb4a70 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -65,13 +65,13 @@ def destroy private - # Use callbacks to share common setup or constraints between actions. - def set_template - @template = Template.find(params[:id]) - end + # Use callbacks to share common setup or constraints between actions. + def set_template + @template = Template.find(params[:id]) + end - # Never trust parameters from the scary internet, only allow the white list through. - def template_params - params.fetch(:template, {}) - end + # Never trust parameters from the scary internet, only allow the white list through. + def template_params + params.fetch(:template, {}) + end end diff --git a/app/controllers/themes_controller.rb b/app/controllers/themes_controller.rb index 8396ddf2a..c1da2b6b0 100644 --- a/app/controllers/themes_controller.rb +++ b/app/controllers/themes_controller.rb @@ -65,13 +65,13 @@ def destroy private - # Use callbacks to share common setup or constraints between actions. - def set_theme - @theme = Theme.find(params[:id]) - end + # Use callbacks to share common setup or constraints between actions. + def set_theme + @theme = Theme.find(params[:id]) + end - # Never trust parameters from the scary internet, only allow the white list through. - def theme_params - params.fetch(:theme, {}) - end + # Never trust parameters from the scary internet, only allow the white list through. + def theme_params + params.fetch(:theme, {}) + end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d5ae36c87..e03b8fb85 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -65,13 +65,13 @@ def destroy private - # Use callbacks to share common setup or constraints between actions. - def set_user - @user = User.find(params[:id]) - end + # Use callbacks to share common setup or constraints between actions. + def set_user + @user = User.find(params[:id]) + end - # Never trust parameters from the scary internet, only allow the white list through. - def user_params - params.fetch(:user, {}) - end + # Never trust parameters from the scary internet, only allow the white list through. + def user_params + params.fetch(:user, {}) + end end diff --git a/app/models/application_record.rb b/app/models/application_record.rb index c0cd845c1..cd980baf6 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -20,12 +20,12 @@ def created_at=(value) private - def set_id - self.id ||= ApplicationRecord.uuid - end - - def set_inserted_at - return unless respond_to?(:inserted_at=) - self.inserted_at ||= Time.current - end + def set_id + self.id ||= ApplicationRecord.uuid + end + + def set_inserted_at + return unless respond_to?(:inserted_at=) + self.inserted_at ||= Time.current + end end diff --git a/app/models/asset.rb b/app/models/asset.rb index 1f678baa6..61f402784 100644 --- a/app/models/asset.rb +++ b/app/models/asset.rb @@ -26,9 +26,9 @@ class Asset < ApplicationRecord has_many :creatives_as_wide_asset, class_name: "Creative", foreign_key: "wide_image_asset_id" # validations ............................................................... - validates :image_bucket, length: {maximum: 255, allow_blank: false} - validates :image_object, length: {maximum: 255, allow_blank: false} - validates :name, length: {maximum: 255, allow_blank: false} + validates :image_bucket, length: { maximum: 255, allow_blank: false } + validates :image_object, length: { maximum: 255, allow_blank: false } + validates :name, length: { maximum: 255, allow_blank: false } # callbacks ................................................................. # scopes .................................................................... diff --git a/app/models/campaign.rb b/app/models/campaign.rb index e2bc1ebf7..475d0752f 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -46,14 +46,14 @@ class Campaign < ApplicationRecord has_many :impressions # validations ............................................................... - validates :budget_daily_amount, numericality: {greater_than_or_equal_to: 0, allow_nil: false} - validates :ecpm, numericality: {greater_than_or_equal_to: 0, allow_nil: false} + validates :budget_daily_amount, numericality: { greater_than_or_equal_to: 0, allow_nil: false } + validates :ecpm, numericality: { greater_than_or_equal_to: 0, allow_nil: false } validates :fallback_campaign, presence: true - validates :impression_count, numericality: {greater_than_or_equal_to: 0, allow_nil: false} - validates :name, length: {maximum: 255, allow_blank: false} + validates :impression_count, numericality: { greater_than_or_equal_to: 0, allow_nil: false } + validates :name, length: { maximum: 255, allow_blank: false } validates :redirect_url, presence: true - validates :status, inclusion: {in: STATUSES.values} - validates :total_spend, numericality: {greater_than_or_equal_to: 0, allow_nil: false} + validates :status, inclusion: { in: STATUSES.values } + validates :total_spend, numericality: { greater_than_or_equal_to: 0, allow_nil: false } # callbacks ................................................................. diff --git a/app/models/creative.rb b/app/models/creative.rb index 5b63cad99..c79b3661e 100644 --- a/app/models/creative.rb +++ b/app/models/creative.rb @@ -28,9 +28,9 @@ class Creative < ApplicationRecord has_many :campaigns # validations ............................................................... - validates :body, length: {maximum: 255, allow_blank: false} - validates :headline, length: {maximum: 255, allow_blank: false} - validates :name, length: {maximum: 255, allow_blank: false} + validates :body, length: { maximum: 255, allow_blank: false } + validates :headline, length: { maximum: 255, allow_blank: false } + validates :name, length: { maximum: 255, allow_blank: false } # callbacks ................................................................. # scopes .................................................................... diff --git a/app/models/distribution.rb b/app/models/distribution.rb index d7aeb19b6..e4dc43447 100644 --- a/app/models/distribution.rb +++ b/app/models/distribution.rb @@ -21,8 +21,8 @@ class Distribution < ApplicationRecord has_many :impressions # validations ............................................................... - validates :amount, numericality: {greater_than_or_equal_to: 0, allow_nil: false} - validates :currency, length: {maximum: 255, allow_blank: false} + validates :amount, numericality: { greater_than_or_equal_to: 0, allow_nil: false } + validates :currency, length: { maximum: 255, allow_blank: false } validates :range_end, presence: true validates :range_start, presence: true diff --git a/app/models/impression.rb b/app/models/impression.rb index 1eceda447..95b4b0350 100644 --- a/app/models/impression.rb +++ b/app/models/impression.rb @@ -41,17 +41,17 @@ class Impression < ApplicationRecord belongs_to :property # validations ............................................................... - validates :browser, length: {maximum: 255} - validates :city, length: {maximum: 255} - validates :country, length: {maximum: 255} - validates :device_type, length: {maximum: 255} - validates :distribution_amount, numericality: {greater_than_or_equal_to: 0, allow_nil: false} - validates :ip, length: {maximum: 255, allow_blank: false} - validates :os, length: {maximum: 255} - validates :postal_code, length: {maximum: 255} - validates :redirected_to_url, length: {maximum: 255} - validates :region, length: {maximum: 255} - validates :revenue_amount, numericality: {greater_than_or_equal_to: 0, allow_nil: false} + validates :browser, length: { maximum: 255 } + validates :city, length: { maximum: 255 } + validates :country, length: { maximum: 255 } + validates :device_type, length: { maximum: 255 } + validates :distribution_amount, numericality: { greater_than_or_equal_to: 0, allow_nil: false } + validates :ip, length: { maximum: 255, allow_blank: false } + validates :os, length: { maximum: 255 } + validates :postal_code, length: { maximum: 255 } + validates :redirected_to_url, length: { maximum: 255 } + validates :region, length: { maximum: 255 } + validates :revenue_amount, numericality: { greater_than_or_equal_to: 0, allow_nil: false } # callbacks ................................................................. # scopes .................................................................... diff --git a/app/models/invitation.rb b/app/models/invitation.rb index 73b98b13a..9c7053d75 100644 --- a/app/models/invitation.rb +++ b/app/models/invitation.rb @@ -19,10 +19,10 @@ class Invitation < ApplicationRecord # relationships ............................................................. # validations ............................................................... - validates :email, length: {maximum: 255, allow_blank: false} - validates :first_name, length: {maximum: 255, allow_blank: false} - validates :last_name, length: {maximum: 255, allow_blank: false} - validates :token, length: {maximum: 255, allow_blank: false} + validates :email, length: { maximum: 255, allow_blank: false } + validates :first_name, length: { maximum: 255, allow_blank: false } + validates :last_name, length: { maximum: 255, allow_blank: false } + validates :token, length: { maximum: 255, allow_blank: false } # callbacks ................................................................. # scopes .................................................................... diff --git a/app/models/property.rb b/app/models/property.rb index a26b64de6..d6ef16942 100644 --- a/app/models/property.rb +++ b/app/models/property.rb @@ -52,15 +52,15 @@ class Property < ApplicationRecord has_many :impressions # validations ............................................................... - validates :language, length: {maximum: 255, allow_blank: false} - validates :legacy_id, length: {maximum: 255} - validates :name, length: {maximum: 255, allow_blank: false} + validates :language, length: { maximum: 255, allow_blank: false } + validates :legacy_id, length: { maximum: 255 } + validates :name, length: { maximum: 255, allow_blank: false } validates :no_api_house_ads, presence: true - validates :programming_languages, length: {maximum: 255, allow_blank: false} - validates :property_type, inclusion: {in: PROPERTY_TYPES.values} - validates :slug, length: {maximum: 255, allow_blank: false} - validates :status, inclusion: {in: STATUSES.values} - validates :topic_categories, length: {maximum: 255, allow_blank: false} + validates :programming_languages, length: { maximum: 255, allow_blank: false } + validates :property_type, inclusion: { in: PROPERTY_TYPES.values } + validates :slug, length: { maximum: 255, allow_blank: false } + validates :status, inclusion: { in: STATUSES.values } + validates :topic_categories, length: { maximum: 255, allow_blank: false } validates :url, presence: true # callbacks ................................................................. diff --git a/app/models/template.rb b/app/models/template.rb index 4c9ceec40..9276c5afd 100644 --- a/app/models/template.rb +++ b/app/models/template.rb @@ -22,8 +22,8 @@ class Template < ApplicationRecord has_many :themes # validations ............................................................... - validates :name, length: {maximum: 255, allow_blank: false} - validates :slug, length: {maximum: 255, allow_blank: false} + validates :name, length: { maximum: 255, allow_blank: false } + validates :slug, length: { maximum: 255, allow_blank: false } # callbacks ................................................................. # scopes .................................................................... diff --git a/app/models/theme.rb b/app/models/theme.rb index 6ef3c6245..644a58cf3 100644 --- a/app/models/theme.rb +++ b/app/models/theme.rb @@ -22,8 +22,8 @@ class Theme < ApplicationRecord belongs_to :template # validations ............................................................... - validates :name, length: {maximum: 255, allow_blank: false} - validates :slug, length: {maximum: 255, allow_blank: false} + validates :name, length: { maximum: 255, allow_blank: false } + validates :slug, length: { maximum: 255, allow_blank: false } # callbacks ................................................................. # scopes .................................................................... diff --git a/app/models/user.rb b/app/models/user.rb index be87e89bf..af1cde717 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -55,26 +55,26 @@ class User < ApplicationRecord has_many :properties # validations ............................................................... - validates :address_1, length: {maximum: 255} - validates :address_2, length: {maximum: 255} + validates :address_1, length: { maximum: 255 } + validates :address_2, length: { maximum: 255 } validates :api_access, presence: true - validates :api_key, length: {maximum: 255} - validates :city, length: {maximum: 255} - validates :company, length: {maximum: 255} - validates :country, length: {maximum: 255} - validates :current_sign_in_ip, length: {maximum: 255} - validates :email, length: {maximum: 255} - validates :first_name, length: {maximum: 255} - validates :last_name, length: {maximum: 255} - validates :last_sign_in_ip, length: {maximum: 255} - validates :password_hash, length: {maximum: 255} - validates :paypal_email, length: {maximum: 255} - validates :postal_code, length: {maximum: 255} - validates :region, length: {maximum: 255} - validates :reset_password_token, length: {maximum: 255} - validates :revenue_rate, numericality: {greater_than_or_equal_to: 0, allow_nil: false} - validates :roles, inclusion: {in: ROLES.values} - validates :unlock_token, length: {maximum: 255} + validates :api_key, length: { maximum: 255 } + validates :city, length: { maximum: 255 } + validates :company, length: { maximum: 255 } + validates :country, length: { maximum: 255 } + validates :current_sign_in_ip, length: { maximum: 255 } + validates :email, length: { maximum: 255 } + validates :first_name, length: { maximum: 255 } + validates :last_name, length: { maximum: 255 } + validates :last_sign_in_ip, length: { maximum: 255 } + validates :password_hash, length: { maximum: 255 } + validates :paypal_email, length: { maximum: 255 } + validates :postal_code, length: { maximum: 255 } + validates :region, length: { maximum: 255 } + validates :reset_password_token, length: { maximum: 255 } + validates :revenue_rate, numericality: { greater_than_or_equal_to: 0, allow_nil: false } + validates :roles, inclusion: { in: ROLES.values } + validates :unlock_token, length: { maximum: 255 } # callbacks ................................................................. diff --git a/app/views/assets/index.json.jbuilder b/app/views/assets/index.json.jbuilder index f88f797a2..a83c9dd32 100644 --- a/app/views/assets/index.json.jbuilder +++ b/app/views/assets/index.json.jbuilder @@ -1,3 +1,3 @@ # frozen_string_literal: true -json.array! @assets, partial: 'assets/asset', as: :asset +json.array! @assets, partial: "assets/asset", as: :asset diff --git a/app/views/campaigns/index.json.jbuilder b/app/views/campaigns/index.json.jbuilder index c0d951156..b50bc941f 100644 --- a/app/views/campaigns/index.json.jbuilder +++ b/app/views/campaigns/index.json.jbuilder @@ -1,3 +1,3 @@ # frozen_string_literal: true -json.array! @campaigns, partial: 'campaigns/campaign', as: :campaign +json.array! @campaigns, partial: "campaigns/campaign", as: :campaign diff --git a/app/views/creatives/index.json.jbuilder b/app/views/creatives/index.json.jbuilder index 37a8eb7e4..3a604fd00 100644 --- a/app/views/creatives/index.json.jbuilder +++ b/app/views/creatives/index.json.jbuilder @@ -1,3 +1,3 @@ # frozen_string_literal: true -json.array! @creatives, partial: 'creatives/creative', as: :creative +json.array! @creatives, partial: "creatives/creative", as: :creative diff --git a/app/views/distributions/index.json.jbuilder b/app/views/distributions/index.json.jbuilder index 9592bd4bb..9b9962be3 100644 --- a/app/views/distributions/index.json.jbuilder +++ b/app/views/distributions/index.json.jbuilder @@ -1,3 +1,3 @@ # frozen_string_literal: true -json.array! @distributions, partial: 'distributions/distribution', as: :distribution +json.array! @distributions, partial: "distributions/distribution", as: :distribution diff --git a/app/views/impressions/index.json.jbuilder b/app/views/impressions/index.json.jbuilder index 5430d3045..bf066dc51 100644 --- a/app/views/impressions/index.json.jbuilder +++ b/app/views/impressions/index.json.jbuilder @@ -1,3 +1,3 @@ # frozen_string_literal: true -json.array! @impressions, partial: 'impressions/impression', as: :impression +json.array! @impressions, partial: "impressions/impression", as: :impression diff --git a/app/views/invitations/index.json.jbuilder b/app/views/invitations/index.json.jbuilder index 80c85828c..0a2b176c6 100644 --- a/app/views/invitations/index.json.jbuilder +++ b/app/views/invitations/index.json.jbuilder @@ -1,3 +1,3 @@ # frozen_string_literal: true -json.array! @invitations, partial: 'invitations/invitation', as: :invitation +json.array! @invitations, partial: "invitations/invitation", as: :invitation diff --git a/app/views/properties/index.json.jbuilder b/app/views/properties/index.json.jbuilder index ee4baf915..1b0b8baad 100644 --- a/app/views/properties/index.json.jbuilder +++ b/app/views/properties/index.json.jbuilder @@ -1,3 +1,3 @@ # frozen_string_literal: true -json.array! @properties, partial: 'properties/property', as: :property +json.array! @properties, partial: "properties/property", as: :property diff --git a/app/views/themes/index.json.jbuilder b/app/views/themes/index.json.jbuilder index 72c74e3c7..305bd1c76 100644 --- a/app/views/themes/index.json.jbuilder +++ b/app/views/themes/index.json.jbuilder @@ -1,3 +1,3 @@ # frozen_string_literal: true -json.array! @themes, partial: 'themes/theme', as: :theme +json.array! @themes, partial: "themes/theme", as: :theme diff --git a/app/views/users/index.json.jbuilder b/app/views/users/index.json.jbuilder index 2ff955e3a..4cb7a3d2b 100644 --- a/app/views/users/index.json.jbuilder +++ b/app/views/users/index.json.jbuilder @@ -1,3 +1,3 @@ # frozen_string_literal: true -json.array! @users, partial: 'users/user', as: :user +json.array! @users, partial: "users/user", as: :user diff --git a/config.ru b/config.ru index f7ba0b527..bff88d608 100644 --- a/config.ru +++ b/config.ru @@ -1,5 +1,7 @@ +# frozen_string_literal: true + # This file is used by Rack-based servers to start the application. -require_relative 'config/environment' +require_relative "config/environment" run Rails.application diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index 2b271649e..e03f73031 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -55,8 +55,8 @@ ## Inputs # b.use :input, class: 'input', error_class: 'is-invalid', valid_class: 'is-valid' b.use :label_input - b.use :hint, wrap_with: {tag: :span, class: :hint} - b.use :error, wrap_with: {tag: :span, class: :error} + b.use :hint, wrap_with: { tag: :span, class: :hint } + b.use :error, wrap_with: { tag: :span, class: :error } ## full_messages_for # If you want to display the full error message for the attribute, you can diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb index 8c907d99a..b850a74d0 100644 --- a/config/initializers/simple_form_bootstrap.rb +++ b/config/initializers/simple_form_bootstrap.rb @@ -58,8 +58,8 @@ b.optional :readonly b.use :label, class: "form-control-label" b.use :input, class: "form-control", error_class: "is-invalid", valid_class: "is-valid" - b.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback"} - b.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback" } + b.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # vertical input for boolean @@ -69,8 +69,8 @@ b.wrapper :form_check_wrapper, tag: "div", class: "form-check" do |bb| bb.use :input, class: "form-check-input", error_class: "is-invalid", valid_class: "is-valid" bb.use :label, class: "form-check-label" - bb.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback"} - bb.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + bb.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback" } + bb.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end end @@ -82,8 +82,8 @@ ba.use :label_text end b.use :input, class: "form-check-input", error_class: "is-invalid", valid_class: "is-valid" - b.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - b.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + b.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # vertical input for inline radio buttons and check boxes @@ -94,8 +94,8 @@ ba.use :label_text end b.use :input, class: "form-check-input", error_class: "is-invalid", valid_class: "is-valid" - b.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - b.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + b.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # vertical file input @@ -107,8 +107,8 @@ b.optional :readonly b.use :label b.use :input, class: "form-control-file", error_class: "is-invalid", valid_class: "is-valid" - b.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - b.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + b.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # vertical multi select @@ -119,8 +119,8 @@ b.wrapper tag: "div", class: "d-flex flex-row justify-content-between align-items-center" do |ba| ba.use :input, class: "form-control mx-1", error_class: "is-invalid", valid_class: "is-valid" end - b.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - b.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + b.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # vertical range input @@ -131,8 +131,8 @@ b.optional :step b.use :label b.use :input, class: "form-control-range", error_class: "is-invalid", valid_class: "is-valid" - b.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - b.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + b.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # horizontal forms @@ -149,8 +149,8 @@ b.use :label, class: "col-sm-3 col-form-label" b.wrapper :grid_wrapper, tag: "div", class: "col-sm-9" do |ba| ba.use :input, class: "form-control", error_class: "is-invalid", valid_class: "is-valid" - ba.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback"} - ba.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + ba.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback" } + ba.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end end @@ -165,8 +165,8 @@ wr.wrapper :form_check_wrapper, tag: "div", class: "form-check" do |bb| bb.use :input, class: "form-check-input", error_class: "is-invalid", valid_class: "is-valid" bb.use :label, class: "form-check-label" - bb.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - bb.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + bb.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + bb.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end end end @@ -178,8 +178,8 @@ b.use :label, class: "col-sm-3 form-control-label" b.wrapper :grid_wrapper, tag: "div", class: "col-sm-9" do |ba| ba.use :input, class: "form-check-input", error_class: "is-invalid", valid_class: "is-valid" - ba.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - ba.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + ba.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + ba.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end end @@ -190,8 +190,8 @@ b.use :label, class: "col-sm-3 form-control-label" b.wrapper :grid_wrapper, tag: "div", class: "col-sm-9" do |ba| ba.use :input, class: "form-check-input", error_class: "is-invalid", valid_class: "is-valid" - ba.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - ba.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + ba.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + ba.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end end @@ -205,8 +205,8 @@ b.use :label, class: "col-sm-3 form-control-label" b.wrapper :grid_wrapper, tag: "div", class: "col-sm-9" do |ba| ba.use :input, error_class: "is-invalid", valid_class: "is-valid" - ba.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - ba.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + ba.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + ba.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end end @@ -219,8 +219,8 @@ ba.wrapper tag: "div", class: "d-flex flex-row justify-content-between align-items-center" do |bb| bb.use :input, class: "form-control mx-1", error_class: "is-invalid", valid_class: "is-valid" end - ba.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - ba.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + ba.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + ba.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end end @@ -233,8 +233,8 @@ b.use :label, class: "col-sm-3 form-control-label" b.wrapper :grid_wrapper, tag: "div", class: "col-sm-9" do |ba| ba.use :input, class: "form-control-range", error_class: "is-invalid", valid_class: "is-valid" - ba.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - ba.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + ba.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + ba.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end end @@ -252,8 +252,8 @@ b.use :label, class: "sr-only" b.use :input, class: "form-control", error_class: "is-invalid", valid_class: "is-valid" - b.use :error, wrap_with: {tag: "div", class: "invalid-feedback"} - b.optional :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :error, wrap_with: { tag: "div", class: "invalid-feedback" } + b.optional :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # inline input for boolean @@ -262,8 +262,8 @@ b.optional :readonly b.use :input, class: "form-check-input", error_class: "is-invalid", valid_class: "is-valid" b.use :label, class: "form-check-label" - b.use :error, wrap_with: {tag: "div", class: "invalid-feedback"} - b.optional :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :error, wrap_with: { tag: "div", class: "invalid-feedback" } + b.optional :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # bootstrap custom forms @@ -275,8 +275,8 @@ b.wrapper :form_check_wrapper, tag: "div", class: "custom-control custom-checkbox" do |bb| bb.use :input, class: "custom-control-input", error_class: "is-invalid", valid_class: "is-valid" bb.use :label, class: "custom-control-label" - bb.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback"} - bb.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + bb.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback" } + bb.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end end @@ -286,8 +286,8 @@ b.wrapper :form_check_wrapper, tag: "div", class: "custom-control custom-checkbox-switch" do |bb| bb.use :input, class: "custom-control-input", error_class: "is-invalid", valid_class: "is-valid" bb.use :label, class: "custom-control-label" - bb.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback"} - bb.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + bb.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback" } + bb.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end end @@ -299,8 +299,8 @@ ba.use :label_text end b.use :input, class: "custom-control-input", error_class: "is-invalid", valid_class: "is-valid" - b.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - b.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + b.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # custom input for inline radio buttons and check boxes @@ -311,8 +311,8 @@ ba.use :label_text end b.use :input, class: "custom-control-input", error_class: "is-invalid", valid_class: "is-valid" - b.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - b.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + b.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # custom file input @@ -326,9 +326,9 @@ b.wrapper :custom_file_wrapper, tag: "div", class: "custom-file" do |ba| ba.use :input, class: "custom-file-input", error_class: "is-invalid", valid_class: "is-valid" ba.use :label, class: "custom-file-label" - ba.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback"} + ba.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback" } end - b.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # custom multi select @@ -339,8 +339,8 @@ b.wrapper tag: "div", class: "d-flex flex-row justify-content-between align-items-center" do |ba| ba.use :input, class: "custom-select mx-1", error_class: "is-invalid", valid_class: "is-valid" end - b.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - b.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + b.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # custom range input @@ -351,8 +351,8 @@ b.optional :step b.use :label, class: "form-control-label" b.use :input, class: "custom-range", error_class: "is-invalid", valid_class: "is-valid" - b.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback d-block"} - b.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback d-block" } + b.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # Input Group - custom component @@ -388,8 +388,8 @@ b.optional :readonly b.use :input, class: "form-control", error_class: "is-invalid", valid_class: "is-valid" b.use :label, class: "form-control-label" - b.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback"} - b.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback" } + b.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # custom multi select @@ -398,8 +398,8 @@ b.optional :readonly b.use :input, class: "custom-select custom-select-lg", error_class: "is-invalid", valid_class: "is-valid" b.use :label, class: "form-control-label" - b.use :full_error, wrap_with: {tag: "div", class: "invalid-feedback"} - b.use :hint, wrap_with: {tag: "small", class: "form-text text-muted"} + b.use :full_error, wrap_with: { tag: "div", class: "invalid-feedback" } + b.use :hint, wrap_with: { tag: "small", class: "form-text text-muted" } end # The default wrapper to be used by the FormBuilder. diff --git a/db/schema.rb b/db/schema.rb index a2839bb70..e1dc797a6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -13,7 +13,6 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2018_10_17_152837) do - # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" enable_extension "pgcrypto" diff --git a/test/controllers/assets_controller_test.rb b/test/controllers/assets_controller_test.rb index 7a4e187d2..26b9b5b32 100644 --- a/test/controllers/assets_controller_test.rb +++ b/test/controllers/assets_controller_test.rb @@ -3,48 +3,48 @@ require "test_helper" class AssetsControllerTest < ActionDispatch::IntegrationTest - #setup do - #@asset = assets(:one) - #end - - #test "should get index" do - #get assets_url - #assert_response :success - #end - - #test "should get new" do - #get new_asset_url - #assert_response :success - #end - - #test "should create asset" do - #assert_difference('Asset.count') do - #post assets_url, params: { asset: { } } - #end - - #assert_redirected_to asset_url(Asset.last) - #end - - #test "should show asset" do - #get asset_url(@asset) - #assert_response :success - #end - - #test "should get edit" do - #get edit_asset_url(@asset) - #assert_response :success - #end - - #test "should update asset" do - #patch asset_url(@asset), params: { asset: { } } - #assert_redirected_to asset_url(@asset) - #end - - #test "should destroy asset" do - #assert_difference('Asset.count', -1) do - #delete asset_url(@asset) - #end - - #assert_redirected_to assets_url - #end + # setup do + # @asset = assets(:one) + # end + + # test "should get index" do + # get assets_url + # assert_response :success + # end + + # test "should get new" do + # get new_asset_url + # assert_response :success + # end + + # test "should create asset" do + # assert_difference('Asset.count') do + # post assets_url, params: { asset: { } } + # end + + # assert_redirected_to asset_url(Asset.last) + # end + + # test "should show asset" do + # get asset_url(@asset) + # assert_response :success + # end + + # test "should get edit" do + # get edit_asset_url(@asset) + # assert_response :success + # end + + # test "should update asset" do + # patch asset_url(@asset), params: { asset: { } } + # assert_redirected_to asset_url(@asset) + # end + + # test "should destroy asset" do + # assert_difference('Asset.count', -1) do + # delete asset_url(@asset) + # end + + # assert_redirected_to assets_url + # end end diff --git a/test/controllers/campaigns_controller_test.rb b/test/controllers/campaigns_controller_test.rb index 6e8765f63..48fd8fc5e 100644 --- a/test/controllers/campaigns_controller_test.rb +++ b/test/controllers/campaigns_controller_test.rb @@ -3,48 +3,48 @@ require "test_helper" class CampaignsControllerTest < ActionDispatch::IntegrationTest - #setup do - #@campaign = campaigns(:one) - #end - - #test "should get index" do - #get campaigns_url - #assert_response :success - #end - - #test "should get new" do - #get new_campaign_url - #assert_response :success - #end - - #test "should create campaign" do - #assert_difference('Campaign.count') do - #post campaigns_url, params: { campaign: { } } - #end - - #assert_redirected_to campaign_url(Campaign.last) - #end - - #test "should show campaign" do - #get campaign_url(@campaign) - #assert_response :success - #end - - #test "should get edit" do - #get edit_campaign_url(@campaign) - #assert_response :success - #end - - #test "should update campaign" do - #patch campaign_url(@campaign), params: { campaign: { } } - #assert_redirected_to campaign_url(@campaign) - #end - - #test "should destroy campaign" do - #assert_difference('Campaign.count', -1) do - #delete campaign_url(@campaign) - #end - - #assert_redirected_to campaigns_url - #end + # setup do + # @campaign = campaigns(:one) + # end + + # test "should get index" do + # get campaigns_url + # assert_response :success + # end + + # test "should get new" do + # get new_campaign_url + # assert_response :success + # end + + # test "should create campaign" do + # assert_difference('Campaign.count') do + # post campaigns_url, params: { campaign: { } } + # end + + # assert_redirected_to campaign_url(Campaign.last) + # end + + # test "should show campaign" do + # get campaign_url(@campaign) + # assert_response :success + # end + + # test "should get edit" do + # get edit_campaign_url(@campaign) + # assert_response :success + # end + + # test "should update campaign" do + # patch campaign_url(@campaign), params: { campaign: { } } + # assert_redirected_to campaign_url(@campaign) + # end + + # test "should destroy campaign" do + # assert_difference('Campaign.count', -1) do + # delete campaign_url(@campaign) + # end + + # assert_redirected_to campaigns_url + # end end diff --git a/test/controllers/creatives_controller_test.rb b/test/controllers/creatives_controller_test.rb index bd5c72e34..c92b24db7 100644 --- a/test/controllers/creatives_controller_test.rb +++ b/test/controllers/creatives_controller_test.rb @@ -3,48 +3,48 @@ require "test_helper" class CreativesControllerTest < ActionDispatch::IntegrationTest - #setup do - #@creative = creatives(:one) - #end - - #test "should get index" do - #get creatives_url - #assert_response :success - #end - - #test "should get new" do - #get new_creative_url - #assert_response :success - #end - - #test "should create creative" do - #assert_difference('Creative.count') do - #post creatives_url, params: { creative: { } } - #end - - #assert_redirected_to creative_url(Creative.last) - #end - - #test "should show creative" do - #get creative_url(@creative) - #assert_response :success - #end - - #test "should get edit" do - #get edit_creative_url(@creative) - #assert_response :success - #end - - #test "should update creative" do - #patch creative_url(@creative), params: { creative: { } } - #assert_redirected_to creative_url(@creative) - #end - - #test "should destroy creative" do - #assert_difference('Creative.count', -1) do - #delete creative_url(@creative) - #end - - #assert_redirected_to creatives_url - #end + # setup do + # @creative = creatives(:one) + # end + + # test "should get index" do + # get creatives_url + # assert_response :success + # end + + # test "should get new" do + # get new_creative_url + # assert_response :success + # end + + # test "should create creative" do + # assert_difference('Creative.count') do + # post creatives_url, params: { creative: { } } + # end + + # assert_redirected_to creative_url(Creative.last) + # end + + # test "should show creative" do + # get creative_url(@creative) + # assert_response :success + # end + + # test "should get edit" do + # get edit_creative_url(@creative) + # assert_response :success + # end + + # test "should update creative" do + # patch creative_url(@creative), params: { creative: { } } + # assert_redirected_to creative_url(@creative) + # end + + # test "should destroy creative" do + # assert_difference('Creative.count', -1) do + # delete creative_url(@creative) + # end + + # assert_redirected_to creatives_url + # end end diff --git a/test/controllers/distributions_controller_test.rb b/test/controllers/distributions_controller_test.rb index 624bf2299..d949977c7 100644 --- a/test/controllers/distributions_controller_test.rb +++ b/test/controllers/distributions_controller_test.rb @@ -3,48 +3,48 @@ require "test_helper" class DistributionsControllerTest < ActionDispatch::IntegrationTest - #setup do - #@distribution = distributions(:one) - #end - - #test "should get index" do - #get distributions_url - #assert_response :success - #end - - #test "should get new" do - #get new_distribution_url - #assert_response :success - #end - - #test "should create distribution" do - #assert_difference('Distribution.count') do - #post distributions_url, params: { distribution: { } } - #end - - #assert_redirected_to distribution_url(Distribution.last) - #end - - #test "should show distribution" do - #get distribution_url(@distribution) - #assert_response :success - #end - - #test "should get edit" do - #get edit_distribution_url(@distribution) - #assert_response :success - #end - - #test "should update distribution" do - #patch distribution_url(@distribution), params: { distribution: { } } - #assert_redirected_to distribution_url(@distribution) - #end - - #test "should destroy distribution" do - #assert_difference('Distribution.count', -1) do - #delete distribution_url(@distribution) - #end - - #assert_redirected_to distributions_url - #end + # setup do + # @distribution = distributions(:one) + # end + + # test "should get index" do + # get distributions_url + # assert_response :success + # end + + # test "should get new" do + # get new_distribution_url + # assert_response :success + # end + + # test "should create distribution" do + # assert_difference('Distribution.count') do + # post distributions_url, params: { distribution: { } } + # end + + # assert_redirected_to distribution_url(Distribution.last) + # end + + # test "should show distribution" do + # get distribution_url(@distribution) + # assert_response :success + # end + + # test "should get edit" do + # get edit_distribution_url(@distribution) + # assert_response :success + # end + + # test "should update distribution" do + # patch distribution_url(@distribution), params: { distribution: { } } + # assert_redirected_to distribution_url(@distribution) + # end + + # test "should destroy distribution" do + # assert_difference('Distribution.count', -1) do + # delete distribution_url(@distribution) + # end + + # assert_redirected_to distributions_url + # end end diff --git a/test/controllers/impressions_controller_test.rb b/test/controllers/impressions_controller_test.rb index a14ed1de0..52d3acc36 100644 --- a/test/controllers/impressions_controller_test.rb +++ b/test/controllers/impressions_controller_test.rb @@ -3,48 +3,48 @@ require "test_helper" class ImpressionsControllerTest < ActionDispatch::IntegrationTest - #setup do - #@impression = impressions(:one) - #end - - #test "should get index" do - #get impressions_url - #assert_response :success - #end - - #test "should get new" do - #get new_impression_url - #assert_response :success - #end - - #test "should create impression" do - #assert_difference('Impression.count') do - #post impressions_url, params: { impression: { } } - #end - - #assert_redirected_to impression_url(Impression.last) - #end - - #test "should show impression" do - #get impression_url(@impression) - #assert_response :success - #end - - #test "should get edit" do - #get edit_impression_url(@impression) - #assert_response :success - #end - - #test "should update impression" do - #patch impression_url(@impression), params: { impression: { } } - #assert_redirected_to impression_url(@impression) - #end - - #test "should destroy impression" do - #assert_difference('Impression.count', -1) do - #delete impression_url(@impression) - #end - - #assert_redirected_to impressions_url - #end + # setup do + # @impression = impressions(:one) + # end + + # test "should get index" do + # get impressions_url + # assert_response :success + # end + + # test "should get new" do + # get new_impression_url + # assert_response :success + # end + + # test "should create impression" do + # assert_difference('Impression.count') do + # post impressions_url, params: { impression: { } } + # end + + # assert_redirected_to impression_url(Impression.last) + # end + + # test "should show impression" do + # get impression_url(@impression) + # assert_response :success + # end + + # test "should get edit" do + # get edit_impression_url(@impression) + # assert_response :success + # end + + # test "should update impression" do + # patch impression_url(@impression), params: { impression: { } } + # assert_redirected_to impression_url(@impression) + # end + + # test "should destroy impression" do + # assert_difference('Impression.count', -1) do + # delete impression_url(@impression) + # end + + # assert_redirected_to impressions_url + # end end diff --git a/test/controllers/invitations_controller_test.rb b/test/controllers/invitations_controller_test.rb index ff0379ee7..a3a90d743 100644 --- a/test/controllers/invitations_controller_test.rb +++ b/test/controllers/invitations_controller_test.rb @@ -3,48 +3,48 @@ require "test_helper" class InvitationsControllerTest < ActionDispatch::IntegrationTest - #setup do - #@invitation = invitations(:one) - #end - - #test "should get index" do - #get invitations_url - #assert_response :success - #end - - #test "should get new" do - #get new_invitation_url - #assert_response :success - #end - - #test "should create invitation" do - #assert_difference('Invitation.count') do - #post invitations_url, params: { invitation: { } } - #end - - #assert_redirected_to invitation_url(Invitation.last) - #end - - #test "should show invitation" do - #get invitation_url(@invitation) - #assert_response :success - #end - - #test "should get edit" do - #get edit_invitation_url(@invitation) - #assert_response :success - #end - - #test "should update invitation" do - #patch invitation_url(@invitation), params: { invitation: { } } - #assert_redirected_to invitation_url(@invitation) - #end - - #test "should destroy invitation" do - #assert_difference('Invitation.count', -1) do - #delete invitation_url(@invitation) - #end - - #assert_redirected_to invitations_url - #end + # setup do + # @invitation = invitations(:one) + # end + + # test "should get index" do + # get invitations_url + # assert_response :success + # end + + # test "should get new" do + # get new_invitation_url + # assert_response :success + # end + + # test "should create invitation" do + # assert_difference('Invitation.count') do + # post invitations_url, params: { invitation: { } } + # end + + # assert_redirected_to invitation_url(Invitation.last) + # end + + # test "should show invitation" do + # get invitation_url(@invitation) + # assert_response :success + # end + + # test "should get edit" do + # get edit_invitation_url(@invitation) + # assert_response :success + # end + + # test "should update invitation" do + # patch invitation_url(@invitation), params: { invitation: { } } + # assert_redirected_to invitation_url(@invitation) + # end + + # test "should destroy invitation" do + # assert_difference('Invitation.count', -1) do + # delete invitation_url(@invitation) + # end + + # assert_redirected_to invitations_url + # end end diff --git a/test/controllers/properties_controller_test.rb b/test/controllers/properties_controller_test.rb index b1f837eda..ded7a3337 100644 --- a/test/controllers/properties_controller_test.rb +++ b/test/controllers/properties_controller_test.rb @@ -3,48 +3,48 @@ require "test_helper" class PropertiesControllerTest < ActionDispatch::IntegrationTest - #setup do - #@property = properties(:one) - #end - - #test "should get index" do - #get properties_url - #assert_response :success - #end - - #test "should get new" do - #get new_property_url - #assert_response :success - #end - - #test "should create property" do - #assert_difference('Property.count') do - #post properties_url, params: { property: { } } - #end - - #assert_redirected_to property_url(Property.last) - #end - - #test "should show property" do - #get property_url(@property) - #assert_response :success - #end - - #test "should get edit" do - #get edit_property_url(@property) - #assert_response :success - #end - - #test "should update property" do - #patch property_url(@property), params: { property: { } } - #assert_redirected_to property_url(@property) - #end - - #test "should destroy property" do - #assert_difference('Property.count', -1) do - #delete property_url(@property) - #end - - #assert_redirected_to properties_url - #end + # setup do + # @property = properties(:one) + # end + + # test "should get index" do + # get properties_url + # assert_response :success + # end + + # test "should get new" do + # get new_property_url + # assert_response :success + # end + + # test "should create property" do + # assert_difference('Property.count') do + # post properties_url, params: { property: { } } + # end + + # assert_redirected_to property_url(Property.last) + # end + + # test "should show property" do + # get property_url(@property) + # assert_response :success + # end + + # test "should get edit" do + # get edit_property_url(@property) + # assert_response :success + # end + + # test "should update property" do + # patch property_url(@property), params: { property: { } } + # assert_redirected_to property_url(@property) + # end + + # test "should destroy property" do + # assert_difference('Property.count', -1) do + # delete property_url(@property) + # end + + # assert_redirected_to properties_url + # end end diff --git a/test/controllers/templates_controller_test.rb b/test/controllers/templates_controller_test.rb index a136a4915..a8c76107d 100644 --- a/test/controllers/templates_controller_test.rb +++ b/test/controllers/templates_controller_test.rb @@ -3,48 +3,48 @@ require "test_helper" class TemplatesControllerTest < ActionDispatch::IntegrationTest - #setup do - #@template = templates(:one) - #end - - #test "should get index" do - #get templates_url - #assert_response :success - #end - - #test "should get new" do - #get new_template_url - #assert_response :success - #end - - #test "should create template" do - #assert_difference('Template.count') do - #post templates_url, params: { template: { } } - #end - - #assert_redirected_to template_url(Template.last) - #end - - #test "should show template" do - #get template_url(@template) - #assert_response :success - #end - - #test "should get edit" do - #get edit_template_url(@template) - #assert_response :success - #end - - #test "should update template" do - #patch template_url(@template), params: { template: { } } - #assert_redirected_to template_url(@template) - #end - - #test "should destroy template" do - #assert_difference('Template.count', -1) do - #delete template_url(@template) - #end - - #assert_redirected_to templates_url - #end + # setup do + # @template = templates(:one) + # end + + # test "should get index" do + # get templates_url + # assert_response :success + # end + + # test "should get new" do + # get new_template_url + # assert_response :success + # end + + # test "should create template" do + # assert_difference('Template.count') do + # post templates_url, params: { template: { } } + # end + + # assert_redirected_to template_url(Template.last) + # end + + # test "should show template" do + # get template_url(@template) + # assert_response :success + # end + + # test "should get edit" do + # get edit_template_url(@template) + # assert_response :success + # end + + # test "should update template" do + # patch template_url(@template), params: { template: { } } + # assert_redirected_to template_url(@template) + # end + + # test "should destroy template" do + # assert_difference('Template.count', -1) do + # delete template_url(@template) + # end + + # assert_redirected_to templates_url + # end end diff --git a/test/controllers/themes_controller_test.rb b/test/controllers/themes_controller_test.rb index b11390e70..d76e6485e 100644 --- a/test/controllers/themes_controller_test.rb +++ b/test/controllers/themes_controller_test.rb @@ -3,48 +3,48 @@ require "test_helper" class ThemesControllerTest < ActionDispatch::IntegrationTest - #setup do - #@theme = themes(:one) - #end - - #test "should get index" do - #get themes_url - #assert_response :success - #end - - #test "should get new" do - #get new_theme_url - #assert_response :success - #end - - #test "should create theme" do - #assert_difference('Theme.count') do - #post themes_url, params: { theme: { } } - #end - - #assert_redirected_to theme_url(Theme.last) - #end - - #test "should show theme" do - #get theme_url(@theme) - #assert_response :success - #end - - #test "should get edit" do - #get edit_theme_url(@theme) - #assert_response :success - #end - - #test "should update theme" do - #patch theme_url(@theme), params: { theme: { } } - #assert_redirected_to theme_url(@theme) - #end - - #test "should destroy theme" do - #assert_difference('Theme.count', -1) do - #delete theme_url(@theme) - #end - - #assert_redirected_to themes_url - #end + # setup do + # @theme = themes(:one) + # end + + # test "should get index" do + # get themes_url + # assert_response :success + # end + + # test "should get new" do + # get new_theme_url + # assert_response :success + # end + + # test "should create theme" do + # assert_difference('Theme.count') do + # post themes_url, params: { theme: { } } + # end + + # assert_redirected_to theme_url(Theme.last) + # end + + # test "should show theme" do + # get theme_url(@theme) + # assert_response :success + # end + + # test "should get edit" do + # get edit_theme_url(@theme) + # assert_response :success + # end + + # test "should update theme" do + # patch theme_url(@theme), params: { theme: { } } + # assert_redirected_to theme_url(@theme) + # end + + # test "should destroy theme" do + # assert_difference('Theme.count', -1) do + # delete theme_url(@theme) + # end + + # assert_redirected_to themes_url + # end end diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index 975de82c1..67c510eae 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -3,48 +3,48 @@ require "test_helper" class UsersControllerTest < ActionDispatch::IntegrationTest - #setup do - #@user = users(:one) - #end - - #test "should get index" do - #get users_url - #assert_response :success - #end - - #test "should get new" do - #get new_user_url - #assert_response :success - #end - - #test "should create user" do - #assert_difference('User.count') do - #post users_url, params: { user: { } } - #end - - #assert_redirected_to user_url(User.last) - #end - - #test "should show user" do - #get user_url(@user) - #assert_response :success - #end - - #test "should get edit" do - #get edit_user_url(@user) - #assert_response :success - #end - - #test "should update user" do - #patch user_url(@user), params: { user: { } } - #assert_redirected_to user_url(@user) - #end - - #test "should destroy user" do - #assert_difference('User.count', -1) do - #delete user_url(@user) - #end - - #assert_redirected_to users_url - #end + # setup do + # @user = users(:one) + # end + + # test "should get index" do + # get users_url + # assert_response :success + # end + + # test "should get new" do + # get new_user_url + # assert_response :success + # end + + # test "should create user" do + # assert_difference('User.count') do + # post users_url, params: { user: { } } + # end + + # assert_redirected_to user_url(User.last) + # end + + # test "should show user" do + # get user_url(@user) + # assert_response :success + # end + + # test "should get edit" do + # get edit_user_url(@user) + # assert_response :success + # end + + # test "should update user" do + # patch user_url(@user), params: { user: { } } + # assert_redirected_to user_url(@user) + # end + + # test "should destroy user" do + # assert_difference('User.count', -1) do + # delete user_url(@user) + # end + + # assert_redirected_to users_url + # end end