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
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20200425023906_enable_trigram_extension.rb
db/migrate/20200425023906_enable_trigram_extension.rb
class EnableTrigramExtension < ActiveRecord::Migration[6.0] def change enable_extension "pg_trgm" if adapter_name.downcase == "postgresql" && !extension_enabled?("pg_trgm") end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20231031005528_rename_crypted_password_to_password_digest_in_users.rb
db/migrate/20231031005528_rename_crypted_password_to_password_digest_in_users.rb
class RenameCryptedPasswordToPasswordDigestInUsers < ActiveRecord::Migration[7.0] def change rename_column :users, :crypted_password, :password_digest end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20201208090137_add_position_playlists_songs.rb
db/migrate/20201208090137_add_position_playlists_songs.rb
class AddPositionPlaylistsSongs < ActiveRecord::Migration[6.0] def up add_column :playlists_songs, :id, :primary_key add_column :playlists_songs, :position, :integer execute <<-SQL UPDATE playlists_songs SET position = mapping.new_position FROM ( SELECT id, R...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20241018134323_drop_solid_queue_tables.rb
db/migrate/20241018134323_drop_solid_queue_tables.rb
class DropSolidQueueTables < ActiveRecord::Migration[7.2] def change drop_table :solid_queue_blocked_executions do |t| t.integer "job_id", null: false t.string "queue_name", null: false t.integer "priority", default: 0, null: false t.string "concurrency_key", null: false t.datetime "...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20231102065319_remove_api_token_from_users.rb
db/migrate/20231102065319_remove_api_token_from_users.rb
class RemoveApiTokenFromUsers < ActiveRecord::Migration[7.1] def change remove_column :users, :api_token, :string end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240202024632_add_key_hash_and_byte_size_indexes_and_null_constraints_to_solid_cache_entries.solid_cache.rb
db/migrate/20240202024632_add_key_hash_and_byte_size_indexes_and_null_constraints_to_solid_cache_entries.solid_cache.rb
# This migration comes from solid_cache (originally 20240110111600) class AddKeyHashAndByteSizeIndexesAndNullConstraintsToSolidCacheEntries < ActiveRecord::Migration[7.1] def change change_table :solid_cache_entries, bulk: true do |t| t.change_null :key_hash, false t.change_null :byte_size, false ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240103085953_add_default_name_to_artists.rb
db/migrate/20240103085953_add_default_name_to_artists.rb
class AddDefaultNameToArtists < ActiveRecord::Migration[7.1] def up Artist.where(is_various: true).update_all(name: Artist::VARIOUS_NAME) Artist.where(name: [ nil, "" ]).update_all(name: Artist::UNKNOWN_NAME) end def down Artist.where(name: [ Artist::UNKNOWN_NAME, Artist::VARIOUS_NAME ]).update_all(n...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240103072942_add_default_name_to_unknown_albums.rb
db/migrate/20240103072942_add_default_name_to_unknown_albums.rb
class AddDefaultNameToUnknownAlbums < ActiveRecord::Migration[7.1] def up Album.where(name: [ nil, "" ]).update_all(name: Album::UNKNOWN_NAME) end def down Album.where(name: Album::UNKNOWN_NAME).update_all(name: nil) end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20231101081313_remove_persistence_token_from_user.rb
db/migrate/20231101081313_remove_persistence_token_from_user.rb
class RemovePersistenceTokenFromUser < ActiveRecord::Migration[7.1] def change remove_column :users, :persistence_token, :string end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240206051609_add_unique_index_on_song_md5_hash.rb
db/migrate/20240206051609_add_unique_index_on_song_md5_hash.rb
class AddUniqueIndexOnSongMd5Hash < ActiveRecord::Migration[7.1] def up # Remove duplicate songs Song.where.not(id: Song.group(:md5_hash).select("min(id)")).destroy_all remove_index :songs, :md5_hash add_index :songs, :md5_hash, unique: true end def down remove_index :songs, :md5_hash ad...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240202024631_add_key_hash_and_byte_size_to_solid_cache_entries.solid_cache.rb
db/migrate/20240202024631_add_key_hash_and_byte_size_to_solid_cache_entries.solid_cache.rb
# This migration comes from solid_cache (originally 20240108155507) class AddKeyHashAndByteSizeToSolidCacheEntries < ActiveRecord::Migration[7.1] def change change_table :solid_cache_entries do |t| t.column :key_hash, :integer, null: true, limit: 8 t.column :byte_size, :integer, null: true, limit: 4 ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20220531070546_add_api_token_to_users.rb
db/migrate/20220531070546_add_api_token_to_users.rb
class AddApiTokenToUsers < ActiveRecord::Migration[7.0] def change add_column :users, :api_token, :string add_index :users, :api_token, unique: true end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240202024630_create_solid_cache_entries.solid_cache.rb
db/migrate/20240202024630_create_solid_cache_entries.solid_cache.rb
# This migration comes from solid_cache (originally 20230724121448) class CreateSolidCacheEntries < ActiveRecord::Migration[7.0] def change create_table :solid_cache_entries do |t| t.binary :key, null: false, limit: 1024 t.binary :value, null: false, limit: 512.megabytes t.datetime :created_at, ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20231101065621_rename_password_salt_to_deprecated_password_salt_in_users.rb
db/migrate/20231101065621_rename_password_salt_to_deprecated_password_salt_in_users.rb
class RenamePasswordSaltToDeprecatedPasswordSaltInUsers < ActiveRecord::Migration[7.1] def change rename_column :users, :password_salt, :deprecated_password_salt end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240103081109_change_name_null_on_albums.rb
db/migrate/20240103081109_change_name_null_on_albums.rb
class ChangeNameNullOnAlbums < ActiveRecord::Migration[7.1] def change change_column_null :albums, :name, false end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240103090230_change_name_null_on_artists.rb
db/migrate/20240103090230_change_name_null_on_artists.rb
class ChangeNameNullOnArtists < ActiveRecord::Migration[7.1] def change change_column_null :artists, :name, false end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240202024633_remove_key_index_from_solid_cache_entries.solid_cache.rb
db/migrate/20240202024633_remove_key_index_from_solid_cache_entries.solid_cache.rb
# This migration comes from solid_cache (originally 20240110111702) class RemoveKeyIndexFromSolidCacheEntries < ActiveRecord::Migration[7.1] def change change_table :solid_cache_entries do |t| t.remove_index :key, unique: true end end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20231207020650_add_discnum_to_songs.rb
db/migrate/20231207020650_add_discnum_to_songs.rb
class AddDiscnumToSongs < ActiveRecord::Migration[7.1] def change add_column :songs, :discnum, :integer end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20210607030347_add_authlogic_to_user.rb
db/migrate/20210607030347_add_authlogic_to_user.rb
class AddAuthlogicToUser < ActiveRecord::Migration[6.1] def change rename_column :users, :password_digest, :crypted_password add_column :users, :password_salt, :string add_column :users, :persistence_token, :string add_index :users, :persistence_token, unique: true end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20200424065813_init_tables.rb
db/migrate/20200424065813_init_tables.rb
class InitTables < ActiveRecord::Migration[6.0] def change create_table :users do |t| t.string :email, null: false t.string :password_digest, null: false t.boolean :is_admin, default: false t.timestamps t.index :email, unique: true end create_table :albums do |t| t.str...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20220811021933_add_recently_played_album_ids_to_users.rb
db/migrate/20220811021933_add_recently_played_album_ids_to_users.rb
class AddRecentlyPlayedAlbumIdsToUsers < ActiveRecord::Migration[7.0] def change add_column :users, :recently_played_album_ids, :integer, array: true, default: [] end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240115051640_migrate_images_from_albums.rb
db/migrate/20240115051640_migrate_images_from_albums.rb
class MigrateImagesFromAlbums < ActiveRecord::Migration[7.1] def up Album.where.not(image: nil).find_each do |album| image_path = Rails.root.join("public", "uploads", "album", "image", album.id.to_s, album.image) image_format = File.extname(image_path).downcase.delete(".") next unless File.exis...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20230221024303_add_years_and_genre_to_albums.rb
db/migrate/20230221024303_add_years_and_genre_to_albums.rb
class AddYearsAndGenreToAlbums < ActiveRecord::Migration[7.0] def change add_column :albums, :year, :integer add_column :albums, :genre, :string end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20220822030432_add_name_index_to_playlists.rb
db/migrate/20220822030432_add_name_index_to_playlists.rb
class AddNameIndexToPlaylists < ActiveRecord::Migration[7.0] def change add_index(:playlists, :name) end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20221115061632_change_hstore_value_to_text.rb
db/migrate/20221115061632_change_hstore_value_to_text.rb
class ChangeHstoreValueToText < ActiveRecord::Migration[7.0] def up change_column :settings, :values, :text change_column :users, :settings, :text end def down change_column :settings, :values, :hstore change_column :users, :settings, :hstore end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20201117120829_add_unique_index_on_album_name.rb
db/migrate/20201117120829_add_unique_index_on_album_name.rb
class AddUniqueIndexOnAlbumName < ActiveRecord::Migration[6.0] def change add_index :albums, [ :artist_id, :name ], unique: true end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20200721071945_add_is_various_to_artists.rb
db/migrate/20200721071945_add_is_various_to_artists.rb
class AddIsVariousToArtists < ActiveRecord::Migration[6.0] def change add_column(:artists, :is_various, :boolean, default: false) end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240115020448_create_active_storage_tables.active_storage.rb
db/migrate/20240115020448_create_active_storage_tables.active_storage.rb
# This migration comes from active_storage (originally 20170806125915) class CreateActiveStorageTables < ActiveRecord::Migration[7.0] def change # Use Active Record's configured type for primary and foreign keys primary_key_type, foreign_key_type = primary_and_foreign_key_types create_table :active_stora...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/application_system_test_case.rb
test/application_system_test_case.rb
# frozen_string_literal: true require "test_helper" require "capybara/cuprite" SimpleCov.command_name "test:system" class ApplicationSystemTestCase < ActionDispatch::SystemTestCase driven_by :cuprite, screen_size: [ 1400, 900 ], options: { browser_options: { "no-sandbox": nil }, url_blacklist: [ "https://w...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/test_helper.rb
test/test_helper.rb
# frozen_string_literal: true require "simplecov" SimpleCov.start "rails" do # After upgrading to Rails 7.1, simplecov cannot collect coverage for files in the lib directory. # It seems that the behavior of the Rails test command has changed. I have already tried adding the lib directory to the autoload once path...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/jobs/media_sync_job_test.rb
test/jobs/media_sync_job_test.rb
# frozen_string_literal: true require "test_helper" class MediaSyncJobTest < ActiveJob::TestCase setup do clear_media_data end test "sync added media" do file_paths = [ fixtures_file_path("artist1_album1.flac") ] mock = Minitest::Mock.new mock.expect(:call, true, [ :added, file_paths ]) M...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/jobs/media_sync_all_job_test.rb
test/jobs/media_sync_all_job_test.rb
# frozen_string_literal: true require "test_helper" class MediaSyncAllJobTest < ActiveJob::TestCase setup do clear_media_data MediaSyncAllJob.perform_now end test "should create all records in database when synced" do assert_equal 3, Artist.count assert_equal 4, Album.count assert_equal 9, ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/jobs/attach_cover_image_from_discogs_job_test.rb
test/jobs/attach_cover_image_from_discogs_job_test.rb
# frozen_string_literal: true require "test_helper" class AttachCoverImageFromDiscogsJobTest < ActiveJob::TestCase setup do @discogs_client = Minitest::Mock.new @discogs_client.expect( :cover_image, { io: StringIO.new(file_fixture("cover_image.jpg").read), filename: "cover.jpg",...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/helpers/application_helper_test.rb
test/helpers/application_helper_test.rb
# frozen_string_literal: true require "test_helper" class ApplicationHelperTest < ActionView::TestCase test "format duration" do assert_equal "00:09", format_duration(9) assert_equal "01:30", format_duration(90) assert_equal "15:00", format_duration(900) assert_equal "02:30:00", format_duration(9000...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/application_controller_test.rb
test/controllers/application_controller_test.rb
# frozen_string_literal: true require "test_helper" class DummyController < ApplicationController def index render plain: "OK" end def show redirect_back_with_referer_params(fallback_location: { action: "index" }) end end class ApplicationControllerTest < ActionDispatch::IntegrationTest setup do ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/sessions_controller_test.rb
test/controllers/sessions_controller_test.rb
# frozen_string_literal: true require "test_helper" class SessionsControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:visitor1) end test "should get new session" do get new_session_url assert_response :success end test "should redirect to root when user logged in" do l...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/libraries_controller_test.rb
test/controllers/libraries_controller_test.rb
# frozen_string_literal: true require "test_helper" class LibrariesControllerTest < ActionDispatch::IntegrationTest test "should show library" do login get library_path assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/transcoded_stream_controller_test.rb
test/controllers/transcoded_stream_controller_test.rb
# frozen_string_literal: true require "test_helper" class TranscodedStreamControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:visitor1) cache_directory = "#{Stream::TRANSCODE_CACHE_DIRECTORY}/#{songs(:flac_sample).id}" if Dir.exist?(cache_directory) FileUtils.remove_dir(cache...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/playlists_controller_test.rb
test/controllers/playlists_controller_test.rb
# frozen_string_literal: true require "test_helper" class PlaylistsControllerTest < ActionDispatch::IntegrationTest test "should get index" do login get playlists_url assert_response :success end test "should create playlist" do playlists_count = Playlist.count login post playlists_ur...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/settings_controller_test.rb
test/controllers/settings_controller_test.rb
# frozen_string_literal: true require "test_helper" class SettingsControllerTest < ActionDispatch::IntegrationTest include ActiveJob::TestHelper test "should show setting" do login get setting_url assert_response :success end test "should update global setting" do login users(:admin) pa...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/stream_controller_test.rb
test/controllers/stream_controller_test.rb
# frozen_string_literal: true require "test_helper" class StreamControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:visitor1) login(@user) end test "should get new stream" do get new_stream_url(song_id: songs(:mp3_sample).id) assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/songs_controller_test.rb
test/controllers/songs_controller_test.rb
# frozen_string_literal: true require "test_helper" class SongsControllerTest < ActionDispatch::IntegrationTest test "should get index" do login get songs_url assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/home_controller_test.rb
test/controllers/home_controller_test.rb
# frozen_string_literal: true require "test_helper" class HomeControllerTest < ActionDispatch::IntegrationTest test "should get index" do login get root_url assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/media_syncing_controller_test.rb
test/controllers/media_syncing_controller_test.rb
# frozen_string_literal: true require "test_helper" class MediaSyncingControllerTest < ActionDispatch::IntegrationTest include ActiveJob::TestHelper test "should sync media" do login users(:admin) Media.stub(:syncing?, false) do assert_enqueued_with(job: MediaSyncAllJob) do post media_sync...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/search_controller_test.rb
test/controllers/search_controller_test.rb
# frozen_string_literal: true require "test_helper" class SearchControllerTest < ActionDispatch::IntegrationTest test "should get index" do login get search_url(query: "test") assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/albums_controller_test.rb
test/controllers/albums_controller_test.rb
# frozen_string_literal: true require "test_helper" class AlbumsControllerTest < ActionDispatch::IntegrationTest include ActiveJob::TestHelper test "should get index" do login get albums_url assert_response :success end test "should update image for album" do album = albums(:album1) log...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/errors_controller_test.rb
test/controllers/errors_controller_test.rb
# frozen_string_literal: true require "test_helper" class ErrorsControllerTest < ActionDispatch::IntegrationTest test "should get forbidden" do get forbidden_url assert_response :forbidden end test "should get not found" do get not_found_url assert_response :not_found end test "should get ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/users_controller_test.rb
test/controllers/users_controller_test.rb
# frozen_string_literal: true require "test_helper" class UsersControllerTest < ActionDispatch::IntegrationTest setup do login users(:admin) end test "should get index" do get users_url assert_response :success end test "should get new user" do get new_user_url assert_response :success...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/artists_controller_test.rb
test/controllers/artists_controller_test.rb
# frozen_string_literal: true require "test_helper" class ArtistsControllerTest < ActionDispatch::IntegrationTest include ActiveJob::TestHelper test "should get index" do login get artists_url assert_response :success end test "should show artist" do login get artist_url(artists(:artist...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/current_playlist/songs_controller_test.rb
test/controllers/current_playlist/songs_controller_test.rb
# frozen_string_literal: true require "test_helper" class CurrentPlaylistSongsControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:visitor1) @playlist = @user.current_playlist @playlist.song_ids = [ 1, 2 ] login @user end test "should show current playlist songs" do get...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/current_playlist/songs/playlists_controller_test.rb
test/controllers/current_playlist/songs/playlists_controller_test.rb
require "test_helper" class CurrentPlaylist::Songs::PlaylistsControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:admin) @current_playlist = @user.current_playlist login @user end test "should replace all songs with playlist songs" do playlist = @user.playlists.create(name: ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/current_playlist/songs/albums_controller_test.rb
test/controllers/current_playlist/songs/albums_controller_test.rb
require "test_helper" class CurrentPlaylist::Songs::AlbumControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:visitor1) @playlist = @user.current_playlist login @user end test "should replace all songs with album songs" do put current_playlist_album_url(albums(:album1), shou...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/playlists/songs_controller_test.rb
test/controllers/playlists/songs_controller_test.rb
# frozen_string_literal: true require "test_helper" class Playlists::SongsControllerTest < ActionDispatch::IntegrationTest setup do @playlist = playlists(:playlist1) @user = @playlist.user login @user end test "should show playlist songs" do get playlist_songs_url(@playlist) assert_respons...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/albums/filter/genres_controller_test.rb
test/controllers/albums/filter/genres_controller_test.rb
# frozen_string_literal: true require "test_helper" class Albums::Filter::GenresControllerTest < ActionDispatch::IntegrationTest test "should get index" do login get albums_filter_genres_url assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/albums/filter/years_controller_test.rb
test/controllers/albums/filter/years_controller_test.rb
# frozen_string_literal: true require "test_helper" class Albums::Filter::YearsControllerTest < ActionDispatch::IntegrationTest test "should get index" do login get albums_filter_years_url assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/dialog/playlists_controller_test.rb
test/controllers/dialog/playlists_controller_test.rb
# frozen_string_literal: true require "test_helper" class Dialog::PlaylistsControllerTest < ActionDispatch::IntegrationTest test "should get index" do login get dialog_playlists_url assert_response :success end test "should get new playlist" do login get new_dialog_playlist_path asser...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/dialog/albums_controller_test.rb
test/controllers/dialog/albums_controller_test.rb
# frozen_string_literal: true require "test_helper" class Dialog::AlbumsControllerTest < ActionDispatch::IntegrationTest test "should edit album" do login users(:admin) get edit_dialog_album_url(albums(:album1)) assert_response :success end test "should only admin can edit album" do login ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/dialog/artists_controller_test.rb
test/controllers/dialog/artists_controller_test.rb
# frozen_string_literal: true require "test_helper" class Dialog::ArtistsControllerTest < ActionDispatch::IntegrationTest test "should edit album" do login users(:admin) get edit_dialog_artist_url(artists(:artist1)) assert_response :success end test "should only admin can edit artist" do login...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/api/v1/transcoded_stream_controller_test.rb
test/controllers/api/v1/transcoded_stream_controller_test.rb
# frozen_string_literal: true require "test_helper" class Api::V1::TranscodedStreamControllerTest < ActionDispatch::IntegrationTest class StreamMock < Stream def initialize(song) super(song) @tmp_cache_file = Tempfile.new([ "", ".#{TRANSCODE_FORMAT}" ]) end def transcode_cache_file_path ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/api/v1/authentications_controller_test.rb
test/controllers/api/v1/authentications_controller_test.rb
# frozen_string_literal: true require "test_helper" class Api::V1::AuthenticationsControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:visitor1) end test "should create authentication without session" do post api_v1_authentication_url, as: :json, params: { session: { e...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/api/v1/systems_controller_test.rb
test/controllers/api/v1/systems_controller_test.rb
# frozen_string_literal: true require "test_helper" class Api::V1::SystemsControllerTest < ActionDispatch::IntegrationTest test "should get system version" do get api_v1_system_url, as: :json response = @response.parsed_body["version"] assert_response :success assert_equal BlackCandy::Version::MAJO...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/api/v1/stream_controller_test.rb
test/controllers/api/v1/stream_controller_test.rb
# frozen_string_literal: true require "test_helper" class Api::V1::StreamControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:visitor1) end test "should get new stream" do get new_api_v1_stream_url(song_id: songs(:mp3_sample).id), headers: api_token_header(@user) assert_response...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/api/v1/songs_controller_test.rb
test/controllers/api/v1/songs_controller_test.rb
# frozen_string_literal: true require "test_helper" class Api::V1::SongsControllerTest < ActionDispatch::IntegrationTest test "should show song" do get api_v1_song_url(songs(:mp3_sample)), as: :json, headers: api_token_header(users(:visitor1)) response = @response.parsed_body assert_response :success ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/api/v1/api_controller_test.rb
test/controllers/api/v1/api_controller_test.rb
# frozen_string_literal: true require "test_helper" class Api::V1::ApiControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:visitor1) @song = songs(:mp3_sample) end test "should not authenticate when use session" do login(@user) get api_v1_song_url(@song), as: :json asse...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/api/v1/current_playlist/songs_controller_test.rb
test/controllers/api/v1/current_playlist/songs_controller_test.rb
require "test_helper" class Api::V1::CurrentPlaylist::SongsControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:visitor1) @playlist = @user.current_playlist @playlist.song_ids = [ 1, 2, 3 ] end test "should show all songs" do get api_v1_current_playlist_songs_url, as: :json, ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/api/v1/current_playlist/songs/playlists_controller_test.rb
test/controllers/api/v1/current_playlist/songs/playlists_controller_test.rb
require "test_helper" class Api::V1::CurrentPlaylist::Songs::PlaylistsControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:admin) @current_playlist = @user.current_playlist end test "should replace all songs with playlist songs" do playlist = @user.playlists.create(name: "test", ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/api/v1/current_playlist/songs/albums_controller_test.rb
test/controllers/api/v1/current_playlist/songs/albums_controller_test.rb
require "test_helper" class Api::V1::CurrentPlaylist::Songs::AlbumControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:visitor1) @playlist = @user.current_playlist end test "should replace all songs with album songs" do put api_v1_current_playlist_album_url(albums(:album1)), as: ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/api/v1/favorite_playlist/songs_controller_test.rb
test/controllers/api/v1/favorite_playlist/songs_controller_test.rb
require "test_helper" class Api::V1::FavoritePlaylist::SongsControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:visitor1) @playlist = @user.favorite_playlist @playlist.song_ids = [ 1, 2 ] end test "should add songs to playlist" do post api_v1_favorite_playlist_songs_url, par...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/favorite_playlist/songs_controller_test.rb
test/controllers/favorite_playlist/songs_controller_test.rb
# frozen_string_literal: true require "test_helper" class FavoritePlaylistSongsControllerTest < ActionDispatch::IntegrationTest test "should show favorite playlist songs" do login get favorite_playlist_songs_url assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/users/settings_controller_test.rb
test/controllers/users/settings_controller_test.rb
# frozen_string_literal: true require "test_helper" class Users::SettingsControllerTest < ActionDispatch::IntegrationTest test "should update user settings" do current_user = users(:visitor1) assert_equal "auto", current_user.theme login current_user patch user_setting_url(current_user), params: { ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/search/playlists_controller_test.rb
test/controllers/search/playlists_controller_test.rb
# frozen_string_literal: true require "test_helper" class Search::PlaylistsControllerTest < ActionDispatch::IntegrationTest test "should get index" do login get search_playlists_url(query: "test") assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/search/songs_controller_test.rb
test/controllers/search/songs_controller_test.rb
# frozen_string_literal: true require "test_helper" class Search::SongsControllerTest < ActionDispatch::IntegrationTest test "should get index" do login get search_songs_url(query: "test") assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/search/albums_controller_test.rb
test/controllers/search/albums_controller_test.rb
# frozen_string_literal: true require "test_helper" class Search::AlbumsControllerTest < ActionDispatch::IntegrationTest test "should get index" do login get search_albums_url(query: "test") assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/search/artists_controller_test.rb
test/controllers/search/artists_controller_test.rb
# frozen_string_literal: true require "test_helper" class Search::ArtistsControllerTest < ActionDispatch::IntegrationTest test "should get index" do login get search_artists_url(query: "test") assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/songs/filter/genres_controller_test.rb
test/controllers/songs/filter/genres_controller_test.rb
# frozen_string_literal: true require "test_helper" class Songs::Filter::GenresControllerTest < ActionDispatch::IntegrationTest test "should get index" do login get songs_filter_genres_url assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/controllers/songs/filter/years_controller_test.rb
test/controllers/songs/filter/years_controller_test.rb
# frozen_string_literal: true require "test_helper" class Songs::Filter::YearsControllerTest < ActionDispatch::IntegrationTest test "should get index" do login get songs_filter_years_url assert_response :success end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/session_test.rb
test/models/session_test.rb
require "test_helper" class SessionTest < ActiveSupport::TestCase test "should build from user credential" do session = Session.build_from_credential(email: users(:admin).email, password: "foobar") assert session.valid? end test "should build from user credential with deprecated_password_salt" do us...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/current_playlist_test.rb
test/models/current_playlist_test.rb
# frozen_string_literal: true require "test_helper" class CurrentPlaylistTest < ActiveSupport::TestCase test "should not need name" do assert CurrentPlaylist.new(name: nil, user: users(:admin)).valid? end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/user_test.rb
test/models/user_test.rb
# frozen_string_literal: true require "test_helper" class UserTest < ActiveSupport::TestCase # From https://en.wikipedia.org/wiki/Email_address#Examples INVALID_EMAIL_ADDRESSES = [ "Abc.example.com", 'a"b(c)d,e:f;g<h>i[j\k]l@example.com', 'just"not"right@example.com', 'this is"not\allowed@example....
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/setting_test.rb
test/models/setting_test.rb
# frozen_string_literal: true require "test_helper" class SettingTest < ActiveSupport::TestCase include ActiveJob::TestHelper test "should have AVAILABLE_SETTINGS constant" do assert_equal [ :media_path, :discogs_token, :transcode_bitrate, :allow_transcode_lossless, :enable_media_listener, :enable_parallel_m...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/media_file_test.rb
test/models/media_file_test.rb
# frozen_string_literal: true require "test_helper" class MediaFileTest < ActiveSupport::TestCase test "should get file path array from media_path" do expect_file_paths = [ fixtures_file_path("artist1_album1.flac"), fixtures_file_path("artist2_album3.ogg"), fixtures_file_path("artist1_album2.m...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/song_test.rb
test/models/song_test.rb
# frozen_string_literal: true require "test_helper" class SongTest < ActiveSupport::TestCase test "should get file format" do assert_equal "mp3", songs(:mp3_sample).format assert_equal "flac", songs(:flac_sample).format assert_equal "ogg", songs(:ogg_sample).format assert_equal "wav", songs(:wav_sam...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/album_test.rb
test/models/album_test.rb
# frozen_string_literal: true require "test_helper" class AlbumTest < ActiveSupport::TestCase test "should not have same name album on an artist" do artists(:artist1).albums.create(name: "best") assert_raise ActiveRecord::RecordNotUnique do artists(:artist1).albums.create(name: "best") end end ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/artist_test.rb
test/models/artist_test.rb
# frozen_string_literal: true require "test_helper" class ArtistTest < ActiveSupport::TestCase test "should have default name when name is empty" do artist = Artist.create(name: nil) assert artist.unknown? assert_equal "Unknown Artist", artist.name end test "should have default name when is variou...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/favorite_playlist_test.rb
test/models/favorite_playlist_test.rb
# frozen_string_literal: true require "test_helper" class FavoritePlaylistTest < ActiveSupport::TestCase test "should not need name" do assert FavoritePlaylist.new(name: nil, user: users(:admin)).valid? end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/stream_test.rb
test/models/stream_test.rb
# frozen_string_literal: true require "test_helper" class StreamTest < ActiveSupport::TestCase test "should can transcode flac format" do create_tmp_file(format: "mp3") do |tmp_file_path| stream = Stream.new(songs(:flac_sample)) File.open(tmp_file_path, "w") do |file| stream.each { |data| f...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/playlists_song_test.rb
test/models/playlists_song_test.rb
# frozen_string_literal: true require "test_helper" class PlaylistsSongTest < ActiveSupport::TestCase test "should reorder songs list" do assert_changes -> { PlaylistsSong.where(playlist_id: 1).pluck(:song_id) }, from: [ 1, 2 ], to: [ 2, 1 ] do playlists_songs(:playlist1_mp3_sample).update(position: 2) ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/playlist_test.rb
test/models/playlist_test.rb
# frozen_string_literal: true require "test_helper" class PlaylistTest < ActiveSupport::TestCase test "should have name" do assert_not Playlist.new(name: nil, user: users(:admin)).valid? end test "should raise error when song already in playlist" do assert_raises(ActiveRecord::RecordNotUnique) do ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/user_setting_test.rb
test/models/user_setting_test.rb
# frozen_string_literal: true require "test_helper" class UserSettingTest < ActiveSupport::TestCase test "should have AVAILABLE_SETTINGS constant" do assert_equal [ :theme ], User::AVAILABLE_SETTINGS end test "should get default value when setting value did not set" do user = users(:visitor1) asse...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/media_listener_test.rb
test/models/media_listener_test.rb
# frozen_string_literal: true require "test_helper" class MediaListenerTest < ActiveSupport::TestCase test "running listener" do assert_not MediaListener.running? MediaListener.start assert MediaListener.running? MediaListener.stop assert_not MediaListener.running? end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/media_test.rb
test/models/media_test.rb
# frozen_string_literal: true require "test_helper" class MediaTest < ActiveSupport::TestCase include ActionCable::TestHelper include ActiveJob::TestHelper setup do clear_media_data end test "should get syncing status" do assert_not Media.syncing? end test "should change syncing status" do ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/concerns/searchable_test.rb
test/models/concerns/searchable_test.rb
# frozen_string_literal: true require "test_helper" class SearchableTest < ActiveSupport::TestCase test "should have search class method when declared search_by on class" do assert_respond_to Album, :search assert_respond_to Artist, :search assert_respond_to Song, :search end test "should support s...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/models/integrations/discogs_test.rb
test/models/integrations/discogs_test.rb
# frozen_string_literal: true require "test_helper" class Integrations::DiscogsTest < ActiveSupport::TestCase setup do @discogs_client = Integrations::Discogs.new("fake_token") @api_response = { results: [ { cover_image: "http://example.com/cover.jpg" } ] } @cover_image_binary = file_fixture("cover_imag...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/lib/black_candy/errors_test.rb
test/lib/black_candy/errors_test.rb
# frozen_string_literal: true require "test_helper" class BlackCandy::ErrorsTest < ActiveSupport::TestCase test "should get info from forbidden error" do error = BlackCandy::Forbidden.new assert_equal "Forbidden", error.type assert_not_empty error.message end test "should get info from invalid cre...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/lib/black_candy/version_test.rb
test/lib/black_candy/version_test.rb
# frozen_string_literal: true require "test_helper" class BlackCandy::VersionTest < ActiveSupport::TestCase test "should get version string and link" do with_env("COMMIT_HASH" => "abcdef1234567890") do assert_equal "abcdef1234567890", BlackCandy::Version.commit_hash assert_match(/^v\d+\.\d+\.\d+$/, ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/test/lib/black_candy/config_test.rb
test/lib/black_candy/config_test.rb
# frozen_string_literal: true require "test_helper" class BlackCandy::ConfigTest < ActiveSupport::TestCase test "should get value from ENV" do assert_nil BlackCandy.config.media_path with_env("MEDIA_PATH" => "test_media_path") do assert_equal "test_media_path", BlackCandy.config.media_path end ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/lib/puma/plugin/media_listener.rb
lib/puma/plugin/media_listener.rb
# frozen_string_literal: true require "puma/plugin" Puma::Plugin.create do def start(launcher) launcher.events.on_booted { MediaListener.start if Setting.enable_media_listener? } launcher.events.on_stopped { MediaListener.stop } launcher.events.on_restart { MediaListener.stop } end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/lib/black_candy/version.rb
lib/black_candy/version.rb
# frozen_string_literal: true module BlackCandy module Version MAJOR = 3 MINOR = 1 PATCH = 0 PRE = "" class << self def to_s return "version: edge(#{commit_hash.first(7)})" if edge_release? "v#{version}" end def link return "https://github.com/blackcand...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/lib/black_candy/errors.rb
lib/black_candy/errors.rb
# frozen_string_literal: true module BlackCandy CustomError = Data.define(:type, :message) class BaseError < StandardError def type self.class.name.split("::").last end end class Forbidden < BaseError def message I18n.t("error.forbidden") end end class InvalidCredential < Bas...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/lib/black_candy/configurable.rb
lib/black_candy/configurable.rb
# frozen_string_literal: true module BlackCandy module Configurable def self.included(base) base.class_variable_set(:@@config, Config.new) base.extend ClassMethods end class Config class ValidationError < StandardError; end attr_accessor :validate_blocks def initialize ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false