mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix test
This commit is contained in:
parent
7945d4fde3
commit
c0fa9428e5
2 changed files with 10 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "cases/encryption/helper"
|
require "cases/encryption/helper"
|
||||||
require "models/book_encrypted"
|
require "models/pirate"
|
||||||
|
|
||||||
class ActiveRecord::Encryption::ConfigurableTest < ActiveRecord::TestCase
|
class ActiveRecord::Encryption::ConfigurableTest < ActiveRecord::TestCase
|
||||||
test "can access context properties with top level getters" do
|
test "can access context properties with top level getters" do
|
||||||
|
@ -15,9 +15,8 @@ class ActiveRecord::Encryption::ConfigurableTest < ActiveRecord::TestCase
|
||||||
@attribute_name = declared_attribute_name
|
@attribute_name = declared_attribute_name
|
||||||
end
|
end
|
||||||
|
|
||||||
klass = Class.new(EncryptedBook) do
|
klass = Class.new(Book) do
|
||||||
self.table_name = "books"
|
encrypts :isbn
|
||||||
encrypt_attribute :isbn
|
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal klass, @klass
|
assert_equal klass, @klass
|
||||||
|
@ -28,11 +27,11 @@ class ActiveRecord::Encryption::ConfigurableTest < ActiveRecord::TestCase
|
||||||
application = OpenStruct.new(config: OpenStruct.new(filter_parameters: []))
|
application = OpenStruct.new(config: OpenStruct.new(filter_parameters: []))
|
||||||
ActiveRecord::Encryption.install_auto_filtered_parameters(application)
|
ActiveRecord::Encryption.install_auto_filtered_parameters(application)
|
||||||
|
|
||||||
Class.new(EncryptedBook) do
|
Class.new(Pirate) do
|
||||||
self.table_name = "books"
|
self.table_name = "pirates"
|
||||||
encrypt_attribute :isbn
|
encrypts :catchphrase
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_includes application.config.filter_parameters, :isbn
|
assert_includes application.config.filter_parameters, :catchphrase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,19 +2,19 @@
|
||||||
|
|
||||||
require "models/book"
|
require "models/book"
|
||||||
|
|
||||||
class EncryptedBook < Book
|
class EncryptedBook < ActiveRecord::Base
|
||||||
self.table_name = "books"
|
self.table_name = "books"
|
||||||
|
|
||||||
encrypts :name, deterministic: true
|
encrypts :name, deterministic: true
|
||||||
end
|
end
|
||||||
|
|
||||||
class EncryptedBookWithDowncaseName < Book
|
class EncryptedBookWithDowncaseName < ActiveRecord::Base
|
||||||
self.table_name = "books"
|
self.table_name = "books"
|
||||||
|
|
||||||
encrypts :name, deterministic: true, downcase: true
|
encrypts :name, deterministic: true, downcase: true
|
||||||
end
|
end
|
||||||
|
|
||||||
class EncryptedBookThatIgnoresCase < Book
|
class EncryptedBookThatIgnoresCase < ActiveRecord::Base
|
||||||
self.table_name = "books"
|
self.table_name = "books"
|
||||||
|
|
||||||
encrypts :name, deterministic: true, ignore_case: true
|
encrypts :name, deterministic: true, ignore_case: true
|
||||||
|
|
Loading…
Reference in a new issue