diff --git a/.rubocop.yml b/.rubocop.yml index 5537838..96da17d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,6 @@ -require: rubocop-rspec +require: + - rubocop-rails + - rubocop-rspec AllCops: TargetRubyVersion: 2.5 @@ -15,7 +17,7 @@ AllCops: - '.git/**/*' IndentationConsistency: - EnforcedStyle: 'rails' + EnforcedStyle: 'indented_internal_methods' Naming/FileName: Exclude: @@ -23,9 +25,6 @@ Naming/FileName: - 'Guardfile' - 'Rakefile' -Rails: - Enabled: true - Metrics/CyclomaticComplexity: Max: 15 diff --git a/Gemfile b/Gemfile index 0632ae7..06fb50c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,59 +1,61 @@ -source 'https://rubygems.org' ruby '2.5.1' +source 'https://rubygems.org' + # app server -gem 'rails', '~> 5.2.0' +gem 'rails', '~> 5.2' # database -gem 'pg' +gem 'pg', '~> 1.2' # webserver -gem 'puma' +gem 'puma', '~> 3.12' # webserver -gem 'microformats', '~> 4.0.7' +gem 'microformats', '~> 4.2' # assets -gem 'autoprefixer-rails' -gem 'bootstrap' -gem 'jquery-rails' -gem 'sass-rails' -gem 'uglifier' +gem 'autoprefixer-rails', '~> 9.7' +gem 'bootstrap', '~> 4.4' +gem 'jquery-rails', '~> 4.3' +gem 'sass-rails', '~> 5.1' +gem 'uglifier', '~> 4.2' # For codestyle guide and linting -gem 'rubocop', require: false -gem 'rubocop-rspec' +gem 'rubocop', '~> 0.82.0', require: false +gem 'rubocop-rails', '~> 2.5', require: false +gem 'rubocop-rspec', '~> 1.38', require: false # dev and testing group :development, :test do - gem 'byebug', platform: :mri - gem 'factory_bot_rails' - gem 'guard-rspec' - gem 'nokogiri' - gem 'rails-controller-testing' - gem 'rspec-rails' - gem 'simplecov', require: false - gem 'spring-commands-rspec' + gem 'byebug', '~> 10.0', platform: :mri + gem 'factory_bot_rails', '~> 5.1' + gem 'guard-rspec', '~> 4.7' + gem 'nokogiri', '~> 1.10' + gem 'rails-controller-testing', '~> 1.0' + gem 'rspec-rails', '~> 4.0' + gem 'simplecov', '~> 0.18.5', require: false + gem 'spring-commands-rspec', '~> 1.0' end # dev group :development do - gem 'listen', '~> 3.1.5' - gem 'spring' - gem 'spring-watcher-listen', '~> 2.0.0' - gem 'web-console' + gem 'listen', '~> 3.2' + gem 'spring', '~> 2.1' + gem 'spring-watcher-listen', '~> 2.0' + gem 'web-console', '~> 3.7' # For measuring page/code performance - gem 'rack-mini-profiler' + gem 'rack-mini-profiler', '~> 2.0' # For memory profiling - gem 'memory_profiler' + gem 'memory_profiler', '~> 0.9.14' # For call-stack profiling flamegraphs - gem 'fast_stack' - gem 'flamegraph' - gem 'stackprof' + gem 'fast_stack', '~> 0.2.0' + gem 'flamegraph', '~> 0.9.5' + gem 'stackprof', '~> 0.2.15' end # windows dev -gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] +gem 'tzinfo-data', '~> 1.2019', platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/Gemfile.lock b/Gemfile.lock index 8b9fa42..6bf191c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,77 +1,77 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.2.0) - actionpack (= 5.2.0) + actioncable (5.2.4.2) + actionpack (= 5.2.4.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.0) - actionpack (= 5.2.0) - actionview (= 5.2.0) - activejob (= 5.2.0) + actionmailer (5.2.4.2) + actionpack (= 5.2.4.2) + actionview (= 5.2.4.2) + activejob (= 5.2.4.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.0) - actionview (= 5.2.0) - activesupport (= 5.2.0) - rack (~> 2.0) + actionpack (5.2.4.2) + actionview (= 5.2.4.2) + activesupport (= 5.2.4.2) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.0) - activesupport (= 5.2.0) + actionview (5.2.4.2) + activesupport (= 5.2.4.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.0) - activesupport (= 5.2.0) + activejob (5.2.4.2) + activesupport (= 5.2.4.2) globalid (>= 0.3.6) - activemodel (5.2.0) - activesupport (= 5.2.0) - activerecord (5.2.0) - activemodel (= 5.2.0) - activesupport (= 5.2.0) + activemodel (5.2.4.2) + activesupport (= 5.2.4.2) + activerecord (5.2.4.2) + activemodel (= 5.2.4.2) + activesupport (= 5.2.4.2) arel (>= 9.0) - activestorage (5.2.0) - actionpack (= 5.2.0) - activerecord (= 5.2.0) + activestorage (5.2.4.2) + actionpack (= 5.2.4.2) + activerecord (= 5.2.4.2) marcel (~> 0.3.1) - activesupport (5.2.0) + activesupport (5.2.4.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) arel (9.0.0) ast (2.4.0) - autoprefixer-rails (9.1.0) + autoprefixer-rails (9.7.6) execjs - bindex (0.5.0) - bootstrap (4.1.3) - autoprefixer-rails (>= 6.0.3) - popper_js (>= 1.12.9, < 2) - sass (>= 3.5.2) - builder (3.2.3) + bindex (0.8.1) + bootstrap (4.4.1) + autoprefixer-rails (>= 9.1.0) + popper_js (>= 1.14.3, < 2) + sassc-rails (>= 2.0.0) + builder (3.2.4) byebug (10.0.2) coderay (1.1.2) - concurrent-ruby (1.0.5) - crass (1.0.4) + concurrent-ruby (1.1.6) + crass (1.0.6) diff-lcs (1.3) - docile (1.3.1) - erubi (1.7.1) + docile (1.3.2) + erubi (1.9.0) execjs (2.7.0) - factory_bot (4.10.0) - activesupport (>= 3.0.0) - factory_bot_rails (4.10.0) - factory_bot (~> 4.10.0) - railties (>= 3.0.0) + factory_bot (5.1.2) + activesupport (>= 4.2.0) + factory_bot_rails (5.1.1) + factory_bot (~> 5.1.0) + railties (>= 4.2.0) fast_stack (0.2.0) - ffi (1.9.25) + ffi (1.12.2) flamegraph (0.9.5) formatador (0.2.5) - globalid (0.4.1) + globalid (0.4.2) activesupport (>= 4.2.0) - guard (2.14.2) + guard (2.16.2) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) lumberjack (>= 1.0.12, < 2.0) @@ -85,142 +85,150 @@ GEM guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - i18n (1.0.1) + i18n (1.8.2) concurrent-ruby (~> 1.0) - jaro_winkler (1.5.1) - jquery-rails (4.3.3) + jaro_winkler (1.5.4) + jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.1.0) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) - loofah (2.2.2) + json (2.3.0) + listen (3.2.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.5.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - lumberjack (1.0.13) - mail (2.7.0) + lumberjack (1.2.4) + mail (2.7.1) mini_mime (>= 0.1.1) - marcel (0.3.2) + marcel (0.3.3) mimemagic (~> 0.3.2) - memory_profiler (0.9.11) - method_source (0.9.0) - microformats (4.0.7) - json - nokogiri - mimemagic (0.3.2) - mini_mime (1.0.0) - mini_portile2 (2.3.0) - minitest (5.11.3) + memory_profiler (0.9.14) + method_source (1.0.0) + microformats (4.2.0) + json (~> 2.2) + nokogiri (~> 1.10) + mimemagic (0.3.4) + mini_mime (1.0.2) + mini_portile2 (2.4.0) + minitest (5.14.0) nenv (0.3.0) - nio4r (2.3.1) - nokogiri (1.8.4) - mini_portile2 (~> 2.3.0) - notiffany (0.1.1) + nio4r (2.5.2) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) + notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) - parallel (1.12.1) - parser (2.5.1.2) + parallel (1.19.1) + parser (2.7.1.1) ast (~> 2.4.0) - pg (1.0.0) - popper_js (1.14.3) - powerpack (0.1.2) - pry (0.11.3) - coderay (~> 1.1.0) - method_source (~> 0.9.0) - puma (3.12.0) - rack (2.0.5) - rack-mini-profiler (1.0.0) + pg (1.2.3) + popper_js (1.16.0) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + puma (3.12.4) + rack (2.2.2) + rack-mini-profiler (2.0.1) rack (>= 1.2.0) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.0) - actioncable (= 5.2.0) - actionmailer (= 5.2.0) - actionpack (= 5.2.0) - actionview (= 5.2.0) - activejob (= 5.2.0) - activemodel (= 5.2.0) - activerecord (= 5.2.0) - activestorage (= 5.2.0) - activesupport (= 5.2.0) + rails (5.2.4.2) + actioncable (= 5.2.4.2) + actionmailer (= 5.2.4.2) + actionpack (= 5.2.4.2) + actionview (= 5.2.4.2) + activejob (= 5.2.4.2) + activemodel (= 5.2.4.2) + activerecord (= 5.2.4.2) + activestorage (= 5.2.4.2) + activesupport (= 5.2.4.2) bundler (>= 1.3.0) - railties (= 5.2.0) + railties (= 5.2.4.2) sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.2) - actionpack (~> 5.x, >= 5.0.1) - actionview (~> 5.x, >= 5.0.1) - activesupport (~> 5.x) + rails-controller-testing (1.0.4) + actionpack (>= 5.0.1.x) + actionview (>= 5.0.1.x) + activesupport (>= 5.0.1.x) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) - railties (5.2.0) - actionpack (= 5.2.0) - activesupport (= 5.2.0) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (5.2.4.2) + actionpack (= 5.2.4.2) + activesupport (= 5.2.4.2) method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) + thor (>= 0.19.0, < 2.0) rainbow (3.0.0) - rake (12.3.1) + rake (13.0.1) rb-fsevent (0.10.3) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.0) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.0) + rb-inotify (0.10.1) + ffi (~> 1.0) + rexml (3.2.4) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.1) + rspec-support (~> 3.9.1) + rspec-expectations (3.9.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.0) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-rails (3.8.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.0) - rubocop (0.58.2) + rspec-support (~> 3.9.0) + rspec-rails (4.0.0) + actionpack (>= 4.2) + activesupport (>= 4.2) + railties (>= 4.2) + rspec-core (~> 3.9) + rspec-expectations (~> 3.9) + rspec-mocks (~> 3.9) + rspec-support (~> 3.9) + rspec-support (3.9.2) + rubocop (0.82.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.5, != 2.5.1.1) - powerpack (~> 0.1) + parser (>= 2.7.0.1) rainbow (>= 2.2.2, < 4.0) + rexml ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) - rubocop-rspec (1.27.0) - rubocop (>= 0.56.0) - ruby-progressbar (1.9.0) - ruby_dep (1.5.0) - sass (3.5.7) + unicode-display_width (>= 1.4.0, < 2.0) + rubocop-rails (2.5.2) + activesupport + rack (>= 1.1) + rubocop (>= 0.72.0) + rubocop-rspec (1.38.1) + rubocop (>= 0.68.1) + ruby-progressbar (1.10.1) + sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) + sass-rails (5.1.0) + railties (>= 5.2.0) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) + sassc (2.3.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt shellany (0.0.1) - simplecov (0.16.1) + simplecov (0.18.5) docile (~> 1.1) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.2) - spring (2.0.2) - activesupport (>= 4.2) + simplecov-html (~> 0.11) + simplecov-html (0.12.2) + spring (2.1.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) spring-watcher-listen (2.0.1) @@ -233,57 +241,58 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - stackprof (0.2.12) - thor (0.20.0) + stackprof (0.2.15) + thor (1.0.1) thread_safe (0.3.6) - tilt (2.0.8) - tzinfo (1.2.5) + tilt (2.0.10) + tzinfo (1.2.7) thread_safe (~> 0.1) - uglifier (4.1.17) + uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unicode-display_width (1.4.0) - web-console (3.6.2) + unicode-display_width (1.7.0) + web-console (3.7.0) actionview (>= 5.0) activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - websocket-driver (0.7.0) + websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.3) + websocket-extensions (0.1.4) PLATFORMS ruby DEPENDENCIES - autoprefixer-rails - bootstrap - byebug - factory_bot_rails - fast_stack - flamegraph - guard-rspec - jquery-rails - listen (~> 3.1.5) - memory_profiler - microformats (~> 4.0.7) - nokogiri - pg - puma - rack-mini-profiler - rails (~> 5.2.0) - rails-controller-testing - rspec-rails - rubocop - rubocop-rspec - sass-rails - simplecov - spring - spring-commands-rspec - spring-watcher-listen (~> 2.0.0) - stackprof - tzinfo-data - uglifier - web-console + autoprefixer-rails (~> 9.7) + bootstrap (~> 4.4) + byebug (~> 10.0) + factory_bot_rails (~> 5.1) + fast_stack (~> 0.2.0) + flamegraph (~> 0.9.5) + guard-rspec (~> 4.7) + jquery-rails (~> 4.3) + listen (~> 3.2) + memory_profiler (~> 0.9.14) + microformats (~> 4.2) + nokogiri (~> 1.10) + pg (~> 1.2) + puma (~> 3.12) + rack-mini-profiler (~> 2.0) + rails (~> 5.2) + rails-controller-testing (~> 1.0) + rspec-rails (~> 4.0) + rubocop (~> 0.82.0) + rubocop-rails (~> 2.5) + rubocop-rspec (~> 1.38) + sass-rails (~> 5.1) + simplecov (~> 0.18.5) + spring (~> 2.1) + spring-commands-rspec (~> 1.0) + spring-watcher-listen (~> 2.0) + stackprof (~> 0.2.15) + tzinfo-data (~> 1.2019) + uglifier (~> 4.2) + web-console (~> 3.7) RUBY VERSION ruby 2.5.1p57 diff --git a/config/environments/development.rb b/config/environments/development.rb index 5e3eb42..5187e22 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -13,7 +13,7 @@ config.consider_all_requests_local = true # Enable/disable caching. By default caching is disabled. - if Rails.root.join('tmp', 'caching-dev.txt').exist? + if Rails.root.join('tmp/caching-dev.txt').exist? config.action_controller.perform_caching = true config.cache_store = :memory_store diff --git a/spec/factories/submissions.rb b/spec/factories/submissions.rb index acfc922..21761bf 100644 --- a/spec/factories/submissions.rb +++ b/spec/factories/submissions.rb @@ -1,9 +1,9 @@ FactoryBot.define do factory :submission do - url 'MyText' - html 'MyText' - base_url 'MyText' - save_html false - render_html_in_page false + url { 'MyText' } + html { 'MyText' } + base_url { 'MyText' } + save_html { false } + render_html_in_page { false } end end