source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20170729034302_fill_relative_number_for_episodes.rb
Ruby
apache-2.0
187
the-future
233
require 'update_in_batches' class FillRelativeNumberForEpisodes < ActiveRecord::Migration[4.2] using UpdateInBatches disable_ddl_transaction! def change Episode.all.update_in_batches('relative_number = number') end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20241124034122_add_held_reason_to_posts.rb
Ruby
apache-2.0
187
the-future
232
class AddHeldReasonToPosts < ActiveRecord::Migration[6.1] def change add_column :posts, :held_reason, :integer add_column :comments, :held_reason, :integer add_column :media_reactions, :held_reason, :integer end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20170529105358_create_media_reactions.rb
Ruby
apache-2.0
187
the-future
820
class CreateMediaReactions < ActiveRecord::Migration[4.2] def change create_table :media_reactions do |t| t.references :user, index: true, foreign_key: true, required: true t.references :media, null: false, polymorphic: true, required: true t.references :anime, index: true, foreign_key: true ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20170122224414_add_favorites_count_to_media.rb
Ruby
apache-2.0
187
the-future
311
class AddFavoritesCountToMedia < ActiveRecord::Migration[4.2] def change add_column :anime, :favorites_count, :integer, null: false, default: 0 add_column :manga, :favorites_count, :integer, null: false, default: 0 add_column :dramas, :favorites_count, :integer, null: false, default: 0 end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20161003165019_add_new_feeds_tables.rb
Ruby
apache-2.0
187
the-future
1,059
class AddNewFeedsTables < ActiveRecord::Migration[4.2] def change create_table :posts do |t| t.references :user, foreign_key: true, null: false t.references :target t.foreign_key :users, column: :target_id t.text :text, null: false t.text :text_formatted, null: false t.referenc...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20161012204844_create_marathons.rb
Ruby
apache-2.0
187
the-future
556
class CreateMarathons < ActiveRecord::Migration[4.2] def change create_table :marathons do |t| t.references :library_entry, foreign_key: true, null: false t.boolean :rewatch, null: false t.datetime :started_at t.datetime :ended_at t.timestamps null: false end create_table :m...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20170224234712_create_group_neighbors.rb
Ruby
apache-2.0
187
the-future
375
class CreateGroupNeighbors < ActiveRecord::Migration[4.2] def change create_table :group_neighbors do |t| t.references :source, index: true, null: false t.references :destination, index: true, null: false t.foreign_key :groups, column: 'source_id' t.foreign_key :groups, column: 'destinatio...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20170726230941_add_defaults_to_reactions_counter_cache.rb
Ruby
apache-2.0
187
the-future
216
class AddDefaultsToReactionsCounterCache < ActiveRecord::Migration[4.2] def change change_column_null :users, :media_reactions_count, false change_column_default :users, :media_reactions_count, 0 end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20151003032710_clean_users.rb
Ruby
apache-2.0
187
the-future
1,386
class CleanUsers < ActiveRecord::Migration[4.2] class User < ActiveRecord::Base; end def change # => Waifu Migration # Remove the waifu slug and name cache columns remove_column :users, :waifu_slug, :string remove_column :users, :waifu, :string # Rename the waifu_char_id column rename_colum...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20170302192915_create_group_bans.rb
Ruby
apache-2.0
187
the-future
387
class CreateGroupBans < ActiveRecord::Migration[4.2] def change create_table :group_bans do |t| t.references :group, index: true, foreign_key: true, null: false t.references :user, index: true, foreign_key: true, null: false t.references :moderator, null: false t.foreign_key :users, column...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20241103092248_create_ipasns.rb
Ruby
apache-2.0
187
the-future
345
class CreateIpasns < ActiveRecord::Migration[6.1] def change create_table :ip_asns, id: false do |t| t.inet :start_ip, null: false t.inet :end_ip, null: false t.integer :autonomous_system_number, null: false t.string :autonomous_system_organization, null: false t.index [:start_ip, :e...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20250518064210_make_bumped_at_on_posts_non_nullable.rb
Ruby
apache-2.0
187
the-future
213
class MakeBumpedAtOnPostsNonNullable < ActiveRecord::Migration[6.1] def change change_column_default :posts, :bumped_at, -> { 'CURRENT_TIMESTAMP' } change_column_null :posts, :bumped_at, false end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20180114070606_add_suggested_indexes.rb
Ruby
apache-2.0
187
the-future
426
class AddSuggestedIndexes < ActiveRecord::Migration[4.2] def change commit_db_transaction add_index :characters, [:slug], algorithm: :concurrently add_index :comments, [:user_id], algorithm: :concurrently add_index :library_events, [:library_entry_id], algorithm: :concurrently add_index :manga, [:...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
db/migrate/20170721021615_fill_default_hidden_on_group_members_and_follows.rb
Ruby
apache-2.0
187
the-future
421
require 'update_in_batches' class FillDefaultHiddenOnGroupMembersAndFollows < ActiveRecord::Migration[4.2] using UpdateInBatches disable_ddl_transaction! def change say_with_time 'Filling hidden column for Follow' do Follow.all.update_in_batches(hidden: false) end say_with_time 'Filling hidden...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/rails_helper.rb
Ruby
apache-2.0
187
the-future
1,012
ENV['RAILS_ENV'] ||= 'test' require_relative './support/coverage' # Load coverage stuff early require File.expand_path('../../config/environment', __FILE__) # Prevent database truncation if the environment is production abort('The Rails environment is in production mode!') if Rails.env.production? require 'spec_helper...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/spec_helper.rb
Ruby
apache-2.0
187
the-future
943
RSpec.configure do |config| # Expectations/assertions config.expect_with :rspec do |expectations| # Will be default in RSpec 4 expectations.include_chain_clauses_in_custom_matcher_descriptions = true end # Mocks config.mock_with :rspec do |mocks| # Will be default in RSpec 4 mocks.verify_part...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories_spec.rb
Ruby
apache-2.0
187
the-future
349
require 'rails_helper' RSpec.describe 'FactoryBot' do before(:all) do DatabaseCleaner.allow_remote_database_url = true DatabaseCleaner.start end after(:all) { DatabaseCleaner.clean } FactoryBot.factories.each do |factory| it "#{factory.name} should pass lint" do FactoryBot::Linter.new([facto...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/posts.rb
Ruby
apache-2.0
187
the-future
253
FactoryBot.define do factory :post do user content { Faker::Lorem.sentence } trait :locked do association :locked_by, factory: :user, strategy: :build locked_at { DateTime.now } locked_reason { :spam } end end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/pro_gifts.rb
Ruby
apache-2.0
187
the-future
214
FactoryBot.define do factory :pro_gift do association :from, factory: :user, strategy: :build association :to, factory: :user, strategy: :build message { Faker::Lorem.sentences(number: 1) } end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/media_attributes.rb
Ruby
apache-2.0
187
the-future
202
FactoryBot.define do factory :media_attribute do title { Faker::Name.name } high_title { Faker::Name.name } neutral_title { Faker::Name.name } low_title { Faker::Name.name } end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/genres.rb
Ruby
apache-2.0
187
the-future
201
FactoryBot.define do factory :genre do # TODO: switch to Faker::Book.genre when they make a new release name { Faker::Book.genre } description { { en: Faker::Lorem.sentence } } end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/library_entry_logs.rb
Ruby
apache-2.0
187
the-future
227
FactoryBot.define do factory :library_entry_log do association :linked_account, strategy: :build association :media, factory: :anime, strategy: :build action_performed { 'create' } sync_status { 0 } end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/pro_membership_plans.rb
Ruby
apache-2.0
187
the-future
358
FactoryBot.define do factory :pro_membership_plan do recurring { [true, false].sample } duration { 1 + rand(35) } amount { 500 + rand(9500) } name { Faker::App.name } factory :nonrecurring_pro_membership_plan do recurring { false } end factory :recurring_pro_membership_plan do ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/anime.rb
Ruby
apache-2.0
187
the-future
836
# frozen_string_literal: true FactoryBot.define do factory :anime do titles { { en_jp: Faker::Name.name } } canonical_title { 'en_jp' } average_rating { rand(1.0..100.0) } subtype { Anime.subtypes.keys.sample } age_rating { 'G' } episode_length { 24 } start_date { Faker::Date.backward(day...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/group_action_logs.rb
Ruby
apache-2.0
187
the-future
205
FactoryBot.define do factory :group_action_log do association :target, factory: :group_invite, strategy: :create association :group association :user verb { Faker::Lorem.word } end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/group_reports.rb
Ruby
apache-2.0
187
the-future
252
FactoryBot.define do factory :group_report do association :group, factory: :group, strategy: :build association :naughty, factory: :post, strategy: :build association :user, factory: :user, strategy: :build reason { :nsfw } end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/comments.rb
Ruby
apache-2.0
187
the-future
203
FactoryBot.define do factory :comment do association :user, factory: :user, strategy: :build association :post, factory: :post, strategy: :build content { Faker::Lorem.sentence } end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/videos.rb
Ruby
apache-2.0
187
the-future
253
FactoryBot.define do factory :video do url { Faker::Internet.url } association :episode, factory: :episode, strategy: :build association :streamer, factory: :streamer, strategy: :build sub_lang { 'en' } dub_lang { 'ja' } end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/library_events.rb
Ruby
apache-2.0
187
the-future
281
FactoryBot.define do factory :library_event do association :library_entry, strategy: :build association :user, strategy: :build kind { :updated } trait :with_anime do anime_id { 1 } end trait :with_manga do manga_id { 1 } end end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/media_attribute_votes.rb
Ruby
apache-2.0
187
the-future
223
FactoryBot.define do factory :media_attribute_vote do vote { 1 } user association :anime_media_attributes, factory: :anime_media_attribute, strategy: :create end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/anime_castings.rb
Ruby
apache-2.0
187
the-future
217
FactoryBot.define do factory :anime_casting do locale { 'en' } association :anime_character, factory: :anime_character, strategy: :build association :person, factory: :person, strategy: :build end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/profile_link_sites.rb
Ruby
apache-2.0
187
the-future
6,098
# frozen_string_literal: true FactoryBot.define do # rubocop:disable Layout/LineLength factory :profile_link_site do name { Faker::Company.name } validate_find { '\A(https?://)?(www.)?(twitter.com/)?(@)?(?<username>[a-zA-Z0-9_]+)\z' } validate_replace { 'https://twitter.com/\k<username>' } # Twitt...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/media_reactions.rb
Ruby
apache-2.0
187
the-future
355
FactoryBot.define do factory :media_reaction do reaction { Faker::Lorem.paragraph_by_chars(number: 140) } association :anime, factory: :anime, strategy: :build association :library_entry, factory: :library_entry, progress: 1, strategy: :build association :user, factory:...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/library_entries.rb
Ruby
apache-2.0
187
the-future
374
FactoryBot.define do factory :library_entry do association :media, factory: :anime association :user, strategy: :build status { 'planned' } progress { 0 } time_spent { progress * 24 } trait :nsfw do association :media, :nsfw, factory: :anime, strategy: :build end trait :with_rat...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/site_announcements.rb
Ruby
apache-2.0
187
the-future
292
FactoryBot.define do factory :site_announcement do association :user, strategy: :build title { Faker::Lorem.sentence(word_count: 5) } description { { en: Faker::Lorem.sentences(number: 2) } } image_url { Faker::LoremFlickr.image } link { Faker::Internet.url } end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/oauth_applications.rb
Ruby
apache-2.0
187
the-future
275
FactoryBot.define do factory :oauth_application, class: ::Doorkeeper::Application do name { Faker::Internet.username } redirect_uri { Faker::Internet.url(host: 'example.com').sub('http', 'https') } association :owner, factory: :user, strategy: :build end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/ama.rb
Ruby
apache-2.0
187
the-future
214
FactoryBot.define do factory :ama do start_date { Time.now } description { { en: Faker::Lorem.sentence } } association :author, factory: :user association :original_post, factory: :post end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/chapters.rb
Ruby
apache-2.0
187
the-future
438
FactoryBot.define do factory :chapter do association :manga, factory: :manga association :volume, factory: :volume titles { { en_jp: Faker::Name.name } } canonical_title { 'en_jp' } description { { en: Faker::Lorem.paragraph(sentence_count: 4) } } length { rand(20..60) } published { Faker:...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/pro_subscriptions.rb
Ruby
apache-2.0
187
the-future
238
FactoryBot.define do factory :pro_subscription do type { 'ProSubscription::StripeSubscription' } association :user, strategy: :build billing_id { 'test_customer_id' } tier { ProSubscription.tiers.keys.sample } end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/episodes.rb
Ruby
apache-2.0
187
the-future
501
FactoryBot.define do factory :episode do association :media, factory: :anime, strategy: :build titles { { en_jp: Faker::Name.name } } canonical_title { 'en_jp' } description { { en: Faker::Lorem.paragraph(sentence_count: 4) } } length { rand(20..60) } airdate { Faker::Date.between(from: 20.yea...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/group_ticket_messages.rb
Ruby
apache-2.0
187
the-future
210
FactoryBot.define do factory :group_ticket_message do association :ticket, strategy: :build, factory: :group_ticket association :user, strategy: :build content { Faker::Lorem.sentence } end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/dramas.rb
Ruby
apache-2.0
187
the-future
244
FactoryBot.define do factory :drama do titles { { en_jp: Faker::Name.name } } canonical_title { 'en_jp' } average_rating { rand(1.0..100.0) } age_rating { 'G' } trait :nsfw do age_rating { 'R18' } end end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/manga.rb
Ruby
apache-2.0
187
the-future
426
FactoryBot.define do factory :manga do titles { { en_jp: Faker::Name.name } } canonical_title { 'en_jp' } average_rating { rand(1.0..100.0) } start_date { Faker::Date.backward(days: 10_000) } trait :categories do transient do amount { 5 } end after(:create) do |manga, e...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/users.rb
Ruby
apache-2.0
187
the-future
657
FactoryBot.define do factory :user do name { Faker::Name.name[0..19] } email { Faker::Internet.email } password { Faker::Internet.password } trait :admin do permissions { [:admin] } end trait :banned do after(:create) { |user| user.add_role(:banned) } end trait :unregist...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/group_invites.rb
Ruby
apache-2.0
187
the-future
244
FactoryBot.define do factory :group_invite do before(:create) do |_invite, evaluator| Follow.create!(follower: evaluator.user, followed: evaluator.sender) end group user association :sender, factory: :user end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/factories/reviews.rb
Ruby
apache-2.0
187
the-future
310
FactoryBot.define do factory :review do content { Faker::Lorem.paragraphs(number: 2) } association :library_entry, factory: :library_entry, rating: 3.0, strategy: :build association :user, factory: :user, strategy: :build association :media, factory: :anime, strategy: :build end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/actions/accounts/send_confirmation_email_spec.rb
Ruby
apache-2.0
187
the-future
998
require 'rails_helper' RSpec.describe Accounts::SendConfirmationEmail do let!(:user) { create(:user) } it 'should send an email to the user' do expect { described_class.call(user: user) }.to(change { ActionMailer::Base.deliveries.size }.by(1)) email = ActionMailer::Base.deliveries.last exp...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/actions/accounts/prevalidate_email_spec.rb
Ruby
apache-2.0
187
the-future
1,111
require 'rails_helper' RSpec.describe Accounts::PrevalidateEmail do before { stub_const('Accounts::PrevalidateEmail::API_KEY', 'fake-api-key') } context 'when the server times out' do before { stub_request(:any, /api\.emailable\.com/).to_timeout } it 'should return the default unknown response' do ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/actions/accounts/generate_nolt_token_spec.rb
Ruby
apache-2.0
187
the-future
853
require 'rails_helper' RSpec.describe Accounts::GenerateNoltToken do let!(:user) { create(:user, :with_avatar) } it 'should correctly sign the JWT' do stub_const('Accounts::GenerateNoltToken::NOLT_SSO_SECRET', 'boo') token = described_class.call(user: user).token expect { JWT.decode(token, 'boo...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/actions/pro/validate_gift_spec.rb
Ruby
apache-2.0
187
the-future
1,447
require 'rails_helper' RSpec.describe Pro::ValidateGift do let(:alice) { build(:user) } let(:bob) { build(:user) } context 'when sending to yourself' do it 'should raise ProError::InvalidSelfGift' do expect { Pro::ValidateGift.call( from: alice, to: alice, tier: '...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/actions/pro/subscribe_with_stripe_spec.rb
Ruby
apache-2.0
187
the-future
1,751
require 'rails_helper' RSpec.describe Pro::SubscribeWithStripe do let(:user) { create(:user) } let(:stripe_mock) { StripeMock.create_test_helper } let(:token) { stripe_mock.generate_card_token } let!(:product) { stripe_mock.create_product(name: 'Pro Yearly') } before { stripe_mock.create_plan(id: 'pro-yearl...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/actions/billing/stripe_charge_spec.rb
Ruby
apache-2.0
187
the-future
708
require 'rails_helper' RSpec.describe Billing::StripeCharge do let(:stripe_mock) { StripeMock.create_test_helper } it 'should cast the amount from BigDecimal to integer cents' do action = Billing::StripeCharge.new(amount: BigDecimal('4.20')) expect(action.amount).to equal(420) end describe '#call' do...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/actions/billing/update_stripe_source_spec.rb
Ruby
apache-2.0
187
the-future
735
require 'rails_helper' RSpec.describe Billing::UpdateStripeSource do let(:user) { create(:user) } let(:stripe_mock) { StripeMock.create_test_helper } it 'should change the default payment method for the user' do token = stripe_mock.generate_card_token expect { Billing::UpdateStripeSource.call(use...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/concerns/fancy_mutation_spec.rb
Ruby
apache-2.0
187
the-future
15,463
# frozen_string_literal: true RSpec.describe FancyMutation do it 'does not expose the private class methods' do mutation = Class.new { include FancyMutation }.new expect(mutation).not_to respond_to(:errors_union) expect(mutation).not_to respond_to(:warnings_union) expect(mutation).not_to respond_to(...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/analysis/max_node_limit_spec.rb
Ruby
apache-2.0
187
the-future
5,568
# frozen_string_literal: true require 'rails_helper' RSpec.describe Analysis::MaxNodeLimit do let!(:user) { create(:user) } let(:schema) { KitsuSchema } let(:reduce_result) { GraphQL::Analysis::AST.analyze_query(query, [Analysis::MaxNodeLimit]) } let(:reduce_multiplex_result) do GraphQL::Analysis::AST.ana...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/library_entry_spec.rb
Ruby
apache-2.0
187
the-future
2,685
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'mutation libraryEntry' do let(:media) { create(:anime) } let(:user) { create(:user) } let(:token) { token_for(user) } let(:context) { { token: token, user: user } } it 'create' do query = <<~GRAPHQL mutation createLibraryEntry($...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/profile_link/delete_spec.rb
Ruby
apache-2.0
187
the-future
1,567
# frozen_string_literal: true RSpec.describe Mutations::ProfileLink::Delete do include_context 'with authenticated user' include_context 'with graphql helpers' before do SeedFile.new(Rails.root.join('db/seeds/profile_link_sites.yml')).import! end let!(:profile_link_site) { ProfileLinkSite.find(1) } l...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/profile_link/update_spec.rb
Ruby
apache-2.0
187
the-future
2,497
# frozen_string_literal: true RSpec.describe Mutations::ProfileLink::Update do include_context 'with authenticated user' include_context 'with graphql helpers' before do SeedFile.new(Rails.root.join('db/seeds/profile_link_sites.yml')).import! end let!(:profile_link_site) { ProfileLinkSite.find(8) } l...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/profile_link/create_spec.rb
Ruby
apache-2.0
187
the-future
2,745
# frozen_string_literal: true RSpec.describe Mutations::ProfileLink::Create do include_context 'with authenticated user' include_context 'with graphql helpers' before do SeedFile.new(Rails.root.join('db/seeds/profile_link_sites.yml')).import! end query = <<~GRAPHQL mutation createProfileLink($input...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/profile/update_spec.rb
Ruby
apache-2.0
187
the-future
2,868
# frozen_string_literal: true RSpec.describe Mutations::Profile::Update do include_context 'with authenticated user' include_context 'with graphql helpers' let(:mod) { create(:user, permissions: %i[community_mod]) } query = <<~GRAPHQL mutation profileUpdateMutation($input: ProfileUpdateInput!) { pr...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/comment/delete_spec.rb
Ruby
apache-2.0
187
the-future
1,900
# frozen_string_literal: true RSpec.describe Mutations::Comment::Delete do include_context 'with authenticated user' include_context 'with graphql helpers' query = <<~GRAPHQL mutation commentDeleteMutation($input: CommentDeleteInput!) { comment { delete(input: $input) { errors { ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/comment/create_spec.rb
Ruby
apache-2.0
187
the-future
1,983
# frozen_string_literal: true RSpec.describe Mutations::Comment::Create do include_context 'with authenticated user' include_context 'with graphql helpers' let(:post) { create(:post) } query = <<~GRAPHQL mutation commentCreateMutation($input: CommentCreateInput!) { comment { create(input: $...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/comment/unhold_spec.rb
Ruby
apache-2.0
187
the-future
1,629
# frozen_string_literal: true RSpec.describe Mutations::Comment::Unhold do include_context 'with authenticated user' include_context 'with graphql helpers' query = <<~GRAPHQL mutation commentUnholdMutation($input: CommentUnholdInput!) { comment { unhold(input: $input) { errors { ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/favorite/create_spec.rb
Ruby
apache-2.0
187
the-future
1,919
# frozen_string_literal: true RSpec.describe Mutations::Favorite::Create do include_context 'with authenticated user' include_context 'with graphql helpers' let!(:media) { create(:manga) } query = <<~GRAPHQL mutation createFavoriteMutation($input: FavoriteCreateInput!){ favorite { create(in...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/favorite/delete_spec.rb
Ruby
apache-2.0
187
the-future
2,267
# frozen_string_literal: true RSpec.describe Mutations::Favorite::Delete do include_context 'with authenticated user' include_context 'with graphql helpers' let!(:media) { create(:anime) } let!(:favorite) { create(:favorite, item: media, user:) } query = <<~GRAPHQL mutation deleteFavoriteMutation($favo...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/block/create_spec.rb
Ruby
apache-2.0
187
the-future
1,825
# frozen_string_literal: true RSpec.describe Mutations::Block::Create do include_context 'with authenticated user' include_context 'with graphql helpers' let!(:blocked_user) { create(:user) } query = <<~GRAPHQL mutation createBlockMutation($blockedId: ID!){ block { create(input: {blockedId:...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/block/delete_spec.rb
Ruby
apache-2.0
187
the-future
2,835
# frozen_string_literal: true RSpec.describe Mutations::Block::Delete do include_context 'with authenticated user' include_context 'with graphql helpers' let!(:blocked_user) { create(:user) } let!(:block) { create(:block, user:, blocked: blocked_user) } query = <<~GRAPHQL mutation deleteBlockMutation($...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/media_reaction/unlike_spec.rb
Ruby
apache-2.0
187
the-future
2,560
# frozen_string_literal: true RSpec.describe Mutations::MediaReaction::Unlike do include_context 'with authenticated user' include_context 'with graphql helpers' let(:media) { create(:anime) } let(:media_reaction) { create(:media_reaction) } query = <<~GRAPHQL mutation unlikeMediaReaction($mediaReactio...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/media_reaction/like_spec.rb
Ruby
apache-2.0
187
the-future
3,543
# frozen_string_literal: true RSpec.describe Mutations::MediaReaction::Like do include_context 'with authenticated user' include_context 'with graphql helpers' let(:media) { create(:anime) } let(:media_reaction) { create(:media_reaction) } query = <<~GRAPHQL mutation likeMediaReaction($mediaReactionId:...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/media_reaction/create_spec.rb
Ruby
apache-2.0
187
the-future
2,624
# frozen_string_literal: true RSpec.describe Mutations::MediaReaction::Create do include_context 'with authenticated user' include_context 'with graphql helpers' let(:media) { create(:anime) } let!(:library_entry) { create(:library_entry, user:, media:) } query = <<~GRAPHQL mutation createMediaReaction...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/media_reaction/delete_spec.rb
Ruby
apache-2.0
187
the-future
1,853
# frozen_string_literal: true RSpec.describe Mutations::MediaReaction::Delete do include_context 'with authenticated user' include_context 'with graphql helpers' let!(:reaction) { create(:media_reaction, user:) } query = <<~GRAPHQL mutation deleteMediaReaction($mediaReactionId: ID!) { mediaReaction...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/account/change_password_spec.rb
Ruby
apache-2.0
187
the-future
2,154
# frozen_string_literal: true RSpec.describe Mutations::Account::ChangePassword do include_context 'with authenticated user' include_context 'with graphql helpers' let(:user) { create(:user, password: 'correct horse battery staple') } query = <<~GRAPHQL mutation changePassword($input: AccountChangePasswo...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/mutations/account/update_spec.rb
Ruby
apache-2.0
187
the-future
1,199
# frozen_string_literal: true RSpec.describe Mutations::Account::Update do include_context 'with authenticated user' include_context 'with graphql helpers' query = <<~GRAPHQL mutation accountUpdateMutation($input: AccountUpdateInput!) { account { update(input: $input){ errors { ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/queries/profile_posts_spec.rb
Ruby
apache-2.0
187
the-future
3,491
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'query loadProfilePosts' do let(:media) { create(:anime) } let(:user) { create(:user) } let(:token) { token_for(user) } let(:context) { { token: token, user: user } } it 'should work' do query = <<~GRAPHQL fragment userFields on ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/directives/site_permission_spec.rb
Ruby
apache-2.0
187
the-future
7,444
# frozen_string_literal: true RSpec.describe Directives::SitePermission do let(:query_type) do Class.new(GraphQL::Schema::Object) do graphql_name 'Query' field :always_present, String, null: false end end let(:schema) do Class.new(GraphQL::Schema) do use GraphQL::Schema::Visibilit...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/loaders/slug_loader_spec.rb
Ruby
apache-2.0
187
the-future
2,312
# frozen_string_literal: true require 'rails_helper' RSpec.describe Loaders::SlugLoader do context 'with an uppercase slug' do let!(:anime) { create(:anime, slug: 'ANIME-TEST') } it 'should find with a lowercase slug' do slug = GraphQL::Batch.batch do Loaders::SlugLoader.for(Anime).load('anim...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/graphql/loaders/library_entries_loader_spec.rb
Ruby
apache-2.0
187
the-future
3,531
# frozen_string_literal: true require 'rspec' RSpec.describe Loaders::LibraryEntriesLoader do describe 'sorting by title' do let(:user) { create(:user) } let(:context) do GraphQL::Query::Context.new(query: OpenStruct.new(schema: KitsuSchema), values: nil) end let(:anime) do [ cre...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/pipelines/html_filters/hashtags_filter_spec.rb
Ruby
apache-2.0
187
the-future
23,577
# frozen_string_literal: true require 'rails_helper' # The following example specs are reproduced from the twitter/tweet-text library, which is licensed # under the Apache 2.0 license. They have been modified to be usable in RSpec and match our # formatting, but are otherwise largely intact. The original examples c...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/pipelines/html_filters/kitsu_mention_filter_spec.rb
Ruby
apache-2.0
187
the-future
1,813
# encoding: utf-8 require 'rails_helper' RSpec.describe HTMLFilters::KitsuMentionFilter do def call(text) described_class.new(text).call.to_s end it 'should not do anything fancy for @mention mentions' do filter = described_class.new('@mention') expect(filter.call.to_s).not_to include('<a') end ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/feeds/site_announcements_feed_spec.rb
Ruby
apache-2.0
187
the-future
336
require 'rails_helper' RSpec.describe SiteAnnouncementsFeed, type: :model do describe '#setup!' do it 'should make the feed follow the global' do feed = described_class.new('5554') expect(feed).to receive(:follow).with(SiteAnnouncementsGlobalFeed.new, scrollback: 1) .once feed.setup! ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/google_play_notification_service_spec.rb
Ruby
apache-2.0
187
the-future
1,685
require 'rails_helper' RSpec.describe GooglePlayNotificationService do context 'with a renewal' do let(:notif) do { 'message' => { 'data' => 'eyJ2ZXJzaW9uIjoiMS4wIiwicGFja2FnZU5hbWUiOiJjb20uZXZlcmZveC5hbmltZXRyYWNrZXJhbmRyb2lkIiwiZXZlbnRUaW1lTWlsbGlzIjoiMTUwMzM0OTU2NjE2OCIsInN1YnNjcmlwdGl...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/pro_renewal_service_spec.rb
Ruby
apache-2.0
187
the-future
1,129
require 'rails_helper' RSpec.describe ProRenewalService do describe '#renew_for' do context 'within the 24-hour grace period' do let(:user) { create(:user, pro_expires_at: 6.hours.ago, pro_started_at: 2.years.ago) } subject { ProRenewalService.new(user) } it 'should maintain the existing strea...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/typesense_key_service_spec.rb
Ruby
apache-2.0
187
the-future
1,001
# frozen_string_literal: true RSpec.describe TypesenseKeyService do let(:index) do TypesenseAnimeIndex.tap do |index| allow(index).to receive(:search_key).and_return('xyz') end end let(:model) do double(typesense_index: index) end let(:scope) do Class.new(ApplicationPolicy::Typesensua...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/apple_receipt_service_spec.rb
Ruby
apache-2.0
187
the-future
1,442
require 'rails_helper' RSpec.describe AppleReceiptService do include_context 'Stubbed Apple Receipt Verification' it 'should raise an exception if the verification response status is nonzero' do stub_receipt_verification(status: 21100) # rubocop:disable Style/NumericLiterals expect { subject }.to raise_ex...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/group_unread_fanout_service_spec.rb
Ruby
apache-2.0
187
the-future
386
require 'rails_helper' RSpec.describe GroupUnreadFanoutService do describe '#run!' do it 'should increment unread_count on the members' do member = create(:group_member) group = member.group source_user = create(:user) expect { described_class.new(group, source_user).run! }...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/stripe_renewal_service_spec.rb
Ruby
apache-2.0
187
the-future
860
require 'rails_helper' RSpec.describe StripeRenewalService do let(:stripe_mock) { StripeMock.create_test_helper } let!(:product) { stripe_mock.create_product(name: 'Pro Yearly') } before { stripe_mock.create_plan(id: 'pro-yearly', product: product.id) } it "updates the user's pro subscription for the period ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/wordfilter_service_spec.rb
Ruby
apache-2.0
187
the-future
2,693
require 'rails_helper' RSpec.describe WordfilterService do context 'with only a reject wordfilter' do before do create(:wordfilter, action: :reject, pattern: 'test', locations: %i[post]) end let(:service) { described_class.new(:post, 'this is a test post') } describe '#reject?' do it('r...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/media_activity_service_spec.rb
Ruby
apache-2.0
187
the-future
818
# frozen_string_literal: true require 'rails_helper' RSpec.describe MediaActivityService do subject { described_class.new(library_entry) } let(:library_entry) { build(:library_entry, user: create(:user)) } describe '#status' do it 'returns an activity for the user\'s feed' do expect(subject.status('...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/list_sync/my_anime_list/library_updater_spec.rb
Ruby
apache-2.0
187
the-future
2,298
require 'rails_helper' RSpec.describe ListSync::MyAnimeList::LibraryUpdater do let(:agent) { Mechanize.new } let(:mapping) { OpenStruct.new(external_id: '123') } let(:library_entry) do create(:library_entry, media: media, rating: 9, started_at: 5.days.ago, finished_at: 2.hours.ago)...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/list_sync/my_anime_list/login_spec.rb
Ruby
apache-2.0
187
the-future
1,311
require 'rails_helper' RSpec.describe ListSync::MyAnimeList::Login do let(:agent) { Mechanize.new } subject { described_class.new(agent, 'user', 'pass') } before do stub_request(:get, 'https://myanimelist.net/login.php') .to_return(fixture('my_anime_list/sync/login.html')) stub_request(:get, 'http...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/list_sync/my_anime_list/library_remover_spec.rb
Ruby
apache-2.0
187
the-future
1,668
require 'rails_helper' RSpec.describe ListSync::MyAnimeList::LibraryRemover do let(:agent) { Mechanize.new } let(:mapping) { OpenStruct.new(external_id: '123') } subject { described_class.new(agent, media) } before do allow(media).to receive(:mapping_for).and_return(mapping) end describe '#run!' do ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/list_sync/my_anime_list/xml_generator/row_spec.rb
Ruby
apache-2.0
187
the-future
3,224
require 'rails_helper' RSpec.describe ListSync::MyAnimeList::XMLGenerator::Row do subject { described_class.new(library_entry) } let(:library_entry) { build(:library_entry, anime: media, media: media) } let(:media) { build(:anime) } describe '#to_xml' do subject { Nokogiri::XML(described_class.new(library...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/apple_receipt_service/error_spec.rb
Ruby
apache-2.0
187
the-future
2,284
require 'rails_helper' RSpec.describe AppleReceiptService::Error do describe '#for_code' do it 'should return InvalidJSON for 21000' do expect(AppleReceiptService::Error.for_code(21_000)).to eq( AppleReceiptService::Error::InvalidJSON ) end it 'should return MalformedReceipt for 21002...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/youtube_service/client_spec.rb
Ruby
apache-2.0
187
the-future
1,747
require 'rails_helper' RSpec.describe YoutubeService::Client do let(:api_key) { 'API_KEY' } let(:token) { 'TOKEN' } subject { described_class.new(token, api_key: api_key) } describe '#valid?' do context 'when aud matches key' do before do stub_request(:get, YoutubeService::Client::VERIFY_UR...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/youtube_service/notification_entry_spec.rb
Ruby
apache-2.0
187
the-future
1,474
require 'rails_helper' RSpec.describe YoutubeService::NotificationEntry do let(:notification) do Nokogiri::XML.parse(fixture('youtube_service/notification.xml')) end let(:entry) { notification.at_xpath('//xmlns:entry') } subject { YoutubeService::NotificationEntry.new(entry) } describe '#channel_id' do ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/youtube_service/notification_spec.rb
Ruby
apache-2.0
187
the-future
1,006
require 'rails_helper' RSpec.describe YoutubeService::Notification do let(:user) { build(:user) } let(:xml) { fixture('youtube_service/notification.xml') } subject { YoutubeService::Notification.new(xml) } describe '#post!' do it 'should run #post! on each entry' do entry = instance_double('YoutubeS...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/services/youtube_service/subscription_spec.rb
Ruby
apache-2.0
187
the-future
2,364
require 'rails_helper' RSpec.describe YoutubeService::Subscription do before do stub_request(:post, YoutubeService::Subscription::SUBSCRIBE_URL) .with(body: hash_including( 'hub.callback', 'hub.topic', 'hub.mode', 'hub.secret' )) .to_return(status: 200) linked_account_class = double...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/comment_like_spec.rb
Ruby
apache-2.0
187
the-future
595
require 'rails_helper' RSpec.describe CommentLike, type: :model do it { should belong_to(:user).required } it { should belong_to(:comment).counter_cache(:likes_count).required } context 'which is on AMA that is closed' do it 'should not be valid' do post = create(:post) ama = create(:ama, origin...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/block_spec.rb
Ruby
apache-2.0
187
the-future
1,201
require 'rails_helper' RSpec.describe Block, type: :model do it { should belong_to(:user).required } it { should belong_to(:blocked).class_name('User').required } describe '.between' do it 'returns a block from user_a against user_b' do user_a, user_b = create_list(:user, 2) described_class.crea...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/community_recommendation_follow_spec.rb
Ruby
apache-2.0
187
the-future
257
require 'rails_helper' RSpec.describe CommunityRecommendationFollow, type: :model do subject { build(:community_recommendation_follow) } it { should belong_to(:community_recommendation_request).required } it { should belong_to(:user).required } end