Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Rails 4 update: remove deprecation warnings, force local timezone in testing, all tests passing #385

Closed
wants to merge 6 commits into from

1 participant

@bnauta

No description provided.

@bnauta

Oops. We're currently using this on master in production: closing this pull request to open another in a feature branch.

@bnauta bnauta closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
3  .gitignore
@@ -7,4 +7,5 @@ coverage/*
doc/*
benchmarks/*
.specification
-.rvmrc
+.rvmrc
+gemfiles/*.gemfile.lock
View
2  lib/authlogic/acts_as_authentic/persistence_token.rb
@@ -36,7 +36,7 @@ def forget_all
records = nil
i = 0
begin
- records = find(:all, :limit => 50, :offset => i)
+ records = limit(50).offset(i)
records.each { |record| record.forget! }
i += 50
end while !records.blank?
View
2  lib/authlogic/authenticates_many/base.rb
@@ -42,7 +42,7 @@ def authenticates_many(name, options = {})
options[:relationship_name] ||= options[:session_class].klass_name.underscore.pluralize
class_eval <<-"end_eval", __FILE__, __LINE__
def #{name}
- find_options = #{options[:find_options].inspect} || #{options[:relationship_name]}.scoped
+ find_options = #{options[:find_options].inspect} || #{options[:relationship_name]}.where(nil)
@#{name} ||= Authlogic::AuthenticatesMany::Association.new(#{options[:session_class]}, find_options, #{options[:scope_cookies] ? "self.class.model_name.underscore + '_' + self.send(self.class.primary_key).to_s" : "nil"})
end
end_eval
View
1  lib/authlogic/test_case.rb
@@ -117,4 +117,5 @@ def controller
end
::Test::Unit::TestCase.send(:include, TestCase) if defined?(::Test::Unit::TestCase)
+ ::MiniTest::Unit::TestCase.send(:include, TestCase) if defined?(::MiniTest::Unit::TestCase)
end
View
15 test/acts_as_authentic_test/password_test.rb
@@ -111,7 +111,12 @@ def test_validates_length_of_password
u.password = "test"
assert !u.valid?
- assert u.errors[:password_confirmation].size == 0
+
+ if ActiveModel.respond_to?(:version) and ActiveModel.version.segments.first >= 4
+ assert u.errors[:password_confirmation].size == 5
+ else
+ assert u.errors[:password_confirmation].size == 0
+ end
end
def test_validates_confirmation_of_password
@@ -119,8 +124,12 @@ def test_validates_confirmation_of_password
u.password = "test"
u.password_confirmation = "test2"
assert !u.valid?
- assert u.errors[:password].size > 0
-
+# assert u.errors[:password].size > 0
+ if ActiveModel.respond_to?(:version) and ActiveModel.version.segments.first >= 4
+ assert u.errors[:password_confirmation].size > 0
+ else
+ assert u.errors[:password].size > 0
+ end
u.password_confirmation = "test"
assert !u.valid?
assert u.errors[:password].size == 0
View
2  test/test_helper.rb
@@ -5,6 +5,7 @@
require "timecop"
require "i18n"
+
I18n.load_path << File.dirname(__FILE__) + '/i18n/lol.yml'
#ActiveRecord::Schema.verbose = false
@@ -14,6 +15,7 @@
ActiveRecord::Base.logger = logger
ActiveRecord::Base.configurations = true
+ActiveRecord::Base.default_timezone = :local
ActiveRecord::Schema.define(:version => 1) do
create_table :companies do |t|
t.datetime :created_at
Something went wrong with that request. Please try again.