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

Remove rails 6 deprecations #624

Closed
wants to merge 2 commits into from
Closed
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
29 changes: 20 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,41 @@ language: ruby
sudo: false
cache: bundler
rvm:
- 2.4.1
- 2.3.3
- 2.2.7
- 2.3.3
- 2.4.1
- 2.5.7
- 2.6.5

env: "RAILS_ENV=test DISPLAY=:99.0"
gemfile:
- gemfiles/rails_3.2.gemfile
- gemfiles/rails_4.0.gemfile
- gemfiles/rails_4.1.gemfile
- gemfiles/rails_4.2.gemfile
- gemfiles/rails_5.0.gemfile
- gemfiles/rails_5.1.gemfile
- gemfiles/rails_5.2.gemfile
- gemfiles/rails_6.0.gemfile
- gemfiles/rails_edge.gemfile

matrix:
allow_failures:
- gemfile: gemfiles/rails_edge.gemfile
exclude:
- rvm: 2.2.7
gemfile: gemfiles/rails_5.2.gemfile
- rvm: 2.2.7
gemfile: gemfiles/rails_6.0.gemfile
- rvm: 2.2.7
gemfile: gemfiles/rails_edge.gemfile
- rvm: 2.3.3
gemfile: gemfiles/rails_5.2.gemfile
- rvm: 2.3.3
gemfile: gemfiles/rails_6.0.gemfile
- rvm: 2.3.3
gemfile: gemfiles/rails_edge.gemfile
- rvm: 2.4.1
gemfile: gemfiles/rails_3.2.gemfile
- rvm: 2.4.1
gemfile: gemfiles/rails_4.0.gemfile
gemfile: gemfiles/rails_6.0.gemfile
- rvm: 2.4.1
gemfile: gemfiles/rails_4.1.gemfile
gemfile: gemfiles/rails_edge.gemfile

before_install:
- mkdir travis-phantomjs
Expand Down
39 changes: 20 additions & 19 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
appraise "rails-3.2" do
gem 'rails', github: "rails/rails", branch: '3-2-stable'
gem 'strong_parameters'
gem 'test-unit'
appraise 'rails-4.2' do
gem 'bundler', '~> 1.3'
gem 'rails', github: 'rails/rails', branch: '4-2-stable'
gem 'rspec-rails', '~> 3'
gem 'sqlite3', '~> 1.3.6'
end

appraise "rails-4.0" do
gem "rails", github: "rails/rails", branch: '4-0-stable'
gem 'test-unit'
appraise 'rails-5.0' do
gem 'rails', github: 'rails/rails', branch: '5-0-stable'
gem 'sqlite3', '~> 1.3.6'
end

appraise "rails-4.1" do
gem "rails", github: "rails/rails", branch: '4-1-stable'
appraise 'rails-5.1' do
gem 'rails', github: 'rails/rails', branch: '5-1-stable'
gem 'sqlite3'
end

appraise "rails-4.2" do
gem "rails", github: "rails/rails", branch: '4-2-stable'
appraise 'rails-5.2' do
gem 'rails', github: 'rails/rails', branch: '5-2-stable'
gem 'sqlite3'
end

appraise "rails-5.0" do
gem "rails", github: "rails/rails", branch: '5-0-stable'
appraise 'rails-6.0' do
gem 'rails', github: 'rails/rails', branch: '6-0-stable'
gem 'sqlite3'
end

appraise "rails-5.1" do
gem "rails", github: "rails/rails", branch: '5-1-stable'
end

appraise "rails-edge" do
gem "rails", github: "rails/rails"
appraise 'rails-edge' do
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
end
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ gem 'combustion'
gem 'sprockets-rails'
gem 'capybara'
gem 'poltergeist'
gem 'sqlite3'
gem 'appraisal'
gem 'launchy'
gem 'webrick'

platforms :mri_21 do
gem 'byebug'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def update
@user = User.find params[:id]

respond_to do |format|
if @user.update_attributes(params[:user])
if @user.update(params[:user])
format.html { redirect_to(@user, :notice => 'User was successfully updated.') }
format.json { respond_with_bip(@user) }
else
Expand Down
27 changes: 0 additions & 27 deletions gemfiles/rails_3.2.gemfile

This file was deleted.

6 changes: 4 additions & 2 deletions gemfiles/rails_4.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ gem "activerecord"
gem "rails-assets-jquery", "1.11.1"
gem "rails-assets-jquery-ui", "1.10.4"
gem "rdiscount"
gem "rspec-rails"
gem "rspec-rails", "~> 3"
gem "nokogiri"
gem "combustion"
gem "sprockets-rails"
gem "capybara"
gem "poltergeist"
gem "sqlite3"
gem "appraisal"
gem "launchy"
gem "webrick"
gem "bundler", "~> 1.3"
gem "rails", github: "rails/rails", branch: "4-2-stable"
gem "sqlite3", "~> 1.3.6"

platforms :mri_21 do
gem "byebug"
Expand Down
3 changes: 2 additions & 1 deletion gemfiles/rails_5.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ gem "combustion"
gem "sprockets-rails"
gem "capybara"
gem "poltergeist"
gem "sqlite3"
gem "appraisal"
gem "launchy"
gem "webrick"
gem "rails", github: "rails/rails", branch: "5-0-stable"
gem "sqlite3", "~> 1.3.6"

