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

Push rails dependency to 5.2, fixing related specs #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Push rails dependency to 5.2, fixing related specs
Erik Offenbach committed Mar 24, 2020
commit ce1fd7bc79eb9fb0b9b271a95350bd9e3faa48e9
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -6,4 +6,4 @@ gem "rdoc"

group :test do
gem 'sqlite3'
end
end
189 changes: 115 additions & 74 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -2,100 +2,141 @@ PATH
remote: .
specs:
survey (0.1)
rails (>= 3.2.6, < 5)
railties (>= 3.2.6, < 5)
rails (>= 3.2.6)
railties (>= 3.2.6)

GEM
remote: https://rubygems.org/
specs:
actionmailer (4.0.2)
actionpack (= 4.0.2)
mail (~> 2.5.4)
actionpack (4.0.2)
activesupport (= 4.0.2)
builder (~> 3.1.0)
erubis (~> 2.7.0)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
activemodel (4.0.2)
activesupport (= 4.0.2)
builder (~> 3.1.0)
activerecord (4.0.2)
activemodel (= 4.0.2)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.2)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.2)
i18n (~> 0.6, >= 0.6.4)
minitest (~> 4.2)
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
arel (4.0.1)
atomic (1.1.14)
builder (3.1.4)
erubis (2.7.0)
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 (~> 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 (5.2.4.1)
activesupport (= 5.2.4.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
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)
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)
tzinfo (~> 1.1)
arel (9.0.0)
builder (3.2.4)
byebug (11.0.1)
concurrent-ruby (1.1.6)
crass (1.0.6)
erubi (1.9.0)
faker (1.1.2)
i18n (~> 0.5)
hike (1.2.3)
i18n (0.6.9)
json (1.7.6)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
json (1.8.6)
loofah (2.4.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
metaclass (0.0.1)
mime-types (1.25.1)
minitest (4.7.5)
method_source (0.9.2)
mimemagic (0.3.4)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.0)
mocha (0.13.2)
metaclass (~> 0.0.1)
multi_json (1.8.2)
polyglot (0.3.3)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.0.2)
actionmailer (= 4.0.2)
actionpack (= 4.0.2)
activerecord (= 4.0.2)
activesupport (= 4.0.2)
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.2)
sprockets-rails (~> 2.0.0)
railties (4.0.2)
actionpack (= 4.0.2)
activesupport (= 4.0.2)
nio4r (2.5.2)
nokogiri (1.10.9)
mini_portile2 (~> 2.4.0)
rack (2.2.2)
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-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)
rake (10.0.3)
thor (>= 0.19.0, < 2.0)
rake (13.0.1)
rdoc (3.12)
json (~> 1.4)
sprockets (2.10.1)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.0.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
sqlite3 (1.3.7)
thor (0.18.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.38)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.4.2)
thor (1.0.1)
thread_safe (0.3.6)
tzinfo (1.2.6)
thread_safe (~> 0.1)
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)

PLATFORMS
ruby

DEPENDENCIES
byebug
faker
mocha
rake
rdoc
sqlite3
survey!

BUNDLED WITH
2.1.2
2 changes: 1 addition & 1 deletion app/models/survey/attempt.rb
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ class Survey::Attempt < ActiveRecord::Base
scope :for_survey, ->(survey) { where(:survey_id => survey.id) }
scope :exclude_survey, ->(survey) { where("NOT survey_id = #{survey.id}") }
scope :for_participant, ->(participant) {
where(:participant_id => participant.try(:id), :participant_type => participant.class.base_class)
where(:participant_id => participant.try(:id), :participant_type => participant.class.base_class.name)
}

# callbacks
10 changes: 5 additions & 5 deletions lib/survey.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module ::Kernel
def rails4?
return defined?(Rails) && Rails::VERSION::MAJOR == 4
def rails_less_than_4?
return defined?(Rails) && Rails::VERSION::MAJOR < 4
end

def in_rails_3(&block)
yield if block_given? unless rails4?
yield if block_given? if rails_less_than_4?
end
end

require 'survey/engine'
require 'survey/version'
require 'survey/active_record'

ActiveRecord::Base.send(:include, Survey::ActiveRecord)
ActiveRecord::Base.send(:include, Survey::ActiveRecord)
6 changes: 4 additions & 2 deletions lib/survey/active_record.rb
Original file line number Diff line number Diff line change
@@ -4,7 +4,9 @@ module ActiveRecord

module ClassMethods
def has_surveys
has_many :survey_tentatives, as: :participant, :class_name => ::Survey::Attempt
has_many :survey_tentatives,
as: :participant,
:class_name => ::Survey::Attempt.name

define_method("for_survey") do |survey|
self.survey_tentatives.where(:survey_id => survey.id)
@@ -25,4 +27,4 @@ def acceptable_attributes(*args)
end
end
end
end
end
4 changes: 2 additions & 2 deletions survey.gemspec
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ Gem::Specification.new do |s|
s.authors = %Q{Runtime Revolution}
s.require_paths = %w(lib)

s.add_dependency("rails", [">= 3.2.6", "< 5"])
s.add_dependency("railties", ">= 3.2.6", "< 5")
s.add_dependency("rails", [">= 3.2.6"])
s.add_dependency("railties", ">= 3.2.6")
s.add_development_dependency("mocha")
s.add_development_dependency("faker")
s.add_development_dependency("rake")
2 changes: 1 addition & 1 deletion test/dummy/db/migrate/20130123110019_create_users.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateUsers < ActiveRecord::Migration
class CreateUsers < ActiveRecord::Migration[4.2]
def change
create_table :users do |t|
t.string :name
2 changes: 1 addition & 1 deletion test/dummy/db/migrate/20130201105206_create_survey.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateSurvey < ActiveRecord::Migration
class CreateSurvey < ActiveRecord::Migration[4.2]
def self.up

# survey surveys logic
6 changes: 5 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -9,7 +9,11 @@
Rails.backtrace_cleaner.remove_silencers!

# Run any available migration
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
if Rails.gem_version >= Gem::Version.new('5.2.0')
ActiveRecord::MigrationContext.new(File.expand_path('../dummy/db/migrate', __FILE__)).migrate
else
ActiveRecord::Migrator.migrate(File.expand_path('../dummy/db/migrate', __FILE__))
end

# Load support files
# Add support to load paths so we can overwrite broken webrat setup