Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 5.1 & passing tests #62

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ jobs:
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- uses: actions/cache@v1
with:
path: MYR_rails/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Build and test with Rake
run: |
cd MYR_rails
Expand Down
11 changes: 8 additions & 3 deletions MYR_rails/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.2.0'
gem 'rails', '~> 5.1'

# Use sqlite3 as the database for Active Record
gem 'sqlite3'
Expand All @@ -16,15 +16,16 @@ gem 'bootstrap-sass', '~> 3.4.1'
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
gem 'coffee-rails'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Allow to use cookie in jquery
gem 'jquery-cookie-rails'
# 2.0 dropped jQuery interface: https://github.com/js-cookie/js-cookie/pull/5
gem 'js_cookie_rails', '~> 1.0'
# jQuery plugin for drop-in fix binded events problem caused by Turbolinks
#gem 'jquery-turbolinks'

Expand Down Expand Up @@ -69,10 +70,14 @@ group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
gem 'rails-controller-testing'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Useful for inserting a lot of coordinates into the DB efficiently
gem 'activerecord-import'

# Speed ups with caching
gem 'bootsnap', require: false
173 changes: 98 additions & 75 deletions MYR_rails/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,77 +1,86 @@
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.10)
actionpack (= 4.2.10)
actionview (= 4.2.10)
activejob (= 4.2.10)
actioncable (5.2.4.1)
actionpack (= 5.2.4.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.4.1)
actionpack (= 5.2.4.1)
actionview (= 5.2.4.1)
activejob (= 5.2.4.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.10)
actionview (= 4.2.10)
activesupport (= 4.2.10)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-dom-testing (~> 2.0)
actionpack (5.2.4.1)
actionview (= 5.2.4.1)
activesupport (= 5.2.4.1)
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 (4.2.10)
activesupport (= 4.2.10)
actionview (5.2.4.1)
activesupport (= 5.2.4.1)
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.10)
activesupport (= 4.2.10)
globalid (>= 0.3.0)
activemodel (4.2.10)
activesupport (= 4.2.10)
builder (~> 3.1)
activerecord (4.2.10)
activemodel (= 4.2.10)
activesupport (= 4.2.10)
arel (~> 6.0)
activejob (5.2.4.1)
activesupport (= 5.2.4.1)
globalid (>= 0.3.6)
activemodel (5.2.4.1)
activesupport (= 5.2.4.1)
activerecord (5.2.4.1)
activemodel (= 5.2.4.1)
activesupport (= 5.2.4.1)
arel (>= 9.0)
activerecord-import (0.25.0)
activerecord (>= 3.2)
activesupport (4.2.10)
i18n (~> 0.7)
activestorage (5.2.4.1)
actionpack (= 5.2.4.1)
activerecord (= 5.2.4.1)
marcel (~> 0.3.1)
activesupport (5.2.4.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
ansi (1.5.0)
arel (6.0.4)
arel (9.0.0)
autoprefixer-rails (9.7.0)
execjs
awesome_print (1.8.0)
bcrypt (3.1.12)
bootsnap (1.4.6)
msgpack (~> 1.0)
bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
builder (3.2.3)
builder (3.2.4)
carrierwave (1.2.2)
activemodel (>= 4.0.0)
activesupport (>= 4.0.0)
mime-types (>= 1.16)
coderay (1.1.2)
coffee-rails (4.1.1)
coffee-rails (5.0.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
railties (>= 5.2.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.5)
crass (1.0.5)
concurrent-ruby (1.1.6)
crass (1.0.6)
daemons (1.2.6)
erubis (2.7.0)
erubi (1.9.0)
eventmachine (1.2.5)
execjs (2.7.0)
faker (1.4.2)
i18n (~> 0.5)
ffi (1.11.1)
formatador (0.2.5)
globalid (0.4.1)
globalid (0.4.2)
activesupport (>= 4.2.0)
guard (2.14.2)
formatador (>= 0.2.4)
Expand All @@ -90,12 +99,12 @@ GEM
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jquery-cookie-rails (1.3.1.1)
railties (>= 3.2.0, < 5.0)
jquery-rails (4.3.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
js_cookie_rails (1.0.1)
railties (>= 3.1)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.6.0)
Expand All @@ -104,30 +113,35 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.3.1)
loofah (2.4.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.0.12)
mail (2.7.0)
mail (2.7.1)
mini_mime (>= 0.1.1)
method_source (0.9.0)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mimemagic (0.3.4)
mini_backtrace (0.1.3)
minitest (> 1.2.0)
rails (>= 2.3.3)
mini_magick (4.9.4)
mini_mime (1.0.0)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.11.3)
minitest (5.14.0)
minitest-reporters (1.0.5)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
msgpack (1.3.3)
multi_json (1.13.1)
nenv (0.3.0)
nio4r (2.5.2)
nokogiri (1.10.8)
mini_portile2 (~> 2.4.0)
notiffany (0.1.1)
Expand All @@ -137,35 +151,39 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (3.0.2)
rack (1.6.12)
rack (2.2.2)
rack-ssl (1.4.1)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.10)
actionmailer (= 4.2.10)
actionpack (= 4.2.10)
actionview (= 4.2.10)
activejob (= 4.2.10)
activemodel (= 4.2.10)
activerecord (= 4.2.10)
activesupport (= 4.2.10)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.10)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.9)
activesupport (>= 4.2.0, < 5.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (4.2.10)
actionpack (= 4.2.10)
activesupport (= 4.2.10)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.4.1)
actioncable (= 5.2.4.1)
actionmailer (= 5.2.4.1)
actionpack (= 5.2.4.1)
actionview (= 5.2.4.1)
activejob (= 5.2.4.1)
activemodel (= 5.2.4.1)
activerecord (= 5.2.4.1)
activestorage (= 5.2.4.1)
activesupport (= 5.2.4.1)
bundler (>= 1.3.0)
railties (= 5.2.4.1)
sprockets-rails (>= 2.0.0)
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.3.0)
loofah (~> 2.3)
railties (5.2.4.1)
actionpack (= 5.2.4.1)
activesupport (= 5.2.4.1)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
thor (>= 0.19.0, < 2.0)
rake (13.0.1)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
Expand Down Expand Up @@ -196,16 +214,19 @@ GEM
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thor (0.20.0)
thor (1.0.1)
thread_safe (0.3.6)
tilt (2.0.8)
turbolinks (5.1.0)
turbolinks-source (~> 5.1)
turbolinks-source (5.1.0)
tzinfo (1.2.5)
tzinfo (1.2.6)
thread_safe (~> 0.1)
uglifier (4.1.8)
execjs (>= 0.3.0, < 3)
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)

