Skip to content

Instantly share code, notes, and snippets.

@jaredbeck
Created May 13, 2020 18:19
Show Gist options
  • Save jaredbeck/572f62ed13ced7e193e99895973df27a to your computer and use it in GitHub Desktop.
Save jaredbeck/572f62ed13ced7e193e99895973df27a to your computer and use it in GitHub Desktop.
Testing Authlogic PR 717
require 'bundler/setup'
require 'minitest'
require 'minitest/autorun'
# AR 6.0.2.2
module AR6022
def save(*args, &block)
{ args: args }
end
end
# AR 6.0.3
module AR603
def save(*args, **options, &block)
{ args: args, options: options }
end
end
module AuthlogicBefore
def save_without_session_maintenance(*args)
save(*args)
end
end
module AuthlogicAfter
def save_without_session_maintenance(**options)
save(**options)
end
end
# Before
# ----------------------------
class Test1 < Minitest::Test
include AR6022
include AuthlogicBefore
def test_this_combination
assert_equal(
{ args: [{ validate: false }] },
save_without_session_maintenance(validate: false)
)
end
end
class Test2 < Minitest::Test
include AR603
include AuthlogicBefore
def test_this_combination
assert_equal(
{ args: [], options: { validate: false } },
save_without_session_maintenance(validate: false)
)
end
end
# After
# ----------------------------
class Test3 < Minitest::Test
include AR6022
include AuthlogicAfter
def test_this_combination
assert_equal(
{ args: [{ validate: false }] },
save_without_session_maintenance(validate: false)
)
end
end
class Test4 < Minitest::Test
include AR603
include AuthlogicAfter
def test_this_combination
assert_equal(
{ args: [], options: { validate: false } },
save_without_session_maintenance(validate: false)
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment