Skip to content

Commit

Permalink
test: add testing code for missing
Browse files Browse the repository at this point in the history
  • Loading branch information
rhiroe committed Jun 12, 2024
1 parent 61c46e3 commit f9442c1
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
7 changes: 7 additions & 0 deletions gems/activerecord/7.0/_test/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ class User < ApplicationRecord
encrypts :secret, :key
encrypts :token, deterministic: true
encrypts :phrase, ignore_case: true

has_many :posts
end

class Post < ApplicationRecord
belongs_to :user
end

User.where.missing(:posts)
User.deterministic_encrypted_attributes
User.source_attribute_from_preserved_attribute(:phrase)
user = User.new(secret: 'dummy', key: 'dummy', token: 'dummy', phrase: 'dummy')
Expand Down
25 changes: 24 additions & 1 deletion gems/activerecord/7.0/_test/test.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@ module Test
class ApplicationRecord < ActiveRecord::Base
end

class User < ActiveRecord::Base
class User < ApplicationRecord
extend ::ActiveRecord::Base::ClassMethods[User, ActiveRecord_Relation, Integer]

class ActiveRecord_Relation < ::ActiveRecord::Relation
include ::ActiveRecord::Relation::Methods[User, Integer]
include Enumerable[User]
end

class ActiveRecord_Associations_CollectionProxy < ::ActiveRecord::Associations::CollectionProxy
include ::ActiveRecord::Relation::Methods[User, Integer]
end
end

class Post < ApplicationRecord
extend ::ActiveRecord::Base::ClassMethods[Post, ActiveRecord_Relation, Integer]

class ActiveRecord_Relation < ::ActiveRecord::Relation
include ::ActiveRecord::Relation::Methods[Post, Integer]
include Enumerable[Post]
end

class ActiveRecord_Associations_CollectionProxy < ::ActiveRecord::Associations::CollectionProxy
include ::ActiveRecord::Relation::Methods[Post, Integer]
end
end
end
7 changes: 7 additions & 0 deletions gems/activerecord/7.1/_test/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,15 @@ class User < ApplicationRecord
# @type var email: String
email.strip.downcase
}

has_many :posts
end

class Post < ApplicationRecord
belongs_to :user
end

User.where.missing(:posts)
User.deterministic_encrypted_attributes
User.source_attribute_from_preserved_attribute(:phrase)
user = User.new(secret: 'dummy', key: 'dummy', token: 'dummy', phrase: 'dummy')
Expand Down
25 changes: 24 additions & 1 deletion gems/activerecord/7.1/_test/test.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@ module Test
class ApplicationRecord < ActiveRecord::Base
end

class User < ActiveRecord::Base
class User < ApplicationRecord
extend ::ActiveRecord::Base::ClassMethods[User, ActiveRecord_Relation, Integer]

class ActiveRecord_Relation < ::ActiveRecord::Relation
include ::ActiveRecord::Relation::Methods[User, Integer]
include Enumerable[User]
end

class ActiveRecord_Associations_CollectionProxy < ::ActiveRecord::Associations::CollectionProxy
include ::ActiveRecord::Relation::Methods[User, Integer]
end
end

class Post < ApplicationRecord
extend ::ActiveRecord::Base::ClassMethods[Post, ActiveRecord_Relation, Integer]

class ActiveRecord_Relation < ::ActiveRecord::Relation
include ::ActiveRecord::Relation::Methods[Post, Integer]
include Enumerable[Post]
end

class ActiveRecord_Associations_CollectionProxy < ::ActiveRecord::Associations::CollectionProxy
include ::ActiveRecord::Relation::Methods[Post, Integer]
end
end
end

0 comments on commit f9442c1

Please sign in to comment.