PLATFORMS
ruby
Expand All @@ -214,21 +235,23 @@ DEPENDENCIES
activerecord-import
awesome_print
bcrypt (~> 3.1.7)
bootsnap
bootstrap-sass (~> 3.4.1)
carrierwave
coffee-rails (~> 4.1.0)
coffee-rails
faker (= 1.4.2)
guard-minitest (= 2.3.1)
jbuilder (~> 2.0)
jquery-cookie-rails
jquery-rails
js_cookie_rails (~> 1.0)
letter_opener
mini_backtrace (= 0.1.3)
mini_magick
minitest-reporters (= 1.0.5)
pry
rack-ssl (~> 1.4.1)
rails (~> 4.2.0)
rails (~> 5.1)
rails-controller-testing
sass (~> 3.4.16)
sass-rails (~> 5.0)
simple_captcha2
Expand All @@ -239,4 +262,4 @@ DEPENDENCIES
uglifier (>= 1.3.0)

BUNDLED WITH
1.16.4
2.1.4
3 changes: 1 addition & 2 deletions MYR_rails/app/assets/javascripts/application.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
// about supported directives.
//
//= require jquery
//= require jquery.cookie
//= require js.cookie
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this probably does not matter, but should this have changed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is necessary with the change from the jquery-cookie-rails gem, which seemed to be incompatible with newer versions of rails, to the newer js_cookie_rails gem. But I don't have a good idea how all these bits fit together, so let me know if I'm wrong about that!

(And thanks for looking at this)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take a look at the rest of the code to the best that I can in an hour or so 👍

//= require jquery_ujs
//= turbolinks
//= require config

6 changes: 3 additions & 3 deletions MYR_rails/app/controllers/coordinates_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CoordinatesController < ApplicationController
before_action :set_coordinate, only: [:show, :edit, :update, :destroy]
before_filter :authenticateA, only: [:edit, :update, :destroy]
before_action :authenticateA, only: [:edit, :update, :destroy]

include RealTimeHelper

Expand Down Expand Up @@ -162,10 +162,10 @@ def create
respond_to do |format|
if new_coords.length == 1
format.html { redirect_to new_coords[0], notice: 'Coordinate was successfully created.' }
format.json { render :show, status: :created, location: new_coords }
format.json { render json: new_coords, status: :created}
elsif new_coords.length > 0
format.html { redirect_to "/coordinates", notice: 'Coordinates were successfully created.' }
format.json { render :show, status: :created, location: new_coords }
format.json { render json: new_coords, status: :created}
else
format.html { render :new }
format.json { render json: @coordinate.errors, status: :unprocessable_entity }
Expand Down
Loading