diff --git a/Gemfile b/Gemfile index 0e8b30c..7342654 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ ruby '2.4.1' gem 'dotenv-rails', :groups => [:development, :test] -gem 'rails', '~> 4.2.0' +gem 'rails', '~> 5.1' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' @@ -31,6 +31,7 @@ end group :test, :development do gem 'rspec-rails' + gem 'rails-controller-testing' gem 'rubocop' gem 'pry' end @@ -59,10 +60,9 @@ gem 'dragonfly-s3_data_store' gem 'kaminari' gem 'monban' gem 'monban-generators' -gem 'nokogiri', '~> 1.6.8.rc3' +gem 'nokogiri' gem 'pg' gem 'kramdown' gem 'simple_form' gem 'slugtastic' -gem 'squeel' gem 'unf' diff --git a/Gemfile.lock b/Gemfile.lock index 9bdd65e..27ff608 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,39 +1,42 @@ GEM remote: http://rubygems.org/ specs: - actionmailer (4.2.9) - actionpack (= 4.2.9) - actionview (= 4.2.9) - activejob (= 4.2.9) + actioncable (5.1.2) + actionpack (= 5.1.2) + nio4r (~> 2.0) + websocket-driver (~> 0.6.1) + actionmailer (5.1.2) + actionpack (= 5.1.2) + actionview (= 5.1.2) + activejob (= 5.1.2) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.9) - actionview (= 4.2.9) - activesupport (= 4.2.9) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.1.2) + actionview (= 5.1.2) + activesupport (= 5.1.2) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.9) - activesupport (= 4.2.9) + actionview (5.1.2) + activesupport (= 5.1.2) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.9) - activesupport (= 4.2.9) - globalid (>= 0.3.0) - activemodel (4.2.9) - activesupport (= 4.2.9) - builder (~> 3.1) - activerecord (4.2.9) - activemodel (= 4.2.9) - activesupport (= 4.2.9) - arel (~> 6.0) - activesupport (4.2.9) + activejob (5.1.2) + activesupport (= 5.1.2) + globalid (>= 0.3.6) + activemodel (5.1.2) + activesupport (= 5.1.2) + activerecord (5.1.2) + activemodel (= 5.1.2) + activesupport (= 5.1.2) + arel (~> 8.0) + activesupport (5.1.2) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.5.1) public_suffix (~> 2.0, >= 2.0.2) @@ -50,7 +53,7 @@ GEM selectize-rails (~> 0.6) administrate-field-image (1.1.0) administrate (>= 0.2.0.rc1) - arel (6.0.4) + arel (8.0.0) ast (2.3.0) autoprefixer-rails (7.1.2.3) execjs @@ -110,6 +113,7 @@ GEM dragonfly-s3_data_store (1.3.0) dragonfly (~> 1.0) fog-aws + erubi (1.6.1) erubis (2.7.0) excon (0.57.1) execjs (2.7.0) @@ -171,7 +175,7 @@ GEM mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) - mini_portile2 (2.1.0) + mini_portile2 (2.2.0) minitest (5.10.2) momentjs-rails (2.17.1) railties (>= 3.1) @@ -182,8 +186,9 @@ GEM monban-generators (1.0.0) monban (>= 0.0.12) multi_json (1.12.1) - nokogiri (1.6.8.1) - mini_portile2 (~> 2.1.0) + nio4r (2.1.0) + nokogiri (1.8.0) + mini_portile2 (~> 2.2.0) parallel (1.11.2) parser (2.4.0.0) ast (~> 2.2) @@ -192,8 +197,6 @@ GEM capybara (~> 2.1) cliver (~> 0.3.1) websocket-driver (>= 0.2.0) - polyamorous (1.1.0) - activerecord (>= 3.0) powder (0.3.2) thor (>= 0.11.5) powerpack (0.1.1) @@ -203,26 +206,28 @@ GEM slop (~> 3.4) public_suffix (2.0.5) puma (3.9.1) - rack (1.6.8) + rack (2.0.3) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.9) - actionmailer (= 4.2.9) - actionpack (= 4.2.9) - actionview (= 4.2.9) - activejob (= 4.2.9) - activemodel (= 4.2.9) - activerecord (= 4.2.9) - activesupport (= 4.2.9) + rails (5.1.2) + actioncable (= 5.1.2) + actionmailer (= 5.1.2) + actionpack (= 5.1.2) + actionview (= 5.1.2) + activejob (= 5.1.2) + activemodel (= 5.1.2) + activerecord (= 5.1.2) + activesupport (= 5.1.2) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.9) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.8) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) + railties (= 5.1.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-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) rails_12factor (0.0.3) @@ -230,9 +235,10 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (4.2.9) - actionpack (= 4.2.9) - activesupport (= 4.2.9) + railties (5.1.2) + actionpack (= 5.1.2) + activesupport (= 5.1.2) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.2.2) @@ -304,10 +310,6 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - squeel (1.2.3) - activerecord (>= 3.0) - activesupport (>= 3.0) - polyamorous (~> 1.1.0) thor (0.19.4) thread_safe (0.3.6) tilt (2.0.7) @@ -351,13 +353,14 @@ DEPENDENCIES letter_opener monban monban-generators - nokogiri (~> 1.6.8.rc3) + nokogiri pg poltergeist powder pry puma - rails (~> 4.2.0) + rails (~> 5.1) + rails-controller-testing rails_12factor rspec-rails rubocop @@ -369,7 +372,6 @@ DEPENDENCIES simple_form simplecov slugtastic - squeel uglifier unf diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 19f5642..ee002c2 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -17,13 +17,13 @@ class PhotosController < ApplicationController def for_category(category_id) @category = Category.find_by_id(category_id) - @photos = @category.photos.enabled.order { taken_at.desc } + @photos = @category.photos.enabled.order(taken_at: :desc) .page(params[:page]) @page_title = @category.name end def all - @photos = Photo.enabled.order { taken_at.desc } + @photos = Photo.enabled.order(taken_at: :desc) .page(params[:page]) @page_title = 'All Photos' end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2b6daa7..6e18b36 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,7 +10,6 @@ <%= stylesheet_link_tag 'application' %> <%= javascript_include_tag 'application' %> <%= favicon_link_tag 'favicon.ico' %> - <%= render 'shared/typekit' %> <%= csrf_meta_tags %> diff --git a/spec/controllers/contacts_controller_spec.rb b/spec/controllers/contacts_controller_spec.rb index 9fe91d0..df62a53 100644 --- a/spec/controllers/contacts_controller_spec.rb +++ b/spec/controllers/contacts_controller_spec.rb @@ -9,9 +9,11 @@ describe ContactsController, type: :controller do end let(:contact_params) do - { name: 'Dan Barber', + { + name: 'Dan Barber', email: 'danbee@gmail.com', - message: 'This is a message.' } + message: 'This is a message.', + } end describe 'POST create' do @@ -19,7 +21,7 @@ describe ContactsController, type: :controller do valid_contact = double(valid?: true) allow(Contact).to receive(:new).and_return(valid_contact) allow(Notifier).to receive(:contact_notification).and_return(double(deliver: true)) - post :create, contact: contact_params + post :create, params: { contact: contact_params } expect(Notifier).to have_received(:contact_notification).with(valid_contact) expect(flash[:notice]).to eql(I18n.t('contact.thanks')) @@ -28,7 +30,7 @@ describe ContactsController, type: :controller do it 're-renders the form if params are missing' do allow(Contact).to receive(:new).and_return(double(valid?: false)) - post :create, contact: {} + post :create, params: { contact: {} } expect(flash[:alert]).to eql(I18n.t('contact.invalid')) expect(response).to render_template(:new) end diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb index 22b7149..1d0426b 100644 --- a/spec/controllers/pages_controller_spec.rb +++ b/spec/controllers/pages_controller_spec.rb @@ -5,12 +5,12 @@ describe PagesController, type: :controller do let(:test_page) { create(:page) } it 'renders a page' do - get :show, name: test_page.name + get :show, params: { name: test_page.name } expect(response).to render_template(:show) end it 'renders 404 for a non existant page' do - get :show, name: 'not-a-page' + get :show, params: { name: 'not-a-page' } expect(response.status).to eql(404) end end diff --git a/spec/controllers/views_controller_spec.rb b/spec/controllers/views_controller_spec.rb index c0e3423..e3a6b77 100644 --- a/spec/controllers/views_controller_spec.rb +++ b/spec/controllers/views_controller_spec.rb @@ -6,12 +6,12 @@ RSpec.describe ViewsController, type: :controller do it 'logs a photo view' do expect_any_instance_of(Photo).to receive(:log_view).once - post :create, photo_id: photo.id + post :create, params: { photo_id: photo.id } expect(response).to be_successful end it 'responds with not_found if the photo is not present' do - post :create, photo_id: 999 + post :create, params: { photo_id: 999 } expect(response.status).to eql(404) end end