repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20170217050010_create_exception_track_logs.rb
db/migrate/20170217050010_create_exception_track_logs.rb
# This migration comes from exception_track (originally 20170217023900) class CreateExceptionTrackLogs < ActiveRecord::Migration[5.0] def change create_table :exception_tracks do |t| t.string :title t.text :body t.timestamps end drop_table :exception_logs end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20231003022421_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb
db/migrate/20231003022421_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb
# This migration comes from active_storage (originally 20211119233751) class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0] def change return unless table_exists?(:active_storage_blobs) change_column_null(:active_storage_blobs, :checksum, true) end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20200721020514_create_profiles.rb
db/migrate/20200721020514_create_profiles.rb
class CreateProfiles < ActiveRecord::Migration[6.0] def change create_table :profiles do |t| t.integer :user_id, null: false t.jsonb :contacts, null: false, default: {} t.jsonb :rewards, null: false, default: {} end add_index :profiles, :user_id, unique: true end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20250630092055_add_confirmable_to_devise.rb
db/migrate/20250630092055_add_confirmable_to_devise.rb
class AddConfirmableToDevise < ActiveRecord::Migration[8.0] def up add_column :users, :confirmation_token, :string add_column :users, :confirmed_at, :datetime add_column :users, :confirmation_sent_at, :datetime # add_column :users, :unconfirmed_email, :string # Only if using reconfirmable ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20180316130855_rename_notifications_table_name.rb
db/migrate/20180316130855_rename_notifications_table_name.rb
class RenameNotificationsTableName < ActiveRecord::Migration[5.2] def change # Revert Notification table name to "notifications" rename_table :new_notifications, :notifications end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20160119135131_update_user_name_allow_null.rb
db/migrate/20160119135131_update_user_name_allow_null.rb
class UpdateUserNameAllowNull < ActiveRecord::Migration[4.2] def change change_column :users, :name, :string, null: true end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20231003022419_add_service_name_to_active_storage_blobs.active_storage.rb
db/migrate/20231003022419_add_service_name_to_active_storage_blobs.active_storage.rb
# This migration comes from active_storage (originally 20190112182829) class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] def up return unless table_exists?(:active_storage_blobs) unless column_exists?(:active_storage_blobs, :service_name) add_column :active_storage_blobs, :service...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20170224074052_remove_bad_fields_from_users.rb
db/migrate/20170224074052_remove_bad_fields_from_users.rb
class RemoveBadFieldsFromUsers < ActiveRecord::Migration[5.0] def change remove_column :users, :co remove_column :users, :qq end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20170204090209_create_actions.rb
db/migrate/20170204090209_create_actions.rb
# This migration comes from action_store (originally 20170204035500) class CreateActions < ActiveRecord::Migration[5.0] def change create_table :actions do |t| t.string :action_type, null: false t.string :action_option t.string :target_type t.integer :target_id t.string :user_type ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20201224095900_remove_section.rb
db/migrate/20201224095900_remove_section.rb
class RemoveSection < ActiveRecord::Migration[6.1] def change drop_table :sections remove_column :nodes, :section_id end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20160329091441_remove_old_notifications.rb
db/migrate/20160329091441_remove_old_notifications.rb
class RemoveOldNotifications < ActiveRecord::Migration[5.0] def change drop_table :notifications end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20161230094832_add_text_pattern_opts_to_users.rb
db/migrate/20161230094832_add_text_pattern_opts_to_users.rb
class AddTextPatternOptsToUsers < ActiveRecord::Migration[5.0] def change # UPDATE users SET name = substring(name, 99) WHERE length(name) >= 100 change_column :users, :login, :string, limit: 100 change_column :users, :name, :string, limit: 100 add_index :users, "lower(login) varchar_pattern_ops" ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20180316113342_add_last_reply_id_index_to_topics.rb
db/migrate/20180316113342_add_last_reply_id_index_to_topics.rb
class AddLastReplyIdIndexToTopics < ActiveRecord::Migration[5.2] def change add_index :topics, :last_reply_id end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20180912075805_add_confidential_to_applications.rb
db/migrate/20180912075805_add_confidential_to_applications.rb
class AddConfidentialToApplications < ActiveRecord::Migration[5.2] def change add_column( :oauth_applications, :confidential, :boolean, null: false, default: true ) end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20201016074728_add_preferences_to_profiles.rb
db/migrate/20201016074728_add_preferences_to_profiles.rb
class AddPreferencesToProfiles < ActiveRecord::Migration[6.0] def change add_column :profiles, :preferences, :jsonb, default: {}, null: false end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20160819093756_add_lockable_to_devise.rb
db/migrate/20160819093756_add_lockable_to_devise.rb
class AddLockableToDevise < ActiveRecord::Migration[5.0] def change add_column :users, :failed_attempts, :integer, default: 0, null: false # Only if lock strategy is :failed_attempts add_column :users, :unlock_token, :string # Only if unlock strategy is :email or :both add_column :users, :locked_at, :date...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20180614093642_change_topics_excellent_to_grade.rb
db/migrate/20180614093642_change_topics_excellent_to_grade.rb
class ChangeTopicsExcellentToGrade < ActiveRecord::Migration[5.2] def up rename_column :topics, :excellent, :grade # 61 is old nopoint node Topic.connection.execute("update topics set grade = -1 where node_id = 61") end def down rename_column :topics, :grade, :excellent end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20161228064225_remove_unneeded_indexes.rb
db/migrate/20161228064225_remove_unneeded_indexes.rb
class RemoveUnneededIndexes < ActiveRecord::Migration[5.0] def change remove_index :devices, name: "index_devices_on_user_id_and_platform" remove_index :page_versions, name: "index_page_versions_on_page_id_and_version" remove_index :replies, name: "index_replies_on_topic_id_and_deleted_at" remove_inde...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20160710111853_add_team_id_to_topics.rb
db/migrate/20160710111853_add_team_id_to_topics.rb
class AddTeamIdToTopics < ActiveRecord::Migration[5.0] def change add_column :topics, :team_id, :integer add_index :topics, :team_id end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20160219075601_create_devices.rb
db/migrate/20160219075601_create_devices.rb
class CreateDevices < ActiveRecord::Migration[5.0] def change create_table :devices do |t| t.integer :platform, null: false t.integer :user_id, null: false t.string :token, null: false t.datetime :last_actived_at t.timestamps end add_index :devices, :user_id add_index :...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20210409032709_upgrade_profile_fields_into_store.rb
db/migrate/20210409032709_upgrade_profile_fields_into_store.rb
class UpgradeProfileFieldsIntoStore < ActiveRecord::Migration[6.1] def up coder = ActiveRecord::Coders::YAMLColumn.new(:foo, Object) records = execute("select * from profiles") records.each do |record| if record["contacts"].start_with?("\"---") contacts = coder.load(YAML.safe_load(record["c...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20200331102233_remove_verified_from_users.rb
db/migrate/20200331102233_remove_verified_from_users.rb
class RemoveVerifiedFromUsers < ActiveRecord::Migration[6.0] def up remove_column :users, :verified end def down add_column :users, :verified, :boolean end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20160119163218_update_oauth_token_fields_limit.rb
db/migrate/20160119163218_update_oauth_token_fields_limit.rb
class UpdateOauthTokenFieldsLimit < ActiveRecord::Migration[4.2] def change change_column :oauth_access_tokens, :expires_in, :integer, limit: 8, null: true change_column :oauth_access_grants, :expires_in, :integer, limit: 8, null: true end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20160329032533_create_notifications.notifications.rb
db/migrate/20160329032533_create_notifications.notifications.rb
# This migration comes from notifications (originally 20160328045436) class CreateNotifications < ActiveRecord::Migration[4.2] def change create_table :new_notifications do |t| t.integer :user_id, null: false t.integer :actor_id t.string :notify_type, null: false t.string :target_type ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20160117061547_init_pg_db.rb
db/migrate/20160117061547_init_pg_db.rb
class InitPgDb < ActiveRecord::Migration[4.2] def change create_table "authorizations", force: :cascade do |t| t.string "provider", null: false t.string "uid", limit: 1000, null: false t.integer "user_id", null: false t.datetime "created_at" t.datetime "updated_at" end add_i...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20160518061135_add_closed_at_to_topics.rb
db/migrate/20160518061135_add_closed_at_to_topics.rb
class AddClosedAtToTopics < ActiveRecord::Migration[5.0] def change add_column :topics, :closed_at, :datetime end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20201221082655_remove_follower_ids_from_users.rb
db/migrate/20201221082655_remove_follower_ids_from_users.rb
class RemoveFollowerIdsFromUsers < ActiveRecord::Migration[6.1] def change # Remove unused Array fields, they were instead by ActionStore # ref: https://github.com/ruby-china/homeland/pull/857 remove_column :users, :follower_ids end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20200717154057_create_search_documents.rb
db/migrate/20200717154057_create_search_documents.rb
class CreateSearchDocuments < ActiveRecord::Migration[6.0] def change create_table :search_documents do |t| t.string :searchable_type, limit: 32, null: false t.integer :searchable_id, null: false t.tsvector :tokens t.text :content t.timestamps null: false end add_index :sear...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20160826044113_add_level_to_oauth_applications.rb
db/migrate/20160826044113_add_level_to_oauth_applications.rb
class AddLevelToOauthApplications < ActiveRecord::Migration[5.0] def change add_column :oauth_applications, :level, :integer, default: 0, null: false end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20160119191013_add_indexes_to_table.rb
db/migrate/20160119191013_add_indexes_to_table.rb
class AddIndexesToTable < ActiveRecord::Migration[4.2] def change add_index :topics, :deleted_at add_index :topics, [:node_id, :deleted_at] add_index :replies, :deleted_at add_index :replies, [:topic_id, :deleted_at] remove_index :users, :location add_index :users, :location add_index :...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20170302084611_remove_hr_fields.rb
db/migrate/20170302084611_remove_hr_fields.rb
class RemoveHrFields < ActiveRecord::Migration[5.0] def change remove_column :users, :hr end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20161221022846_create_user_sso.rb
db/migrate/20161221022846_create_user_sso.rb
class CreateUserSSO < ActiveRecord::Migration[5.0] def change create_table :user_ssos do |t| t.integer :user_id, null: false t.string :uid, null: false, length: 255 t.string :username t.string :email t.string :name t.string :avatar_url t.text :last_payload, null: false ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20220113130722_create_counters.rb
db/migrate/20220113130722_create_counters.rb
class CreateCounters < ActiveRecord::Migration[7.0] def change create_table :counters do |t| t.references :countable, polymorphic: true t.string :key, null: false t.integer :value, null: false, default: 0 t.timestamps end add_index :counters, [:countable_type, :countable_id, :key]...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20160518083347_remove_private_token_from_users.rb
db/migrate/20160518083347_remove_private_token_from_users.rb
class RemovePrivateTokenFromUsers < ActiveRecord::Migration[5.0] def change remove_column :users, :private_token end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20160126061903_create_settings.rb
db/migrate/20160126061903_create_settings.rb
class OldSetting < ApplicationRecord self.table_name = "site_configs" end class CreateSettings < ActiveRecord::Migration[4.2] def self.up create_table :settings do |t| t.string :var, null: false t.text :value, null: true t.integer :thing_id, null: true t.string :thing_type, null: true, ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/db/migrate/20170207141208_remove_array_action_fields.rb
db/migrate/20170207141208_remove_array_action_fields.rb
class RemoveArrayActionFields < ActiveRecord::Migration[5.0] def change # Remove old Array fields, they were instead by ActionStore # ref: https://github.com/ruby-china/homeland/pull/857 remove_column :users, :following_ids remove_column :users, :blocked_user_ids remove_column :users, :blocked_nod...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/test_helper.rb
test/test_helper.rb
ENV["RAILS_ENV"] = "test" ENV["upload_provider"] = "file" # Mock to enable all Omniauth providers ENV["github_api_key"] = "fake-key" ENV["twitter_api_key"] = "fake-key" ENV["wechat_api_key"] = "fake-key" require_relative "../config/environment" require "rails/test_help" require "minitest/autorun" require "mocha/minit...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/spec_helper.rb
test/spec_helper.rb
require_relative "test_helper" require "minitest/spec" require "minitest/autorun" Minitest::Spec.register_spec_type(/Controller$/, ActionDispatch::IntegrationTest) require_relative "support/api_controller_test"
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/jobs/github_repo_fetcher_job_test.rb
test/jobs/github_repo_fetcher_job_test.rb
require "test_helper" class GitHubRepoFetcherJobTest < ActiveSupport::TestCase include ActiveJob::TestHelper test ".perform" do User.stub(:fetch_github_repositories, 234) do GitHubRepoFetcherJob.perform_now(234) end assert true end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/jobs/notify_reply_job_test.rb
test/jobs/notify_reply_job_test.rb
require "test_helper" class NotifyReplyJobTest < ActiveSupport::TestCase include ActiveJob::TestHelper attr_accessor :user setup do @user = create(:user) end test ".perform" do followers = create_list(:user, 3) replyer = create :user followers.each do |f| f.follow_user(replyer) e...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/jobs/notify_topic_job_test.rb
test/jobs/notify_topic_job_test.rb
require "test_helper" class NotifyTopicJobTest < ActiveSupport::TestCase include ActiveJob::TestHelper attr_accessor :topic, :user setup do @topic = create(:topic) @user = create(:user) end test ".perform" do followers = create_list(:user, 3) followers.each do |f| f.follow_user(user)...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/jobs/notify_topic_node_changed_job_test.rb
test/jobs/notify_topic_node_changed_job_test.rb
require "test_helper" class NotifyTopicNodeChangedJobTest < ActiveSupport::TestCase include ActiveJob::TestHelper attr_accessor :topic, :user setup do @topic = create(:topic) @user = create(:user) end test ".perform" do topic = create(:topic, user: user) new_node = create(:node) admin ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/jobs/scheduler/spam_cleaup_job_test.rb
test/jobs/scheduler/spam_cleaup_job_test.rb
require "test_helper" class Scheduler::SpamCleanupJobTest < ActiveSupport::TestCase include ActiveJob::TestHelper test ".perform" do create_list(:topic, 3, grade: :ban, created_at: 40.days.ago) topics1 = create_list(:topic, 2, created_at: 40.days.ago) topics2 = create_list(:topic, 2, grade: :ban, cre...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/jobs/scheduler/doorkeeper_cleanup_job_test.rb
test/jobs/scheduler/doorkeeper_cleanup_job_test.rb
require "test_helper" class Scheduler::DoorkeeperCleanupJobTest < ActiveSupport::TestCase include ActiveJob::TestHelper test ".perform" do create_list(:access_token, 3, revoked_at: nil) create_list(:access_grant, 1, revoked_at: nil) create_list(:access_token, 2, revoked_at: 1.days.ago) create_lis...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/jobs/scheduler/notification_cleanup_job_test.rb
test/jobs/scheduler/notification_cleanup_job_test.rb
require "test_helper" class Scheduler::NotificationCleanupJobTest < ActiveSupport::TestCase include ActiveJob::TestHelper test ".perform" do create_list(:notification, 3, created_at: 400.days.ago) create_list(:notification, 2, created_at: 200.days.ago) assert_equal 5, Notification.count assert_equ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/uploaders/avatar_uploader_test.rb
test/uploaders/avatar_uploader_test.rb
require "test_helper" class AvatarUploaderTest < ActiveSupport::TestCase test "extension limit" do not_an_image = fixture_file_upload("test.html", "text/html") image = fixture_file_upload("test.png", "image/png") user = build(:user, avatar: not_an_image) assert_equal false, user.valid? assert_eq...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/uploaders/photo_uploader_test.rb
test/uploaders/photo_uploader_test.rb
require "test_helper" class PhotoUploaderTest < ActiveSupport::TestCase setup do @uploader = PhotoUploader.new end test "allow_thumb?" do assert_equal false, @uploader.allow_thumb?("https://google.com/foo.zip") assert_equal false, @uploader.allow_thumb?("https://google.com/foo") assert_equal tru...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/support/api_controller_test.rb
test/support/api_controller_test.rb
class APIControllerTest < ActionDispatch::IntegrationTest include FactoryBot::Syntax::Methods attr_accessor :current_user, :access_token setup do @current_user = FactoryBot.create(:avatar_user) @access_token = FactoryBot.create(:access_token, resource_owner_id: current_user.id) end def json res...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/support/model.rb
test/support/model.rb
class CommentablePage < ApplicationRecord second_level_cache second_level_cache expires_in: 2.weeks end class Monkey < ApplicationRecord end def setup_test_db! ActiveRecord::Base.connection.create_table(:monkeys, force: true) do |t| t.string :name t.integer :user_id t.integer :comments_count t.t...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/integration/oauth2_test.rb
test/integration/oauth2_test.rb
require "test_helper" require "oauth2" class OAuth2Test < ActionDispatch::IntegrationTest attr_accessor :password, :user, :app, :client setup do @password = "password" @user = create(:user, password: password, password_confirmation: password) @app = create(:application) @client = OAuth2::Client.ne...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/integration/users_test.rb
test/integration/users_test.rb
require "test_helper" class UsersTest < ActionDispatch::IntegrationTest test "login with complex cases" do %w[foo foo1 1234 foo-bar foo_bar foo_ foo.bar].each do |login| create(:user, login: login) get "/#{login}" assert_equal 200, response.status end end test "should get user list" do...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/helpers/likes_helper_test.rb
test/helpers/likes_helper_test.rb
require "test_helper" class LikesHelperTest < ActionView::TestCase include ApplicationHelper attr_accessor :user, :topic, :reply setup do @user = create :user @topic = create :topic @reply = create :reply end test "should run with nil param" do assert_equal "", likeable_tag(nil) end t...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/helpers/application_helper_test.rb
test/helpers/application_helper_test.rb
require "test_helper" class ApplicationHelperTest < ActionView::TestCase def current_page?(url) false end test "markdown" do assert_equal "<p>foo <strong>bar</strong>alert()</p>", markdown("foo **bar**<script>alert()</script>") assert_equal "<p>Hello world alert()</p>", markdown("Hello world <script...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/helpers/topics_helper_test.rb
test/helpers/topics_helper_test.rb
require "test_helper" class TopicsHelperTest < ActionView::TestCase include ApplicationHelper test "topic_favorite_tag" do user = create :user topic = create :topic assert_equal "", topic_favorite_tag(nil) # should result when logined user did not favorite topic sign_in user user.stub(:f...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/helpers/locations_helper_test.rb
test/helpers/locations_helper_test.rb
require "test_helper" class LocationsHelperTest < ActionView::TestCase include ApplicationHelper test "should location_name_tag work with string" do assert_equal link_to("chengdu", location_users_path("chengdu")), location_name_tag("chengdu") end test "should location_name_tag work with Location instance...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/helpers/users_helper_test.rb
test/helpers/users_helper_test.rb
require "test_helper" class UsersHelperTest < ActionView::TestCase include ApplicationHelper test "user_avatar_width_for_size should calculate avatar width correctly" do assert_equal 16, user_avatar_width_for_size(:xs) assert_equal 32, user_avatar_width_for_size(:sm) assert_equal 48, user_avatar_width...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/users.rb
test/factories/users.rb
FactoryBot.define do factory :user do sequence(:name) { |n| "name#{n}" } sequence(:login) { |n| "login#{n}" } sequence(:email) { |n| "email#{n}@gethomeland.com" } password { "password" } password_confirmation { "password" } location { "China" } created_at { 100.days.ago } confirmed_at ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/comments.rb
test/factories/comments.rb
FactoryBot.define do factory :comment do body { "body" } association :user association :commentable end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/notification_mentions.rb
test/factories/notification_mentions.rb
FactoryBot.define do factory :notification_mention, parent: :notification do notify_type { "mention" } association :target, factory: :reply association :second_target, factory: :topic end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/notification_topics.rb
test/factories/notification_topics.rb
FactoryBot.define do factory :notification_topic, parent: :notification do notify_type { "topic" } association :target, factory: :topic end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/notification_node_changeds.rb
test/factories/notification_node_changeds.rb
FactoryBot.define do factory :notification_node_changed, parent: :notification do notify_type { "node_changed" } association :target, factory: :topic association :second_target, factory: :node end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/nodes.rb
test/factories/nodes.rb
FactoryBot.define do factory :node do sequence(:name) { |n| "name#{n}" } summary { "summary" } end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/replies.rb
test/factories/replies.rb
FactoryBot.define do factory :reply do sequence(:body) { |n| "body#{n}" } association :user association :topic end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/applications.rb
test/factories/applications.rb
FactoryBot.define do factory :application, class: Doorkeeper::Application do sequence(:name) { |n| "name#{n}" } sequence(:uid) { |n| "uid#{n}" } sequence(:secret) { |n| "secret#{n}" } redirect_uri { "http://foobar.com" } association :owner, factory: :user end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/authorizations.rb
test/factories/authorizations.rb
FactoryBot.define do factory :authorization do provider { "github" } sequence(:uid) { |n| "github-#{n}" } association(:user) end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/devices.rb
test/factories/devices.rb
FactoryBot.define do factory :device do platform { 1 } association :user token { SecureRandom.hex } end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/team_users.rb
test/factories/team_users.rb
FactoryBot.define do factory :team_user do association :team association :user role { :member } status { :accepted } end factory :team_owner, parent: :team_user do role { :owner } end factory :team_member, parent: :team_user do role { :member } end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/locations.rb
test/factories/locations.rb
FactoryBot.define do factory :location do sequence(:name) { |n| "name#{n}" } end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/topics.rb
test/factories/topics.rb
FactoryBot.define do factory :topic do sequence(:title) { |n| "Topic Title #{n}" } sequence(:body) { |n| "Topic Body #{n}" } association :user association :node end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/counters.rb
test/factories/counters.rb
FactoryBot.define do factory :counter do association :countable, factory: :user key { "foo_count" } value { 0 } end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/access_grants.rb
test/factories/access_grants.rb
FactoryBot.define do factory :access_grant, class: Doorkeeper::AccessGrant do sequence(:resource_owner_id) { |n| n } scopes { "all" } application expires_in { 10.minutes } redirect_uri { "urn:ietf:wg:oauth:2.0:oob" } sequence(:token) { |_n| SecureRandom.hex } end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/access_tokens.rb
test/factories/access_tokens.rb
FactoryBot.define do factory :access_token, class: Doorkeeper::AccessToken do sequence(:resource_owner_id) { |n| n } application expires_in { 2.hours } scopes { "all" } factory :clientless_access_token do application { nil } end end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/teams.rb
test/factories/teams.rb
FactoryBot.define do factory :team do sequence(:name) { |n| "Team #{n}" } sequence(:login) { |n| "team#{n}" } sequence(:email) { |n| "team#{n}@gethomeland.com" } confirmed_at { created_at } end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/photos.rb
test/factories/photos.rb
FactoryBot.define do factory :photo do association :user end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/notifications.rb
test/factories/notifications.rb
FactoryBot.define do factory :notification, class: Notification do notify_type { "foo" } association :user association :actor, factory: :user end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/notification_topic_replies.rb
test/factories/notification_topic_replies.rb
FactoryBot.define do factory :notification_topic_reply, parent: :notification do notify_type { "topic_reply" } association :target, factory: :reply association :second_target, factory: :topic end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/factories/site_configs.rb
test/factories/site_configs.rb
FactoryBot.define do factory :site_config do sequence(:key) { |n| "key_#{n}" } sequence(:value) { |n| "value_#{n}" } end end
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/settings_controller_test.rb
test/controllers/settings_controller_test.rb
require "spec_helper" describe SettingsController do let(:user) { create :user } describe "GET /setting" do it "should work" do sign_in user Setting.stubs(:sso_enabled?).returns(false) get setting_path assert_equal 200, response.status assert_equal true, response.body.include?("U...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/nodes_controller_test.rb
test/controllers/nodes_controller_test.rb
require "spec_helper" describe NodesController do let(:node) { create(:node) } let(:user) { create(:user) } it "GET /nodes" do get nodes_path assert_equal 200, response.status end it "POST /nodes/id/block" do sign_in user post block_node_path(node) assert_equal 200, response.status en...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/home_controller_test.rb
test/controllers/home_controller_test.rb
require "test_helper" class HomeControllerTest < ActionDispatch::IntegrationTest test "GET / without signed in" do get root_path assert_equal 200, response.status assert_select ".navbar .nav-link", text: "Sign Up" end test "GET / with SSO enabled" do Setting.stubs(:sso_enabled?).returns(true) ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/replies_controller_test.rb
test/controllers/replies_controller_test.rb
require "spec_helper" describe RepliesController, type: :controller do describe "GET /topics/:id/replies" do it "should work" do user = create :user topic = create :topic replies = create_list :reply, 3 sign_in user get topic_replies_path(topic), params: { last_id: replies.first.id...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/photos_controller_test.rb
test/controllers/photos_controller_test.rb
require "spec_helper" describe PhotosController do let(:user) { create(:user) } let(:file) { fixture_file_upload("test.png", "image/png") } it "POST /photos success for valid image" do sign_in user assert_equal "image/png", file.content_type post photos_path, params: { file: file } assert_equal ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/search_controller_test.rb
test/controllers/search_controller_test.rb
require "spec_helper" describe SearchController do describe "GET /search" do it "should work" do get search_path assert_equal 200, response.status end end describe "GET /search/users" do let(:user) { create(:user) } let(:users) { [create(:user), create(:user)] } it "should work"...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/devices_controller_test.rb
test/controllers/devices_controller_test.rb
require "spec_helper" describe DevicesController do let(:user) { create(:user) } it "DELETE /devices/:id" do sign_in user device = create(:device, user: user) assert_equal false, device.new_record? assert_changes -> { user.devices.count }, -1 do delete device_path(device.id) end ass...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/team_users_controller_test.rb
test/controllers/team_users_controller_test.rb
require "spec_helper" describe TeamUsersController do let(:team) { create :team } let(:user) { create(:user) } let(:team_owner) { create(:team_owner, team: team, user: user) } let(:team_member) { create(:team_member, team: team, user: user) } describe "GET /team_users" do it "should work" do get u...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/turbolinks_controller_test.rb
test/controllers/turbolinks_controller_test.rb
require "spec_helper" describe TopicsController do let(:user) { create(:user) } let(:user1) { create(:user) } let(:headers) { { "User-Agent": "turbolinks-app, test" } } it "GET /topics/new should got 401 with turbolinks-app" do get new_topic_path, headers: headers assert_equal 401, response.status e...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/users_controller_test.rb
test/controllers/users_controller_test.rb
require "spec_helper" describe UsersController do let(:user) { create :user, location: "Shanghai" } let(:deleted_user) { create :user, state: User.states[:deleted] } it "GET /users" do get users_path assert_equal 200, response.status end describe "GET /users/:id" do it "should show user" do ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/teams_controller_test.rb
test/controllers/teams_controller_test.rb
require "spec_helper" describe TeamsController do let(:user) { create :vip } it "GET /teams" do get teams_path assert_equal 200, response.status end it "GET /teams/:id" do team = create(:team) get team_path(team) assert_redirected_to user_path(team) end it "GET /teams/new" do sig...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/topics_controller_test.rb
test/controllers/topics_controller_test.rb
require "spec_helper" describe TopicsController do let(:topic) { create :topic, user: user } let(:user) { create :avatar_user } let(:newbie) { create :newbie } let(:node) { create :node } let(:admin) { create :admin } let(:team) { create :team } describe "GET /topics" do it "should have an index act...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/likes_controller_test.rb
test/controllers/likes_controller_test.rb
require "spec_helper" describe LikesController do let(:user) { create(:user) } let(:user2) { create(:user) } let(:topic) { create(:topic) } it "GET /likes" do get likes_path, params: { type: "Topic", id: topic.id } assert_equal 200, response.status end it "POST /likes" do sign_in user pos...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/auth/sso_controller_test.rb
test/controllers/auth/sso_controller_test.rb
require "spec_helper" describe Auth::SSOController do let(:sso_secret) { "foo(*&@!12q36)" } describe "GET /auth/sso/show" do before do @sso_url = "http://somesite.com/homeland-sso" Setting.stubs(:sso).returns( enable: true, url: @sso_url, secret: sso_secret ) S...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/admin/comments_controller_test.rb
test/controllers/admin/comments_controller_test.rb
require "spec_helper" describe Admin::CommentsController do before do sign_in create(:admin) @comment = create :comment, commentable: CommentablePage.create(name: "Fake Wiki", id: 1) end it "GET /admin/comments" do get admin_comments_path assert_equal 200, response.status end it "GET /admin...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/admin/dashboards_controller_test.rb
test/controllers/admin/dashboards_controller_test.rb
require "spec_helper" class Admin::DashboardsControllerTest < ActionDispatch::IntegrationTest setup do @admin = create(:admin) sign_in @admin end test "GET /admin without admin" do user = create(:user) sign_in user get admin_root_path assert_equal 404, response.status end test "GET ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/admin/replies_controller_test.rb
test/controllers/admin/replies_controller_test.rb
require "spec_helper" describe Admin::RepliesController do before do sign_in create(:admin) end it "GET /admin/replies" do get admin_replies_path assert_equal 200, response.status end it "GET /admin/replies/:id/edit" do reply = create :reply get edit_admin_reply_path(reply.id) asser...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/admin/users_controller_test.rb
test/controllers/admin/users_controller_test.rb
require "spec_helper" describe Admin::UsersController do before do sign_in create(:admin) end it "GET /admin/users" do get admin_users_path assert_equal 200, response.status end it "GET /admin/users/:id/edit" do user = create :user get edit_admin_user_path(user.id) assert_equal 200,...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/admin/topics_controller_test.rb
test/controllers/admin/topics_controller_test.rb
require "spec_helper" describe Admin::TopicsController do before do sign_in create(:admin) end it "GET /admin/topics" do get admin_topics_path assert_equal 200, response.status end it "GET /admin/topics/:id/edit" do topic = create :topic get edit_admin_topic_path(topic.id) assert_eq...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/api/devices_test.rb
test/controllers/api/devices_test.rb
require "spec_helper" describe Api::V3::DevicesController do let(:token) { SecureRandom.hex } describe "POST /api/v3/devices.json" do it "require login" do post "/api/v3/devices.json", platform: "ios", token: token assert_equal 401, response.status end it "should be ok" do login_use...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/api/topics_test.rb
test/controllers/api/topics_test.rb
require "spec_helper" describe Api::V3::TopicsController do describe "GET /api/v3/topics.json" do it "should be ok" do get "/api/v3/topics.json" assert_equal 200, response.status end it "should be ok for all types" do create(:topic, title: "This is a normal topic", replies_count: 1) ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/api/root_test.rb
test/controllers/api/root_test.rb
require "spec_helper" require "active_support/core_ext" describe Api::V3::RootController do describe "Not found routes" do it "should return status 404" do get "/api/v3/foo-bar.json" assert_equal 404, response.status assert_equal "ResourceNotFound", json["error"] end end describe "GET ...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false
ruby-china/homeland
https://github.com/ruby-china/homeland/blob/9f5dbde5b7ce92b72bfdfb14622a784a2805e412/test/controllers/api/likes_test.rb
test/controllers/api/likes_test.rb
require "spec_helper" describe Api::V3::LikesController do let(:reply) { create(:reply) } let(:topic) { create(:topic) } describe "POST /api/v3/likes.json" do it "require login" do post "/api/v3/likes.json", obj_type: "reply", obj_id: reply.id assert_equal 401, response.status end it "s...
ruby
MIT
9f5dbde5b7ce92b72bfdfb14622a784a2805e412
2026-01-04T15:48:23.006961Z
false