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 4 update: remove deprecation warnings, force local timezone in testing, all tests passing #385

Closed
wants to merge 6 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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ coverage/*
doc/*
benchmarks/*
.specification
.rvmrc
.rvmrc
gemfiles/*.gemfile.lock
2 changes: 1 addition & 1 deletion lib/authlogic/acts_as_authentic/persistence_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion lib/authlogic/authenticates_many/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/authlogic/test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 12 additions & 3 deletions test/acts_as_authentic_test/password_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,25 @@ 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
u = User.new
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
Expand Down
2 changes: 2 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require "timecop"
require "i18n"


I18n.load_path << File.dirname(__FILE__) + '/i18n/lol.yml'

#ActiveRecord::Schema.verbose = false
Expand All @@ -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
Expand Down