platforms :mri_21 do
gem "byebug"
Expand Down
3 changes: 2 additions & 1 deletion gemfiles/rails_5.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ gem "combustion"
gem "sprockets-rails"
gem "capybara"
gem "poltergeist"
gem "sqlite3"
gem "appraisal"
gem "launchy"
gem "webrick"
gem "rails", github: "rails/rails", branch: "5-1-stable"
gem "sqlite3"

platforms :mri_21 do
gem "byebug"
Expand Down
5 changes: 3 additions & 2 deletions gemfiles/rails_4.1.gemfile → gemfiles/rails_5.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ gem "combustion"
gem "sprockets-rails"
gem "capybara"
gem "poltergeist"
gem "sqlite3"
gem "appraisal"
gem "launchy"
gem "rails", github: "rails/rails", branch: "4-1-stable"
gem "webrick"
gem "rails", github: "rails/rails", branch: "5-2-stable"
gem "sqlite3"

platforms :mri_21 do
gem "byebug"
Expand Down
6 changes: 3 additions & 3 deletions gemfiles/rails_4.0.gemfile → gemfiles/rails_6.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ gem "combustion"
gem "sprockets-rails"
gem "capybara"
gem "poltergeist"
gem "sqlite3"
gem "appraisal"
gem "launchy"
gem "rails", github: "rails/rails", branch: "4-0-stable"
gem "test-unit"
gem "webrick"
gem "rails", github: "rails/rails", branch: "6-0-stable"
gem "sqlite3"

platforms :mri_21 do
gem "byebug"
Expand Down
3 changes: 2 additions & 1 deletion gemfiles/rails_edge.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ gem "combustion"
gem "sprockets-rails"
gem "capybara"
gem "poltergeist"
gem "sqlite3"
gem "appraisal"
gem "launchy"
gem "webrick"
gem "rails", github: "rails/rails"
gem "arel", github: "rails/arel"
gem "sqlite3"

platforms :mri_21 do
gem "byebug"
Expand Down
7 changes: 5 additions & 2 deletions lib/best_in_place/engine.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
module BestInPlace
class Engine < Rails::Engine
initializer 'best_in_place' do
ActionView::Base.send(:include, BestInPlace::Helper)
ActionController::Base.send(:include, BestInPlace::ControllerExtensions)
ActiveSupport.on_load(:action_controller) do
ActionView::Base.send(:include, BestInPlace::Helper)

ActionController::Base.send(:include, BestInPlace::ControllerExtensions)
end
end
end
end
2 changes: 1 addition & 1 deletion lib/best_in_place/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module BestInPlace
class Railtie < ::Rails::Railtie #:nodoc:
config.after_initialize do
BestInPlace::ViewHelpers = ActionView::Base.new
BestInPlace::ViewHelpers = ActionView::Base.respond_to?(:empty) ? ActionView::Base.empty : ActionView::Base.new
end
end
end
16 changes: 12 additions & 4 deletions lib/best_in_place/test_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module TestHelpers

def bip_area(model, attr, new_value)
id = BestInPlace::Utils.build_best_in_place_id model, attr
find("##{id}").click
click_bip_input(id)
execute_script <<-JS
$("##{id} form textarea").val('#{escape_javascript new_value.to_s}');
$("##{id} form textarea").blur();
Expand All @@ -14,7 +14,7 @@ def bip_area(model, attr, new_value)

def bip_text(model, attr, new_value)
id = BestInPlace::Utils.build_best_in_place_id model, attr
find("##{id}").click
click_bip_input(id)
execute_script <<-JS
$("##{id} input[name='#{attr}']").val('#{escape_javascript new_value.to_s}');
$("##{id} form").submit();
Expand All @@ -24,17 +24,25 @@ def bip_text(model, attr, new_value)

def bip_bool(model, attr)
id = BestInPlace::Utils.build_best_in_place_id model, attr
find("##{id}").click
click_bip_input(id)
wait_for_ajax
end

def bip_select(model, attr, name)
id = BestInPlace::Utils.build_best_in_place_id model, attr
find("##{id}").click
click_bip_input(id)
find("##{id}").select(name)
wait_for_ajax
end

def click_bip_input(id)
if Capybara.current_driver == :poltergeist
find("##{id}").trigger('click')
else
find("##{id}").click
end
end

def wait_for_ajax
return unless respond_to?(:evaluate_script)
wait_until { finished_all_ajax_requests? }
Expand Down
3 changes: 3 additions & 0 deletions spec/internal/app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def create

def update
@test_result = TestResult.find(params[:id])
@test_result.update_attributes(test_result_params)
@test_result.update(test_result_params)
respond_to do |format|
format.json { respond_with_bip(@test_result) }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/internal/app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def show
def update
@user = User.find(params[:id])
respond_to do |format|
@user.update_attributes(user_params)
@user.update(user_params)
format.json { respond_with_bip(@user, param: :admin) }
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/internal/app/controllers/cuca/cars_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def update
@car = Car.find params[:id]

respond_to do |format|
@car.update_attributes params[:cuca_car]
@car.update params[:cuca_car]
format.json { respond_with_bip(@car) }
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/internal/app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def update
@user = User.find(params[:id])

respond_to do |format|
if @user.update_attributes(user_params)
if @user.update(user_params)
format.html { redirect_to(@user, :notice => 'User was successfully updated.') }
format.json { respond_with_bip(@user) }
else
Expand Down
1 change: 1 addition & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Capybara::Poltergeist::Driver.new(app, {js_errors: false, inspector: true})
end
Capybara.javascript_driver = :poltergeist
Capybara.server = :webrick

require 'best_in_place'

Expand Down