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
spec/models/post_spec.rb
Ruby
apache-2.0
187
the-future
3,577
require 'rails_helper' RSpec.describe Post, type: :model do subject { build(:post) } it { should belong_to(:user).required } it { should belong_to(:target_user).class_name('User').optional } it { should belong_to(:media).optional } it { should belong_to(:spoiled_unit).optional } it { should belong_to(:loc...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/group_report_spec.rb
Ruby
apache-2.0
187
the-future
629
require 'rails_helper' RSpec.describe GroupReport, type: :model do subject { build(:group_report) } it { should define_enum_for(:reason) } it { should define_enum_for(:status) } it { should belong_to(:group).required } it { should belong_to(:naughty).required } it { should belong_to(:user).required } it...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/anime_spec.rb
Ruby
apache-2.0
187
the-future
2,294
require 'rails_helper' RSpec.describe Anime, type: :model do subject { build(:anime) } include_examples 'media' include_examples 'episodic' include_examples 'age_ratings' it { should have_many(:anime_characters).dependent(:destroy) } it { should have_many(:anime_staff).dependent(:destroy) } it { should...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/group_invite_spec.rb
Ruby
apache-2.0
187
the-future
727
require 'rails_helper' RSpec.describe GroupInvite, type: :model do it { should belong_to(:group).required } it { should belong_to(:user).required } it { should belong_to(:sender).class_name('User').required } it 'should limit to one active invite per user per group' do invite = create(:group_invite) s...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/profile_link_spec.rb
Ruby
apache-2.0
187
the-future
213
require 'rails_helper' RSpec.describe ProfileLink, type: :model do it { should belong_to(:user).required } it { should belong_to(:profile_link_site).required } it { should validate_presence_of(:url) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/follow_spec.rb
Ruby
apache-2.0
187
the-future
1,603
require 'rails_helper' RSpec.describe Follow, type: :model do let(:user_follower) { create(:user) } let(:user_followed) { create(:user) } let(:timeline) { double(:feed).as_null_object } before do allow(subject.follower).to receive(:timeline).and_return(timeline) end subject { build(:follow, follower:...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/anime_staff_spec.rb
Ruby
apache-2.0
187
the-future
216
require 'rails_helper' RSpec.describe AnimeStaff, type: :model do it { should belong_to(:anime).required } it { should belong_to(:person).required } it { should validate_length_of(:role).is_at_most(140) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/quote_spec.rb
Ruby
apache-2.0
187
the-future
259
require 'rails_helper' RSpec.describe Quote, type: :model do subject { build(:quote) } it { should belong_to(:user).counter_cache(true).required } it { should belong_to(:media).required } it { should have_many(:likes).class_name('QuoteLike') } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/mapping_spec.rb
Ruby
apache-2.0
187
the-future
1,038
require 'rails_helper' RSpec.describe Mapping, type: :model do subject { build(:mapping) } it { should belong_to(:item).required } it { should validate_presence_of(:external_site) } it { should validate_presence_of(:external_id) } it do expect(subject).to validate_uniqueness_of(:item_id) .scoped_to...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/manga_staff_spec.rb
Ruby
apache-2.0
187
the-future
216
require 'rails_helper' RSpec.describe MangaStaff, type: :model do it { should belong_to(:manga).required } it { should belong_to(:person).required } it { should validate_length_of(:role).is_at_most(140) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/library_entry_log_spec.rb
Ruby
apache-2.0
187
the-future
235
require 'rails_helper' RSpec.describe LibraryEntryLog, type: :model do it { should belong_to(:linked_account).required } it { should validate_presence_of(:action_performed) } it { should validate_presence_of(:sync_status) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/wiki_submission_spec.rb
Ruby
apache-2.0
187
the-future
511
require 'rails_helper' RSpec.describe WikiSubmission, type: :model do it { is_expected.to belong_to(:user).required } it { is_expected.to have_many(:logs).class_name('WikiSubmissionLog').dependent(:destroy) } it { is_expected.to belong_to(:parent).inverse_of(:child).class_name('WikiSubmission').optional } it ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/feed_spec.rb
Ruby
apache-2.0
187
the-future
2,798
require 'rails_helper' RSpec.describe Feed, type: :model do subject do Class.new(Feed) do def default_target ['test', id] end alias_method :write_target, :default_target alias_method :read_target, :default_target end end let(:feed) { subject.new('1') } let(:read_feed) { ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/anime_character_spec.rb
Ruby
apache-2.0
187
the-future
204
require 'rails_helper' RSpec.describe AnimeCharacter, type: :model do it { should belong_to(:anime).required } it { should belong_to(:character).required } it { should define_enum_for(:role) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/category_favorite_spec.rb
Ruby
apache-2.0
187
the-future
206
require 'rails_helper' RSpec.describe CategoryFavorite, type: :model do subject { build(:category_favorite) } it { should belong_to(:user).required } it { should belong_to(:category).required } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/person_spec.rb
Ruby
apache-2.0
187
the-future
274
require 'rails_helper' RSpec.describe Person, type: :model do it { should have_many(:castings) } it { should have_many(:anime_castings).dependent(:destroy) } it { should have_many(:drama_castings).dependent(:destroy) } it { should validate_presence_of(:name) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/user_spec.rb
Ruby
apache-2.0
187
the-future
7,312
# frozen_string_literal: true require 'rails_helper' RSpec.describe User, type: :model do subject { build(:user) } let(:persisted_user) { create(:user) } it { is_expected.to have_db_index(:facebook_id) } it { is_expected.to belong_to(:waifu).optional } it { is_expected.to have_many(:linked_accounts) } i...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/group_neighbor_spec.rb
Ruby
apache-2.0
187
the-future
249
require 'rails_helper' RSpec.describe GroupNeighbor, type: :model do it do should belong_to(:source).class_name('Group').counter_cache('neighbors_count').required end it { should belong_to(:destination).class_name('Group').required } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/group_action_log_spec.rb
Ruby
apache-2.0
187
the-future
248
require 'rails_helper' RSpec.describe GroupActionLog, type: :model do it { should belong_to(:target).required } it { should belong_to(:group).required } it { should belong_to(:user).required } it { should validate_presence_of(:verb) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/media_attribute_vote_spec.rb
Ruby
apache-2.0
187
the-future
346
require 'rails_helper' RSpec.describe MediaAttributeVote, type: :model do subject { build(:media_attribute_vote) } it { should belong_to(:user).required } it { should belong_to(:anime_media_attributes).optional } it { should belong_to(:dramas_media_attributes).optional } it { should belong_to(:manga_media_a...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/pro_gift_spec.rb
Ruby
apache-2.0
187
the-future
249
require 'rails_helper' RSpec.describe ProGift, type: :model do it { should belong_to(:from).class_name('User').required } it { should belong_to(:to).class_name('User').required } it { should validate_length_of(:message).is_at_most(500) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/post_follow_spec.rb
Ruby
apache-2.0
187
the-future
611
require 'rails_helper' RSpec.describe PostFollow, type: :model do subject { build(:post_follow) } it { should belong_to(:post).required } it { should belong_to(:user).required } it { should validate_uniqueness_of(:post).scoped_to(:user_id) } context 'which is on AMA that is closed' do it 'should not be...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/group_member_spec.rb
Ruby
apache-2.0
187
the-future
761
require 'rails_helper' RSpec.describe GroupMember, type: :model do subject { build(:group_member) } it { should belong_to(:user).required } it { should belong_to(:group).counter_cache('members_count').required } it { should have_many(:permissions).dependent(:destroy) } it { should have_many(:notes).dependen...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/media_attribute_spec.rb
Ruby
apache-2.0
187
the-future
216
require 'rails_helper' RSpec.describe MediaAttribute, type: :model do subject { build(:media_attribute) } it { should have_many(:anime) } it { should have_many(:manga) } it { should have_many(:drama) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/media_ignore_spec.rb
Ruby
apache-2.0
187
the-future
215
require 'rails_helper' RSpec.describe MediaIgnore, type: :model do it { should validate_presence_of(:media).with_message('must exist') } it { should validate_presence_of(:user).with_message('must exist') } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/group_spec.rb
Ruby
apache-2.0
187
the-future
1,342
require 'rails_helper' RSpec.describe Group, type: :model do subject { build(:group) } it { should validate_presence_of(:name) } it { should validate_length_of(:name).is_at_least(3).is_at_most(50) } it { should define_enum_for(:privacy) } it do should have_many(:members).class_name('GroupMember').depend...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/pro_membership_plan_spec.rb
Ruby
apache-2.0
187
the-future
762
require 'rails_helper' RSpec.describe ProMembershipPlan, type: :model do before do 10.times do create(:nonrecurring_pro_membership_plan) end 5.times do create(:recurring_pro_membership_plan) end end describe 'recurring scope' do it 'should not include any nonrecurring plans' do ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/profile_link_site_spec.rb
Ruby
apache-2.0
187
the-future
18,652
require 'rails_helper' RSpec.describe ProfileLinkSite, type: :model do it { should validate_presence_of(:name) } it { should validate_presence_of(:validate_replace) } context 'validate profile_link url' do # Twitter describe 'Twitter' do context 'success' do it 'should return a username' d...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/media_reaction_vote_spec.rb
Ruby
apache-2.0
187
the-future
215
require 'rails_helper' RSpec.describe MediaReactionVote, type: :model do subject { build(:media_reaction_vote) } it { should belong_to(:media_reaction).required } it { should belong_to(:user).required } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/manga_character_spec.rb
Ruby
apache-2.0
187
the-future
204
require 'rails_helper' RSpec.describe MangaCharacter, type: :model do it { should belong_to(:manga).required } it { should belong_to(:character).required } it { should define_enum_for(:role) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/wordfilter_spec.rb
Ruby
apache-2.0
187
the-future
2,639
require 'rails_helper' RSpec.describe Wordfilter do it { is_expected.to validate_presence_of(:pattern) } describe '.matching(text)' do context 'when regex_enabled = true' do it 'matches like a regular expression' do filter = create(:wordfilter, pattern: 'fee+t', regex_enabled: true) exp...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/stat_spec.rb
Ruby
apache-2.0
187
the-future
1,270
require 'rails_helper' RSpec.describe Stat, type: :model do subject { build(:stat) } it { should belong_to(:user).required } it { should validate_presence_of(:type) } it { should validate_uniqueness_of(:type).scoped_to(:user_id) } class TestStat < Stat attr_reader :recalculated def recalculate! ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/linked_account_spec.rb
Ruby
apache-2.0
187
the-future
298
require 'rails_helper' RSpec.describe LinkedAccount, type: :model do subject { described_class.new } it { should belong_to(:user).required } it { should have_many(:library_entry_logs) } it { should validate_presence_of(:external_user_id) } it { should validate_presence_of(:type) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/drama_casting_spec.rb
Ruby
apache-2.0
187
the-future
357
require 'rails_helper' RSpec.describe DramaCasting, type: :model do it { should belong_to(:drama_character).required } it { should belong_to(:person).required } it { should belong_to(:licensor).class_name('Producer').optional } it { should validate_length_of(:locale).is_at_most(20) } it { should validate_len...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/pro_subscription_spec.rb
Ruby
apache-2.0
187
the-future
212
require 'rails_helper' RSpec.describe ProSubscription, type: :model do it { should belong_to(:user).required } it { should validate_presence_of(:type) } it { should validate_presence_of(:billing_id) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/library_entry_spec.rb
Ruby
apache-2.0
187
the-future
5,711
require 'rails_helper' RSpec.describe LibraryEntry, type: :model do let(:anime) { create(:anime, episode_count: 5) } subject { build(:library_entry) } it { should validate_presence_of(:user) } it { should validate_presence_of(:media) } it { should validate_presence_of(:status) } it { should validate_prese...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/anime_casting_spec.rb
Ruby
apache-2.0
187
the-future
313
require 'rails_helper' RSpec.describe AnimeCasting, type: :model do it { should belong_to(:anime_character).required } it { should belong_to(:licensor).class_name('Producer').optional } it { should validate_length_of(:locale).is_at_most(20) } it { should validate_length_of(:notes).is_at_most(140) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/library_event_spec.rb
Ruby
apache-2.0
187
the-future
346
require 'rails_helper' RSpec.describe LibraryEvent, type: :model do subject { described_class.new } it { should belong_to(:library_entry).required } it { should belong_to(:user).required } it { should validate_presence_of(:kind) } it { should define_enum_for(:kind).with_values(%i[progressed updated reacte...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/list_import_spec.rb
Ruby
apache-2.0
187
the-future
2,015
require 'rails_helper' RSpec.describe ListImport do class FakeImport < ListImport def each media = FactoryBot.create_list(:anime, 10) 100.times do |i| yield media[i], status: :current, progress: 1 end end def count 10 end def valid?(*) true end end ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/post_like_spec.rb
Ruby
apache-2.0
187
the-future
621
require 'rails_helper' RSpec.describe PostLike, type: :model do subject { build(:post_like) } it { should belong_to(:post).counter_cache(true).required } it { should belong_to(:user).required } it { should validate_uniqueness_of(:post).scoped_to(:user_id) } context 'which is on AMA that is closed' do i...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/comment_spec.rb
Ruby
apache-2.0
187
the-future
1,718
require 'rails_helper' RSpec.describe Comment, type: :model do it { should belong_to(:post).counter_cache(true).required } it { should belong_to(:parent).class_name('Comment') .counter_cache('replies_count').optional } it { should belong_to(:user).required } it { should have_...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/media_reaction_spec.rb
Ruby
apache-2.0
187
the-future
319
require 'rails_helper' RSpec.describe MediaReaction, type: :model do subject { build(:media_reaction) } it { should belong_to(:user).required } it { should belong_to(:library_entry).required } it { should validate_length_of(:reaction).is_at_most(140) } it { should_not allow_value('').for(:reaction) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/titles_list_spec.rb
Ruby
apache-2.0
187
the-future
4,395
# frozen_string_literal: true RSpec.describe TitlesList do describe '#canonical_locale' do it 'returns whatever is set in the record' do expect(described_class.new( titles: {}, canonical_locale: 'en' ).canonical_locale).to eq('en') end end describe '#canonical' do it 'ret...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/report_spec.rb
Ruby
apache-2.0
187
the-future
673
require 'rails_helper' RSpec.describe Report, type: :model do subject { build(:report) } it { should define_enum_for(:reason).with_values(%i[nsfw offensive spoiler bullying other spam]) } it { should define_enum_for(:status).with_values(%i[reported resolved declined]) } it { should belong_to(:naughty).require...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/chapter_spec.rb
Ruby
apache-2.0
187
the-future
430
require 'rails_helper' RSpec.describe Chapter, type: :model do subject { create(:chapter) } let(:manga) { create(:manga) } it { should belong_to(:manga).required } it { should validate_presence_of(:number) } it 'should strip XSS from description' do subject.description['en'] = '<script>prompt("PASSWORD:...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/category_spec.rb
Ruby
apache-2.0
187
the-future
239
require 'rails_helper' RSpec.describe Category, type: :model do subject { build(:category) } it { is_expected.to have_many(:anime).through(:media_categories) } it { is_expected.to have_many(:manga).through(:media_categories) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/group_ticket_spec.rb
Ruby
apache-2.0
187
the-future
379
require 'rails_helper' RSpec.describe GroupTicket, type: :model do it { should belong_to(:group).required } it { should belong_to(:user).required } it { should belong_to(:assignee).class_name('User').optional } it { should define_enum_for(:status) } it do should have_many(:messages).class_name('GroupTick...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/episode_spec.rb
Ruby
apache-2.0
187
the-future
2,060
require 'rails_helper' RSpec.describe Episode, type: :model do subject { create(:episode, media: anime) } let(:anime) { create(:anime) } it { should have_many(:videos) } it { should validate_presence_of(:media) } it { should validate_presence_of(:number) } it 'should strip XSS from description' do sub...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/drama_character_spec.rb
Ruby
apache-2.0
187
the-future
204
require 'rails_helper' RSpec.describe DramaCharacter, type: :model do it { should belong_to(:drama).required } it { should belong_to(:character).required } it { should define_enum_for(:role) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/group_member_note_spec.rb
Ruby
apache-2.0
187
the-future
215
require 'rails_helper' RSpec.describe GroupMemberNote, type: :model do it { should belong_to(:group_member).required } it { should belong_to(:user).required } it { should validate_presence_of(:content) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/manga_spec.rb
Ruby
apache-2.0
187
the-future
560
require 'rails_helper' RSpec.describe Manga, type: :model do subject { build(:manga) } include_examples 'media' context '#default_progress_limit' do it 'should return 5000' do subject.start_date = nil subject.end_date = nil expect(subject.default_progress_limit).to eq(5000) end end ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/community_recommendation_request_spec.rb
Ruby
apache-2.0
187
the-future
243
require 'rails_helper' RSpec.describe CommunityRecommendationRequest, type: :model do subject { build(:community_recommendation_request) } it { should have_many(:community_recommendations) } it { should belong_to(:user).required } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/group_ban_spec.rb
Ruby
apache-2.0
187
the-future
220
require 'rails_helper' RSpec.describe GroupBan, type: :model do it { should belong_to(:group).required } it { should belong_to(:user).required } it { should belong_to(:moderator).class_name('User').required } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/drama_staff_spec.rb
Ruby
apache-2.0
187
the-future
216
require 'rails_helper' RSpec.describe DramaStaff, type: :model do it { should belong_to(:drama).required } it { should belong_to(:person).required } it { should validate_length_of(:role).is_at_most(140) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/community_recommendation_spec.rb
Ruby
apache-2.0
187
the-future
367
require 'rails_helper' RSpec.describe CommunityRecommendation, type: :model do subject { build(:community_recommendation) } it { should belong_to(:anime).optional } it { should belong_to(:manga).optional } it { should belong_to(:drama).optional } it { should have_many(:reasons) } it { should belong_to(:co...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/ip_filter_spec.rb
Ruby
apache-2.0
187
the-future
3,451
# frozen_string_literal: true RSpec.describe IPFilter do let(:mountain_view) do Geoname.create!( geoname_id: 5_375_480, continent_code: 'NA', continent_name: 'North America', country_iso_code: 'US', country_name: 'United States', subdivision_1_iso_code: 'CA', subdivision...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/canny_token_spec.rb
Ruby
apache-2.0
187
the-future
898
require 'rails_helper' RSpec.describe CannyToken do describe '#user_data' do let(:user) { build(:user, :with_avatar) } subject { CannyToken.new(user) } it 'should contain name' do expect(subject.user_data).to include(:name) expect(subject.user_data[:name]).to eq(user.name) end it 's...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/character_spec.rb
Ruby
apache-2.0
187
the-future
353
require 'rails_helper' RSpec.describe Character, type: :model do it { should belong_to(:primary_media).optional } it { should have_many(:castings) } it { should have_many(:anime_characters).dependent(:destroy) } it { should have_many(:manga_characters).dependent(:destroy) } it { should have_many(:drama_chara...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/review_spec.rb
Ruby
apache-2.0
187
the-future
946
# frozen_string_literal: true RSpec.describe Review, type: :model do subject { build(:review, user: user) } let(:user) { create(:user) } it { is_expected.to have_many(:likes).class_name('ReviewLike') } it { is_expected.to belong_to(:media).required } it 'validates uniqueness per media and user' do sub...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/list_import/my_anime_list_xml_spec.rb
Ruby
apache-2.0
187
the-future
1,073
require 'rails_helper' RSpec.describe ListImport::MyAnimeListXML do let(:file) { Fixture.new('list_import/my_anime_list/nuck.xml.gz').to_file } it { is_expected.to validate_absence_of(:input_text) } context 'with a list' do let(:import) do attachment = Shrine.upload(file, :store, metadata: false) ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/list_import/anime_planet_spec.rb
Ruby
apache-2.0
187
the-future
1,881
require 'rails_helper' RSpec.describe ListImport::AnimePlanet do before do host = described_class::ANIME_PLANET_HOST extensions = '?mylist_view=grid&per_page=480&sort=title&page=' # Page 1 Toy stub_request(:get, "#{host}toyhammered/anime#{extensions}1") .to_return(body: fixture('list_import/an...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/list_import/anilist_spec.rb
Ruby
apache-2.0
187
the-future
1,131
# frozen_string_literal: true require 'rails_helper' RSpec.describe ListImport::Anilist do subject do described_class.create( input_text: 'toyhammered', user: build(:user) ) end before do stub_request(:post, 'https://graphql.anilist.co') .to_return(body: fixture('list_import/anili...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/list_import/anime_planet/row_spec.rb
Ruby
apache-2.0
187
the-future
8,957
require 'rails_helper' RSpec.describe ListImport::AnimePlanet::Row do let(:anime) { fixture('list_import/anime_planet/toy-anime.html') } let(:manga) { fixture('list_import/anime_planet/toy-manga.html') } context 'Anime' do subject do described_class.new( Nokogiri::HTML(anime).css('.cardDeck .c...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/list_import/my_anime_list_xml/row_spec.rb
Ruby
apache-2.0
187
the-future
20,260
require 'rails_helper' RSpec.describe ListImport::MyAnimeListXML::Row do def create_mapping(media) raise 'Media must be saved' unless media.persisted? prefix = media.class.name.underscore fake_id = rand(1..50_000) create(:mapping, item: media, external_site: "myanimelist/#{prefix}", ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/list_import/anilist/row_spec.rb
Ruby
apache-2.0
187
the-future
5,541
# frozen_string_literal: true require 'rails_helper' RSpec.describe ListImport::Anilist::Row do shared_examples_for 'Anilist generic row fields' do |klass| describe '#media' do it 'works for anilist lookup' do expect(Mapping).to receive(:lookup) .with("anilist/#{type}", anilist_media_id)...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/list_import/my_anime_list/row_spec.rb
Ruby
apache-2.0
187
the-future
1,203
require 'rails_helper' RSpec.describe ListImport::MyAnimeList::Row do let(:anime) { fixture('list_import/my_anime_list/toy-anime.json') } date_format = '%m-%d-%y' context 'with anime' do describe '#started_at' do context 'with empty date' do subject { described_class.new(JSON.parse(anime)[1], ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/linked_account/my_anime_list_spec.rb
Ruby
apache-2.0
187
the-future
1,260
require 'rails_helper' RSpec.describe LinkedAccount::MyAnimeList do context 'validates' do describe '#verify_mal_credentials' do context 'with valid login' do it 'should have no errors' do list_sync = instance_double(ListSync::MyAnimeList) subject = described_class.new( ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/stat/anime_favorite_year_spec.rb
Ruby
apache-2.0
187
the-future
1,974
require 'rails_helper' RSpec.describe Stat::AnimeFavoriteYear do let(:user) { create(:user) } let(:anime) { create(:anime, start_date: 'Tue, 19 Apr 2016') } let(:anime1) { create(:anime, start_date: 'Tue, 19 Apr 2014') } let(:le) { create(:library_entry, user: user, anime: anime, progress: 1) } let(:le1) { c...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/stat/manga_favorite_year_spec.rb
Ruby
apache-2.0
187
the-future
1,976
require 'rails_helper' RSpec.describe Stat::MangaFavoriteYear do let(:user) { create(:user) } let(:manga) { create(:manga, start_date: 'Tue, 19 Apr 2016') } let(:manga1) { create(:manga, start_date: 'Tue, 19 Apr 2014') } let!(:le) { create(:library_entry, user: user, manga: manga, progress: 1) } let!(:le1) {...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/concerns/with_moderation_scores_spec.rb
Ruby
apache-2.0
187
the-future
1,324
# frozen_string_literal: true RSpec.describe WithModerationScores do before do Temping.create(:test_content) do def self.name = 'TestContent' with_columns do |t| t.jsonb :moderation_scores t.string :foo t.timestamps end end TestContent.include(described_class) ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/concerns/titleable_spec.rb
Ruby
apache-2.0
187
the-future
1,918
require 'rails_helper' RSpec.describe Titleable do let(:klass) do Class.new do include ActiveModel::Model include Titleable attr_accessor :titles, :original_languages, :original_countries def initialize(canonical_title: nil, original_title: nil, romanized_title: nil, **data) @dat...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/concerns/stat/category_breakdown_spec.rb
Ruby
apache-2.0
187
the-future
2,274
require 'rails_helper' RSpec.describe Stat::CategoryBreakdown do let(:user) { create(:user) } let(:anime) { create(:anime, :categories) } let(:entry) { build(:library_entry, user: user, media: anime, status: :completed) } let!(:stat) { Stat::AnimeCategoryBreakdown.for_user(user) } describe '#default_data' d...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/concerns/stat/amount_consumed_spec.rb
Ruby
apache-2.0
187
the-future
2,732
require 'rails_helper' RSpec.describe Stat::AmountConsumed do # will create some library entries for me let(:user) { create(:user) } let(:anime) { create(:anime, :with_episodes, episode_count: 5) } let!(:stat) { Stat::AnimeAmountConsumed.for_user(user) } before do allow(Kernel).to receive(:rand).and_ret...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/pro_subscription/apple_subscription_spec.rb
Ruby
apache-2.0
187
the-future
240
require 'rails_helper' RSpec.describe ProSubscription::AppleSubscription, type: :model do describe '#billing_service' do it 'should return :apple_ios' do ProSubscription::AppleSubscription.new.billing_service end end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/pro_subscription/stripe_subscription_spec.rb
Ruby
apache-2.0
187
the-future
1,115
require 'rails_helper' RSpec.describe ProSubscription::StripeSubscription, type: :model 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) } describe '#billing_service...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/pro_subscription/google_play_subscription_spec.rb
Ruby
apache-2.0
187
the-future
550
require 'rails_helper' RSpec.describe ProSubscription::GooglePlaySubscription, type: :model do describe '#billing_service' do it 'should return :google_play' do ProSubscription::GooglePlaySubscription.new.billing_service end end it 'should cancel the subscription on destroy' do sub = ProSubscr...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/feed/activity_group_spec.rb
Ruby
apache-2.0
187
the-future
966
require 'rails_helper' RSpec.describe Feed::ActivityGroup, type: :model do let(:feed) { Feed.new('user', '1') } it 'should coerce activities into Activity instances' do ag = Feed::ActivityGroup.new(feed, {activities: [{test: 'foo'}]}) expect(ag.activities.first).to be_a(Feed::Activity) expect(ag.activ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/feed/activity_spec.rb
Ruby
apache-2.0
187
the-future
1,908
require 'rails_helper' RSpec.describe Feed::Activity, type: :model do let(:feed) { Feed.new('user', '1') } subject { Feed::Activity.new(feed) } describe '#as_json' do it 'should convert time to ISO8601' do time = Time.now activity = Feed::Activity.new(feed, time: time) json = activity.as_j...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/feed/activity_list_spec.rb
Ruby
apache-2.0
187
the-future
6,829
require 'rails_helper' RSpec.describe Feed::ActivityList, type: :model do class TestFeed < Feed; end let(:feed) { TestFeed.new('1') } let(:list) { Feed::ActivityList.new(feed) } subject { list } describe '#page' do context 'with an id_lt' do subject { list.page(id_lt: '12345') } it 'should s...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/models/feed/activity_list/page_spec.rb
Ruby
apache-2.0
187
the-future
3,109
require 'rails_helper' RSpec.describe Feed::ActivityList::Page do subject { Feed::ActivityList::Page.new(data.as_json, opts) } let(:user) { create(:user) } let(:opts) { { feed: feed } } context 'on a flat feed' do let(:feed) { OpenStruct.new(:aggregated? => false) } let(:data) do [ { nsf...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/formatters/shrine_attachment_value_formatter_spec.rb
Ruby
apache-2.0
187
the-future
1,334
require 'rails_helper' RSpec.describe ShrineAttachmentValueFormatter do let(:attachment) do Shrine.upload(Fixture.new('image.png').to_file, :store, metadata: false) end let(:attacher) do Shrine::Attacher.new(file: attachment) end describe '.format' do context 'with an invalid attachment' do ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/api/oauth_spec.rb
Ruby
apache-2.0
187
the-future
815
require 'rails_helper' require 'oauth2' RSpec.describe 'OAuth2', type: :request do let(:oauth_app) { create(:oauth_application) } let(:user) { create(:user) } let(:client) do OAuth2::Client.new(oauth_app.uid, oauth_app.secret, authorize_url: '/api/oauth/authorize', token_url: '/api/oauth/token') ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/callbacks/library_time_spent_callbacks_spec.rb
Ruby
apache-2.0
187
the-future
3,365
require 'rails_helper' RSpec.describe LibraryTimeSpentCallbacks do class LibraryEntryDouble include ActiveModel::Dirty attr_accessor :progress, :reconsume_count, :time_spent, :media define_attribute_methods :progress, :reconsume_count def initialize(progress: nil, reconsume_count: nil, time_spent: ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/callbacks/callbacks_spec.rb
Ruby
apache-2.0
187
the-future
784
require 'rails_helper' RSpec.describe Callbacks do it 'should accept record during initialization' do foo = double expect(Callbacks.new(foo).record).to eq(foo) end it 'should set default options to an empty hash' do expect(Callbacks.new(nil).options).to eq({}) end describe '#with_options' do ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/callbacks/wordfilter_callbacks_spec.rb
Ruby
apache-2.0
187
the-future
3,100
require 'rails_helper' RSpec.describe WordfilterCallbacks do describe '.hook' do it 'attaches a before_validation hook' do klass = class_spy(Post) described_class.hook(klass, :location, :content_field) expect(klass).to have_received(:before_validation) end it 'attaches an after_save ho...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/callbacks/instanced_callbacks_spec.rb
Ruby
apache-2.0
187
the-future
1,973
require 'rails_helper' RSpec.describe InstancedCallbacks do describe '#record' do it 'returns the record passed in during initialization' do foo = double expect(described_class.new(foo).record).to eq(foo) end end describe '#options' do it 'wraps the initialization options as an OpenStruc...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/callbacks/library_stat_callbacks_spec.rb
Ruby
apache-2.0
187
the-future
4,309
require 'rails_helper' RSpec.describe LibraryStatCallbacks do let(:anime) { build(:anime) } let(:manga) { build(:manga) } let(:user) { create(:user) } subject { described_class.new(entry) } def include_a_job_matching(*args) include(a_hash_including('args' => args)) end context 'with Manga' do l...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/validators/country_code_validator_spec.rb
Ruby
apache-2.0
187
the-future
1,676
require 'rails_helper' RSpec.describe CountryCodeValidator do subject { described_class.new(attributes: %i[country]) } record_class = Struct.new(:country) do extend ActiveModel::Naming include ActiveModel::Validations end context 'with a single country code' do context 'on an invalid record' do ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/validators/real_email_validator_spec.rb
Ruby
apache-2.0
187
the-future
1,811
require 'rails_helper' RSpec.describe RealEmailValidator do subject { described_class.new(attributes: %i[email]) } RealEmailRecordClass = Struct.new(:email, :name) do extend ActiveModel::Naming include ActiveModel::Validations end context 'with an undeliverable email address' do let(:record) { Rea...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/validators/multi_presence_validator_spec.rb
Ruby
apache-2.0
187
the-future
1,595
require 'rails_helper' RSpec.describe MultiPresenceValidator do context 'with a minimum of 1' do subject { described_class.new(over: %i[foo bar baz], minimum: 1) } record_class = Struct.new(:foo, :bar, :baz) do extend ActiveModel::Naming include ActiveModel::Validations end context 'on a...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/validators/language_code_validator_spec.rb
Ruby
apache-2.0
187
the-future
1,683
require 'rails_helper' RSpec.describe LanguageCodeValidator do subject { described_class.new(attributes: %i[language]) } record_class = Struct.new(:language) do extend ActiveModel::Naming include ActiveModel::Validations end context 'with a single language code' do context 'on an invalid record' d...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/validators/exclusivity_validator_spec.rb
Ruby
apache-2.0
187
the-future
1,592
require 'rails_helper' RSpec.describe ExclusivityValidator do context 'with a limit of 1' do subject { described_class.new(over: %i[foo bar baz], limit: 1) } record_class = Struct.new(:foo, :bar, :baz) do extend ActiveModel::Naming include ActiveModel::Validations end context 'on an inva...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/linked_account_policy_spec.rb
Ruby
apache-2.0
187
the-future
562
require 'rails_helper' RSpec.describe LinkedAccountPolicy do let(:owner) { token_for create(:user, id: 1) } let(:user) { token_for create(:user, id: 2) } let(:linked_account) do build(:linked_account, user: owner.resource_owner) end subject { described_class } permissions :create?, :update?, :destroy?...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/media_ignore_policy_spec.rb
Ruby
apache-2.0
187
the-future
854
require 'rails_helper' RSpec.describe MediaIgnorePolicy do let(:user) { token_for create(:user, id: 1) } let(:media) { build(:anime) } let(:other) { token_for create(:user, id: 2) } let(:media_ignore) do build(:media_ignore, user: user.resource_owner, media: media) end subject { described_class } pe...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/upload_policy_spec.rb
Ruby
apache-2.0
187
the-future
1,183
require 'rails_helper' RSpec.describe UploadPolicy do let(:user) { token_for create(:user) } let(:community_mod) { token_for create(:user, permissions: %i[community_mod]) } let(:upload) { build(:upload, user: user.resource_owner) } let(:other) { build(:upload) } subject { described_class } permissions :cre...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/media_reaction_policy_spec.rb
Ruby
apache-2.0
187
the-future
1,307
# frozen_string_literal: true require 'rails_helper' RSpec.describe MediaReactionPolicy do subject { described_class.new(user, media_reaction) } let(:community_mod) { create(:user, permissions: %i[community_mod]) } let(:database_mod) { create(:user, permissions: %i[database_mod]) } let(:owner) { create(:user...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/anime_policy_spec.rb
Ruby
apache-2.0
187
the-future
615
require 'rails_helper' RSpec.describe AnimePolicy do let(:user) { token_for create(:user) } let(:pervert) { token_for create(:user, sfw_filter: false) } let(:database_mod) { token_for create(:user, permissions: %i[database_mod]) } let(:anime) { build(:anime) } let(:hentai) { build(:anime, :nsfw) } subject ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/quote_like_policy_spec.rb
Ruby
apache-2.0
187
the-future
648
require 'rails_helper' RSpec.describe QuoteLikePolicy do let(:user) { token_for create(:user) } let(:like) { build(:quote_like, user: user.resource_owner) } let(:other) { build(:quote_like) } subject { described_class } permissions :update? do it('should not allow anons') { should_not permit(nil, like) ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/comment_policy_spec.rb
Ruby
apache-2.0
187
the-future
2,169
require 'rails_helper' RSpec.describe CommentPolicy do let(:owner) { token_for create(:user, id: 1) } let(:other) { token_for create(:user, id: 2) } let(:community_mod) { token_for create(:user, permissions: %i[community_mod]) } let(:comment) { build(:comment, user: owner.resource_owner) } subject { describe...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/community_recommendation_request_policy_spec.rb
Ruby
apache-2.0
187
the-future
1,369
require 'rails_helper' RSpec.describe CommunityRecommendationRequestPolicy do let(:user) { token_for create(:user) } let(:community_mod) { token_for create(:user, permissions: %i[community_mod]) } let(:request) { build(:community_recommendation_request, user: user.resource_owner) } let(:other) { build(:communi...