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/policies/follow_policy_spec.rb
Ruby
apache-2.0
187
the-future
932
require 'rails_helper' RSpec.describe FollowPolicy do let(:follower) { token_for create(:user) } let(:following) { token_for create(:user) } let(:other) { token_for create(:user) } let(:banned_user) { token_for create(:user, :banned) } let(:follow) do build(:follow, follower: follower.resource_owner, fol...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/notification_setting_policy_spec.rb
Ruby
apache-2.0
187
the-future
693
require 'rails_helper' RSpec.describe NotificationSettingPolicy do let(:user) { token_for create(:user) } let(:setting) { build(:notification_setting, user: user.resource_owner) } let(:other) { build(:notification_setting) } subject { described_class } permissions :update? do it('should allow users') { ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/category_favorite_policy_spec.rb
Ruby
apache-2.0
187
the-future
458
require 'rails_helper' RSpec.describe CategoryFavoritePolicy do let(:user) { token_for create(:user, id: 1) } let(:other) { token_for create(:user, id: 2) } let(:favorite) { build(:category_favorite, user: user.resource_owner) } subject { described_class } permissions :update?, :create?, :destroy? do it...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/post_follow_policy_spec.rb
Ruby
apache-2.0
187
the-future
661
require 'rails_helper' RSpec.describe PostFollowPolicy do let(:user) { token_for create(:user) } let(:follow) { build(:post_follow, user: user.resource_owner) } let(:other) { build(:post_follow) } subject { described_class } permissions :update? do it('should not allow users') { should_not permit(user, ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/user_policy_spec.rb
Ruby
apache-2.0
187
the-future
1,378
require 'rails_helper' RSpec.describe UserPolicy do let(:user) { build(:user) } let(:user_token) { token_for(user) } let(:community_mod) { create(:user, permissions: %i[community_mod]) } let(:community_mod_token) { token_for(community_mod) } let(:other) { build(:user) } let(:other_token) { token_for(other)...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/quote_policy_spec.rb
Ruby
apache-2.0
187
the-future
543
require 'rails_helper' RSpec.describe QuotePolicy do let(:other) { token_for create(:user) } let(:database_mod) { token_for create(:user, permissions: %i[database_mod]) } let(:quote) { build(:quote, user: database_mod.resource_owner) } subject { described_class } permissions :create?, :update?, :destroy? do...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/ama_policy_spec.rb
Ruby
apache-2.0
187
the-future
771
# frozen_string_literal: true require 'rails_helper' RSpec.describe AMAPolicy do subject { described_class } let(:user) { token_for create(:user) } let(:other) { token_for create(:user) } let(:community_mod) { token_for create(:user, permissions: %i[community_mod]) } let(:ama) { build(:ama, author: user.re...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/comment_like_policy_spec.rb
Ruby
apache-2.0
187
the-future
654
require 'rails_helper' RSpec.describe CommentLikePolicy do let(:user) { token_for create(:user) } let(:like) { build(:comment_like, user: user.resource_owner) } let(:other) { build(:comment_like) } subject { described_class } permissions :update? do it('should not allow users') { should_not permit(user,...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/library_entry_policy_spec.rb
Ruby
apache-2.0
187
the-future
515
require 'rails_helper' RSpec.describe LibraryEntryPolicy do let(:owner) { token_for create(:user, id: 1) } let(:user) { token_for create(:user, id: 2) } let(:entry) { build(:library_entry, user: owner.resource_owner) } subject { described_class } permissions :create?, :update?, :destroy? do it('should a...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/media_reaction_vote_policy_spec.rb
Ruby
apache-2.0
187
the-future
717
require 'rails_helper' RSpec.describe MediaReactionVotePolicy do let(:owner) { token_for create(:user) } let(:other) { token_for create(:user, id: 2) } let(:media_reaction_vote) do build(:media_reaction_vote, user: owner.resource_owner) end subject { described_class } permissions :update? do it('s...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/ama_subscriber_policy_spec.rb
Ruby
apache-2.0
187
the-future
647
require 'rails_helper' RSpec.describe AMASubscriberPolicy do let(:user) { token_for create(:user, id: 1) } let(:other) { token_for create(:user, id: 2) } let(:ama_subscriber) { build(:ama_subscriber, user: user.resource_owner) } subject { described_class } permissions :update? do it('should not allow us...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/post_like_policy_spec.rb
Ruby
apache-2.0
187
the-future
645
require 'rails_helper' RSpec.describe PostLikePolicy do let(:user) { token_for create(:user) } let(:like) { build(:post_like, user: user.resource_owner) } let(:other) { build(:post_like) } subject { described_class } permissions :update? do it('should not allow users') { should_not permit(user, like) } ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/report_policy_spec.rb
Ruby
apache-2.0
187
the-future
1,191
# frozen_string_literal: true require 'rails_helper' RSpec.describe ReportPolicy do subject { described_class.new(user, report) } let(:reporter) { create(:user) } let(:report) { build(:report, user: reporter) } context 'with reporter' do let(:user) { token_for reporter } it { is_expected.to permit_...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/favorite_policy_spec.rb
Ruby
apache-2.0
187
the-future
445
require 'rails_helper' RSpec.describe FavoritePolicy do let(:owner) { token_for create(:user, id: 1) } let(:other) { token_for create(:user, id: 2) } let(:favorite) { build(:favorite, user: owner.resource_owner) } subject { described_class } permissions :update?, :create?, :destroy? do it('should allow ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/community_recommendation_follow_policy_spec.rb
Ruby
apache-2.0
187
the-future
1,098
require 'rails_helper' RSpec.describe CommunityRecommendationFollowPolicy do let(:user) { token_for create(:user) } let(:follow) { build(:community_recommendation_follow, user: user.resource_owner) } let(:other) { build(:community_recommendation_follow) } subject { described_class } permissions :update? do ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/media_attribute_vote_policy_spec.rb
Ruby
apache-2.0
187
the-future
451
require 'rails_helper' RSpec.describe MediaAttributeVotePolicy do let(:user) { token_for create(:user, id: 1) } let(:other) { token_for create(:user, id: 2) } let(:vote) { build(:media_attribute_vote, user: user.resource_owner) } subject { described_class } permissions :update?, :create?, :destroy? do i...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/policies/post_policy_spec.rb
Ruby
apache-2.0
187
the-future
2,016
require 'rails_helper' RSpec.describe PostPolicy 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(:post) { build(:post, user: owner.resource_owner) } subject { described_class }...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/controllers/sso_controller_spec.rb
Ruby
apache-2.0
187
the-future
675
require 'rails_helper' RSpec.describe SSOController, type: :controller do let(:user) { create(:user) } describe '#canny' do context 'when logged in' do it 'should respond with a token' do sign_in user get :canny expect(response).to have_http_status(:ok) expect(response.bo...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/controllers/anime_controller_spec.rb
Ruby
apache-2.0
187
the-future
1,911
# frozen_string_literal: true require 'rails_helper' RSpec.describe AnimeController do ANIME ||= { titles: { en_jp: String }, canonicalTitle: String }.freeze let(:anime) { create(:anime) } describe '#index' do describe 'with filter[slug]' do it 'responds with an anime' do get :index...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/controllers/pro_subscription_controller_spec.rb
Ruby
apache-2.0
187
the-future
5,991
require 'rails_helper' require 'google/apis/androidpublisher_v3' RSpec.describe ProSubscriptionController, type: :controller do let(:user) { create(:user) } describe '#ios' do include_context 'Stubbed Apple Receipt Verification' context 'with a valid receipt' do it 'should create an AppleSubscripti...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/controllers/library_entries_controller_spec.rb
Ruby
apache-2.0
187
the-future
2,554
require 'rails_helper' RSpec.describe LibraryEntriesController, type: :controller do LIBRARY_ENTRY ||= { status: String, progress: Integer }.freeze let(:user) { create(:user) } let(:anime) { create(:anime) } describe '#index' do describe 'with filter[user_id]' do it 'should respond with a list of li...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/controllers/users_controller_spec.rb
Ruby
apache-2.0
187
the-future
2,991
require 'rails_helper' RSpec.describe UsersController, type: :controller do USER ||= { name: String, pastNames: Array }.freeze CURRENT_USER ||= { email: String }.merge(USER).freeze let(:user) { create(:user) } describe '#index' do describe 'with filter[self]' do it 'should respond with a user when a...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/controllers/concerns/doorkeeper_helpers_spec.rb
Ruby
apache-2.0
187
the-future
1,081
require 'rails_helper' RSpec.describe DoorkeeperHelpers do let(:controller) do Class.new do def doorkeeper_token; end include DoorkeeperHelpers def render(*); end end end let(:instance) { controller.new } context '#current_user' do it 'should return the token when there is a us...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/controllers/webhooks/youtube_controller_spec.rb
Ruby
apache-2.0
187
the-future
4,000
require 'rails_helper' RSpec.describe Webhooks::YoutubeController, type: :controller do let(:linked_account) do create(:linked_account, type: 'LinkedAccount::YoutubeChannel', share_from: true, token: 'TEST', external_user_id: 'CHANNEL_ID').becomes(LinkedAccount::YoutubeChannel) end le...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/controllers/webhooks/getstream_controller_spec.rb
Ruby
apache-2.0
187
the-future
1,172
require 'rails_helper' RSpec.describe Webhooks::GetstreamController, type: :controller do let(:username) { ENV['STREAM_WEBHOOK_USER'] } let(:password) { ENV['STREAM_WEBHOOK_PASS'] } let(:auth) { "Basic #{Base64.encode64("#{username}:#{password}")}" } before do @request.headers['Authorization'] = auth en...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/current_user_helper.rb
Ruby
apache-2.0
187
the-future
525
module CurrentUserHelper def token_for(user, scopes = []) Doorkeeper::AccessToken.new( resource_owner: user, scopes: scopes.join(' ') ) end def sign_in(user, scopes = [:all]) token = token_for(user, scopes) @controller.send(:define_singleton_method, :current_user) { token } end d...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/chewy.rb
Ruby
apache-2.0
187
the-future
568
require 'chewy/rspec' RSpec.configure do |config| config.before(:suite) do # Commit changes to the index immediately Chewy.strategy(:bypass) end config.before(:example, elasticsearch: true) do Chewy.strategy(:urgent) Chewy.client.cluster.health wait_for_status: 'yellow', timeout: '10s' Chewy:...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/typesensual.rb
Ruby
apache-2.0
187
the-future
707
# frozen_string_literal: true RSpec.configure do |config| indices = [ TypesenseAnimeIndex, TypesenseMangaIndex, TypesenseUsersIndex, TypesenseGroupsIndex ].freeze # Create a new collection for each index before each test and delete it afterwards. We also stub # it into place for the index inst...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/stubbed_android_publisher_service.rb
Ruby
apache-2.0
187
the-future
373
RSpec.shared_context 'Stubbed Android Publisher Service' do class AndroidPublisherService < Google::Apis::AndroidpublisherV3::AndroidPublisherService def self.new @new ||= super end end let(:api) { AndroidPublisherService.new } before do stub_const('Google::Apis::AndroidpublisherV3::AndroidP...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/episodic_examples.rb
Ruby
apache-2.0
187
the-future
1,527
require 'rails_helper' RSpec.shared_examples 'episodic' do it { should have_db_column(:episode_count) } it { should have_db_column(:episode_length) } it { should have_many(:episodes) } it { should have_many(:streaming_links) } # TODO: switch these from anime-specific to general-purpose describe '#recalcul...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/age_ratings_examples.rb
Ruby
apache-2.0
187
the-future
736
require 'rails_helper' RSpec.shared_examples 'age_ratings' do it { should have_db_column(:age_rating) } it { should have_db_column(:age_rating_guide) } describe '#sfw?' do it 'should be true for a G-rated show' do anime = build(:anime, age_rating: 'G') expect(anime).to be_sfw expect(anime)...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/stubbed_apple_receipt_verification.rb
Ruby
apache-2.0
187
the-future
664
RSpec.shared_context 'Stubbed Apple Receipt Verification' do let(:verify_url) { 'http://example.com/receipt-verify' } before do require 'apple_receipt_service' stub_const('AppleReceiptService::VERIFICATION_URL', verify_url) end subject { described_class.new('fake_receipt') } def stub_receipt_verifica...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/media_examples.rb
Ruby
apache-2.0
187
the-future
4,588
require 'rails_helper' RSpec.shared_examples 'media' do include_examples 'titleable' before do allow_any_instance_of(Feed).to receive(:follow) allow_any_instance_of(Feed).to receive(:unfollow) end # Columns which are mandatory for all media it { should have_db_column(:slug).of_type(:citext) } it ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/titleable_examples.rb
Ruby
apache-2.0
187
the-future
315
require 'rails_helper' RSpec.shared_examples 'titleable' do # Columns which are mandatory for all titleables it { should have_db_column(:titles).of_type(:hstore) } it { should have_db_column(:canonical_title).of_type(:string) } # Methods used for the magic it { should respond_to(:canonical_title) } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/coverage.rb
Ruby
apache-2.0
187
the-future
805
# frozen_string_literal: true require 'simplecov' case ENV.fetch('SIMPLECOV_REPORTER', nil) when 'cobertura' require 'simplecov-cobertura' SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter else SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter end SimpleCov.start do add_filter '/spec/' ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/json_expressions.rb
Ruby
apache-2.0
187
the-future
646
require 'json_expressions/rspec' JsonExpressions::Matcher.assume_strict_arrays = false JsonExpressions::Matcher.assume_strict_hashes = false module JSONAPIMatchers def have_resource(attributes, type = nil, singular: true) data = { attributes: attributes, type: type } matcher = { data: (singular ? data : [da...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/fixture_helper.rb
Ruby
apache-2.0
187
the-future
738
class Fixture attr_accessor :name, :content @@cache = Hash.new { |h, k| h[k] = {} } def initialize(name, opts = {}) @name = name @opts = opts end def to_s @opts[:erb] ? compiled : content end def to_file open(filename) end def filename File.realpath(File.join('spec/fixtures/',...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/have_jsonapi_error.rb
Ruby
apache-2.0
187
the-future
512
RSpec::Matchers.define :have_jsonapi_error do |conditions| match do |obj| # For non-hash match params, build the match hash conditions = { detail: conditions } unless conditions.is_a?(Hash) conditions = conditions.deep_stringify_keys # Mangle into a Hash structure obj = Oj.load(obj) if obj.is_a?(...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/webmock.rb
Ruby
apache-2.0
187
the-future
472
# frozen_string_literal: true require 'webmock/rspec' WebMock.disable_net_connect!(allow: [ 'robohash.org', 'codeclimate.com', %r{pigment.github.io/fake-logos}, 'lorempixel.com', 'localhost', 'elasticsearch:9200', 'minio:9000', 'oembed.com', 'typesense:8108', 'graphql.anilist.co' ]) RSpec.shared_...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/stripe_mock.rb
Ruby
apache-2.0
187
the-future
249
require 'stripe_mock' RSpec.configure do |config| config.before(:example) do |test| StripeMock.start unless test.metadata[:live_stripe] end config.after(:example) do |test| StripeMock.stop unless test.metadata[:live_stripe] end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/stream.rb
Ruby
apache-2.0
187
the-future
450
RSpec.configure do |config| config.before(:each) do |example| unless example.metadata[:stream_api] stub_request(:any, %r{https://api.stream-io-api.com/api/v1.0/}) .and_return(status: 200, body: '{}') stub_request(:any, %r{https://api.getstream.io/api/v1.0/}) .and_return(status: 200, bo...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/shared_examples/streamable.rb
Ruby
apache-2.0
187
the-future
2,046
# frozen_string_literal: true require 'rails_helper' RSpec.shared_examples 'streamable' do # Columns which are mandatory for all streamables it { is_expected.to have_db_column(:regions).of_type(:string) } it { is_expected.to have_db_column(:dubs).of_type(:string) } it { is_expected.to have_db_column(:subs).of...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/shared_contexts/with_graphql_helpers.rb
Ruby
apache-2.0
187
the-future
205
# frozen_string_literal: true RSpec.shared_context 'with graphql helpers' do def execute_query(query, **variables) KitsuSchema.execute(query, variables: variables, context: context || {}) end end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/support/shared_contexts/with_authenticated_user.rb
Ruby
apache-2.0
187
the-future
225
# frozen_string_literal: true RSpec.shared_context 'with authenticated user' do let(:user) { create(:user) } let(:token) { token_for(user) } let(:context) { { token:, user:, site_permissions: user&.permissions } } end
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/lib/dirty_change_wrapper_spec.rb
Ruby
apache-2.0
187
the-future
1,729
require 'rails_helper' require 'dirty_change_wrapper' RSpec.describe DirtyChangeWrapper do let(:base) { OpenStruct.new(foo: 'bar') } let(:changes) { { baz: %w[bar bat] } } subject { DirtyChangeWrapper.new(base, changes) } context 'for changes' do it 'should provide a _was method to access the previous val...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/lib/unlimited_paginator_spec.rb
Ruby
apache-2.0
187
the-future
925
require 'rails_helper' RSpec.describe UnlimitedPaginator do subject { described_class.new(nil) } it 'should raise an error when limit < 1' do subject.instance_variable_set(:@limit, -5) expect { subject.send(:verify_pagination_params) }.to raise_error(JSONAPI::Exceptions::InvalidPageValue) end ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/lib/image_info_spec.rb
Ruby
apache-2.0
187
the-future
2,208
# frozen_string_literal: true require 'rails_helper' RSpec.describe ImageInfo do describe 'static' do describe 'PNG' do let(:image) { described_class.new(Fixture.new('images/static.png').filename) } it '#type should be :png' do expect(image.type).to be(:png) end it '#animated? ...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/lib/kramdown/parser/inline_markdown_spec.rb
Ruby
apache-2.0
187
the-future
490
require 'rails_helper' RSpec.describe Kramdown::Parser::InlineMarkdown do it 'should not create headers' do text = '# Header' output = Kramdown::Document.new(text, input: 'InlineMarkdown').to_html expect(output).not_to include('<h1') end it 'should create paragraphs' do text = "two\n\nparagraphs...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/lib/authorization/assertion/facebook_spec.rb
Ruby
apache-2.0
187
the-future
1,065
# frozen_string_literal: true require 'rails_helper' require 'authorization/assertion/facebook' RSpec.describe Authorization::Assertion::Facebook do before do stub_request(:get, %r{https://graph.facebook.com/v.*/me\?.*}) .to_return(body: fixture('auth/facebook/self.json')) stub_request(:get, %r{https:...
github
hummingbird-me/kitsu-server
https://github.com/hummingbird-me/kitsu-server
spec/workers/stat_worker_spec.rb
Ruby
apache-2.0
187
the-future
1,012
# frozen_string_literal: true require 'rails_helper' RSpec.describe StatWorker do describe '#perform' do it 'sends to the stat class with a wrapper around the model and changes' do stub_const('Stat::Test', spy) allow(Stat::Test).to receive(:for_user).and_return(Stat::Test) allow(Stat::Test).to...
github
rheaton/carrierwave-video
https://github.com/rheaton/carrierwave-video
carrierwave-video.gemspec
Ruby
mit
187
master
1,201
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "carrierwave-video/version" Gem::Specification.new do |s| s.name = "carrierwave-video" s.version = Carrierwave::Video::VERSION s.authors = ["rheaton"] s.email = ["rachelmheaton@gmail.com"] s.homepage = "htt...
github
rheaton/carrierwave-video
https://github.com/rheaton/carrierwave-video
Rakefile
Ruby
mit
187
master
283
require "bundler/gem_tasks" require 'rspec/core/rake_task' desc 'Default: run specs.' task :default => :spec desc "Run specs" RSpec::Core::RakeTask.new do |t| t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default. # Put spec opts in a file named .rspec in root end
github
rheaton/carrierwave-video
https://github.com/rheaton/carrierwave-video
spec/lib/ffmpeg_theora_spec.rb
Ruby
mit
187
master
1,022
require 'spec_helper' describe CarrierWave::Video::FfmpegTheora do describe "run" do let(:input_file_path) { '/tmp/file.mov' } let(:output_file_path) { '/tmp/file.ogv' } let(:binary) { 'bunnery' } let(:transcoder) { CarrierWave::Video::FfmpegTheora.new(input_file_path, output_file_path) } befor...
github
rheaton/carrierwave-video
https://github.com/rheaton/carrierwave-video
spec/lib/carrierwave_video_spec.rb
Ruby
mit
187
master
12,016
require 'spec_helper' describe CarrierWave::Video do class Video; end class TestVideoUploader include CarrierWave::Video def cached?; end def cache_stored_file!; end def model @video ||= Video.new end end let(:converter) { TestVideoUploader.new } describe ".encode_video" do i...
github
rheaton/carrierwave-video
https://github.com/rheaton/carrierwave-video
lib/carrierwave/video.rb
Ruby
mit
187
master
3,162
require 'streamio-ffmpeg' require 'carrierwave' require 'carrierwave/video/ffmpeg_options' require 'carrierwave/video/ffmpeg_theora' module CarrierWave module Video extend ActiveSupport::Concern def self.ffmpeg2theora_binary=(bin) @ffmpeg2theora = bin end def self.ffmpeg2theora_binary @f...
github
rheaton/carrierwave-video
https://github.com/rheaton/carrierwave-video
lib/carrierwave/video/ffmpeg_options.rb
Ruby
mit
187
master
3,024
module CarrierWave module Video class FfmpegOptions attr_reader :format, :resolution, :custom, :callbacks def initialize(format, options) @format = format.to_s @resolution = options[:resolution] || "640x360" @custom = options[:custom] @callbacks = options[:callbacks] |...
github
rheaton/carrierwave-video
https://github.com/rheaton/carrierwave-video
lib/carrierwave/video/ffmpeg_theora.rb
Ruby
mit
187
master
1,062
module CarrierWave module Video class FfmpegTheora attr_reader :input_path, :output_path def initialize(input_file_path, output_file_path) @input_path = input_file_path @output_path = output_file_path end def run(logger=nil) cmd = "#{CarrierWave::Video.ffmpeg2theor...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
oas_rails.gemspec
Ruby
mit
187
main
1,108
require_relative 'lib/oas_rails/version' Gem::Specification.new do |spec| spec.name = 'oas_rails' spec.version = OasRails::VERSION spec.authors = ['a-chacon'] spec.email = ['andres.ch@protonmail.com'] spec.homepage = 'https://github.com/a-chacon/oas_rails' spec.summary = 'OasRails is a...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
Gemfile
Ruby
mit
187
main
1,568
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } # Specify your gem's dependencies in oas_rails.gemspec. gemspec gem 'puma', '>= 5.0' gem 'sqlite3', '~> 2.1' gem 'sprockets-rails' gem 'rack-cors' gem 'rails', '~> 8.0', '>= 8.0.2' group :development, :test do gem "ru...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/test_helper.rb
Ruby
mit
187
main
1,275
# Configure Rails Environment ENV["RAILS_ENV"] = "test" require_relative "../test/dummy/config/environment" ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)] ActiveRecord::Migrator.migrations_paths << File.expand_path("../db/migrate", __dir__) require "rails/test_help" r...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/oas_rails_test.rb
Ruby
mit
187
main
948
require "test_helper" class OasRailsTest < ActiveSupport::TestCase test "it has a version number" do assert OasRails::VERSION end class MockRouteExtractor < OasRails::Extractors::RouteExtractor def self.host_routes super.select { |route| route.controller.include?("users") } end end test "...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/controllers/oas_rails/oas_rails_controller_test.rb
Ruby
mit
187
main
337
require 'test_helper' module OasRails class OasRailsControllerTest < ActionDispatch::IntegrationTest include Engine.routes.url_helpers test 'should return the front' do get '/docs' assert_response :ok end test 'should return the oas' do get '/docs.json' assert_response :ok ...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/lib/oas_rails/active_record_example_finder_test.rb
Ruby
mit
187
main
1,557
require "test_helper" module OasRails class ActiveRecordExampleFinderTest < ActiveSupport::TestCase def setup @utils = Minitest::Mock.new @factory_bot = Minitest::Mock.new @file = Minitest::Mock.new @finder = ActiveRecordExampleFinder.new(context: :incoming, utils: @utils, factory_bot: @f...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/lib/oas_rails/configuration_test.rb
Ruby
mit
187
main
3,714
require "test_helper" module OasRails class ConfigurationTest < ActiveSupport::TestCase def setup @config = Configuration.new end test "initializes with default values" do assert_equal "3.2.0", @config.instance_variable_get(:@swagger_version) assert_equal "/", @config.api_path as...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/lib/oas_rails/utils_test.rb
Ruby
mit
187
main
734
require "test_helper" module OasRails class UtilsTest < ActiveSupport::TestCase test "detect_test_framework" do result = OasRails::Utils.detect_test_framework assert_equal :factory_bot, result end test "hash to schema" do result = OasRails::Utils.hash_to_json_schema({ name: "String", c...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/lib/oas_rails/extractors/route_extractor_test.rb
Ruby
mit
187
main
1,598
module OasRails module Builders class RouteExtractorTest < Minitest::Test def setup Extractors::RouteExtractor.clear_cache OasRails.config.ignored_actions = [] OasRails.config.include_mode = :all end def teardown Extractors::RouteExtractor.clear_cache Oas...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/lib/oas_rails/builders/esquema_builder_test.rb
Ruby
mit
187
main
1,579
module OasRails module Builders class EsquemaBuilderTest < Minitest::Test def setup @user_klass = User @invalid_klass = Object @custom_schema_class = EasyTalk end def test_build_incoming_schema schema = OasRails::Builders::EsquemaBuilder.build_incoming_schema(kla...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/lib/oas_rails/builders/oas_route_builder_test.rb
Ruby
mit
187
main
4,107
require 'test_helper' module OasRails module Builders class OasRouteBuilderTest < ActiveSupport::TestCase def setup @users_index_route = find_route("users", "index") @projects_show_route = find_route("projects", "show") @typed_index_route = find_route("typed", "index") end ...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/config/routes.rb
Ruby
mit
187
main
419
Rails.application.routes.draw do post '/users/login', to: 'users#login' get "/users/new", to: "users#new" # This route is for testing purpose resources :users, shallow: true do resources :projects resource :avatar, only: [:update], controller: 'users/avatar' end match 'users', to: 'users#index', via: ...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/config/application.rb
Ruby
mit
187
main
1,269
require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) require "oas_rails" module Dummy class Application < Rails::Application config.load_defaults Rails::VERSION::STRING.to_f ...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/config/environments/test.rb
Ruby
mit
187
main
2,575
require "active_support/core_ext/integer/time" # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data the...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/config/environments/production.rb
Ruby
mit
187
main
4,249
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.enable_reloading = false # Eager load code on boot. This eager loads most of Rails and # your app...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/config/environments/development.rb
Ruby
mit
187
main
2,604
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded any time # it changes. This slows down response time but is perfect for developme...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/config/initializers/crs.rb
Ruby
mit
187
main
200
# config/initializers/cors.rb Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do origins '*' resource '*', headers: :any, methods: %i[get post patch put] end end
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/config/initializers/oas_rails.rb
Ruby
mit
187
main
1,970
OasRails.configure do |config| config.source_oas_path = "lib/oas.json" config.info.title = 'Dummy API REST+' config.info.summary = 'Core endpoints of Dummy App.' config.info.description = <<~HEREDOC # Adimuntque regni fuerit ## Et fuissem licet in vetus hic Rhoetus Lorem markdownum currus praetemp...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/lib/json_web_token.rb
Ruby
mit
187
main
334
class JsonWebToken SECRET_KEY = Rails.application.credentials.secret_key_base.to_s def self.encode(payload, exp = 24.hours.from_now) payload[:exp] = exp.to_i JWT.encode(payload, SECRET_KEY) end def self.decode(token) decoded = JWT.decode(token, SECRET_KEY)[0] HashWithIndifferentAccess.new deco...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/app/models/user.rb
Ruby
mit
187
main
525
class User < ApplicationRecord has_secure_password validates :name, presence: true validates :email, presence: true, uniqueness: true has_one_attached :avatar validate :valid_avatar def valid_avatar return unless avatar.attached? errors.add(:avatar, 'size must be less than 5MB') if avatar.blob.b...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/app/controllers/users_controller.rb
Ruby
mit
187
main
4,499
# frozen_string_literal: true # Manage Users Here # # @response_example Another 405 Error (405) # [JSON # { # "message": "another", # "data": { # "availabilities": [ # "three" # ], # "dates": [] # } # } # ] class UsersController < ApplicationController before_action :aut...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/app/controllers/projects_controller.rb
Ruby
mit
187
main
1,055
# Management of `Projects` happend here. class ProjectsController < ApplicationController before_action :set_project, only: %i[show update destroy] # @tags projects def index @projects = Project.all render json: @projects end def show render json: @project end # @tags projects def create...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/app/controllers/typed_controller.rb
Ruby
mit
187
main
454
# frozen_string_literal: true require "sorbet-runtime" # Typed Items API # # @tags Typed class TypedController < ApplicationController extend T::Sig # @summary List typed items # @response Typed items list(200) [Array<String>] sig { void } def index render json: { items: [] } end # @summary Show a...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/app/controllers/application_controller.rb
Ruby
mit
187
main
408
class ApplicationController < ActionController::API def authorize! header = request.headers['Authorization'] header = header.split.last if header begin @decoded = JsonWebToken.decode(header) @current_user = User.find(@decoded[:user_id]) rescue ActiveRecord::RecordNotFound, JWT::DecodeError...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/app/controllers/users/avatar_controller.rb
Ruby
mit
187
main
994
# frozen_string_literal: true module Users class AvatarController < ApplicationController before_action :authorize! before_action :set_user # @summary Upload an avatar # @tags 3. Third # # Uploads an avatar for the user. The avatar must be a valid image file (JPEG, PNG, GIF, SVG or WEBP). ...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/db/schema.rb
Ruby
mit
187
main
2,841
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/db/migrate/20250419163914_add_different_kind_of_variables_to_projects.rb
Ruby
mit
187
main
426
class AddDifferentKindOfVariablesToProjects < ActiveRecord::Migration[7.0] def change add_column :projects, :active, :boolean, default: false add_column :projects, :start_date, :date add_column :projects, :end_date, :datetime add_column :projects, :budget, :decimal, precision: 10, scale: 2 add_col...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/db/migrate/20250528212011_create_active_storage_tables.active_storage.rb
Ruby
mit
187
main
2,176
# 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...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/db/migrate/20240712004600_create_users.rb
Ruby
mit
187
main
206
class CreateUsers < ActiveRecord::Migration[7.0] def change create_table :users do |t| t.string :name t.string :email t.string :password_digest t.timestamps end end end
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/db/migrate/20240718211538_create_projects.rb
Ruby
mit
187
main
241
class CreateProjects < ActiveRecord::Migration[7.0] def change create_table :projects do |t| t.string :name t.text :description t.references :user, null: false, foreign_key: true t.timestamps end end end
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/test/system/users_test.rb
Ruby
mit
187
main
928
require "application_system_test_case" class UsersTest < ApplicationSystemTestCase setup do @user = users(:one) end test "visiting the index" do visit users_url assert_selector "h1", text: "Users" end test "should create user" do visit users_url click_on "New user" fill_in "Email",...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/test/controllers/projects_controller_test.rb
Ruby
mit
187
main
1,036
require "test_helper" class ProjectsControllerTest < ActionDispatch::IntegrationTest setup do @user = users(:one) @project = projects(:one) end test "should get index" do get user_projects_url(@user), as: :json assert_response :success end test "should create project" do assert_differen...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/test/controllers/users_controller_test.rb
Ruby
mit
187
main
1,014
require "test_helper" class UsersControllerTest < ActionDispatch::IntegrationTest include AuthHelper setup do @user = users(:one) assign_token(@user.id) end test "should get index" do get users_url, headers: default_headers assert_response :success end test "should create user" do as...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/dummy/test/controllers/users/avatar_controller_test.rb
Ruby
mit
187
main
1,169
require "test_helper" module Users class AvatarControllerTest < ActionDispatch::IntegrationTest include AuthHelper setup do @user = users(:one) end test "should require authentication" do patch user_avatar_url(@user), params: { avatar: fixture_file_upload('avatar.jpg', 'image/jpeg') }, ...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
test/helpers/auth_helper.rb
Ruby
mit
187
main
243
# frozen_string_literal: true module AuthHelper def assign_token(user_id) token = JsonWebToken.encode(user_id:) default_headers['Authorization'] = "Bearer #{token}" end def default_headers @default_headers ||= {} end end
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
lib/oas_rails.rb
Ruby
mit
187
main
1,938
require "easy_talk" require "oas_core" OasCore.configure_yard! module OasRails require "oas_rails/version" require "oas_rails/engine" autoload :Configuration, "oas_rails/configuration" autoload :Utils, "oas_rails/utils" autoload :JsonSchemaGenerator, "oas_rails/json_schema_generator" autoload :ActiveReco...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
lib/generators/oas_rails/config/config_generator.rb
Ruby
mit
187
main
286
module OasRails module Generators class ConfigGenerator < Rails::Generators::Base source_root File.expand_path('templates', __dir__) def copy_initializer_file template "oas_rails_initializer.rb", "config/initializers/oas_rails.rb" end end end end
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
lib/generators/oas_rails/config/templates/oas_rails_initializer.rb
Ruby
mit
187
main
4,741
# config/initializers/oas_rails.rb OasRails.configure do |config| # Basic Information about the API config.info.title = 'OasRails' config.info.version = '1.0.0' config.info.summary = 'OasRails: Automatic Interactive API Documentation for Rails' config.info.description = <<~HEREDOC # Welcome to OasRails ...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
lib/oas_rails/engine.rb
Ruby
mit
187
main
232
module OasRails class Engine < ::Rails::Engine isolate_namespace OasRails config.app_middleware.use( Rack::Static, urls: ["/oas-rails-assets"], root: OasRails::Engine.root.join("public") ) end end
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
lib/oas_rails/active_record_example_finder.rb
Ruby
mit
187
main
2,304
module OasRails class ActiveRecordExampleFinder def initialize(context: :incoming, utils: Utils, factory_bot: FactoryBot, erb: ERB, yaml: YAML, file: File) @context = context @utils = utils @factory_bot = factory_bot @erb = erb @yaml = yaml @file = file @factory_examples ...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
lib/oas_rails/utils.rb
Ruby
mit
187
main
3,930
module OasRails module Utils TYPE_MAPPING = { 'String' => 'string', 'Integer' => 'number', 'Float' => 'number', 'TrueClass' => 'boolean', 'FalseClass' => 'boolean', 'Boolean' => 'boolean', 'NilClass' => 'null', 'Hash' => 'object', 'Object' => 'object', '...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
lib/oas_rails/configuration.rb
Ruby
mit
187
main
2,172
module OasRails class Configuration < OasCore::Configuration attr_accessor :autodiscover_request_body, :autodiscover_responses, :ignored_actions, :rapidoc_theme, :layout, :source_oas_path, :rapidoc_configuration, :rapidoc_logo_url attr_reader :route_extractor, :include_mode, :mounted_path, :prefix_path d...
github
a-chacon/oas_rails
https://github.com/a-chacon/oas_rails
lib/oas_rails/builders/oas_route_builder.rb
Ruby
mit
187
main
5,746
module OasRails module Builders class OasRouteBuilder # Gems/frameworks (like Sorbet) may wrap methods at runtime, causing # +instance_method.source_location+ to point to the wrapper rather than # the original source file. We detect this and fall back to reading the # source file directly ...