hexsha stringlengths 40 40 | size int64 2 1.01M | content stringlengths 2 1.01M | avg_line_length float64 1.5 100 | max_line_length int64 2 1k | alphanum_fraction float64 0.25 1 |
|---|---|---|---|---|---|
f8ce1358e4b82ad1245dc778e38839ac41274f5f | 1,488 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require 'rails'
require 'action_mailer'
require 'rails-mailgun'
RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.moc... | 33.818182 | 79 | 0.74664 |
ac97a49119a2239daeb794fba65453e89eb69b0e | 272 | AssetSync.configure do |config|
config.fog_provider = 'AWS'
config.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID_IAM']
config.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY_IAM']
config.fog_directory = 'portfoliofabrizio'
config.fog_region = 'eu-central-1'
end
| 34 | 65 | 0.786765 |
1a3866cf360f318cdcc548cb32a57de9561faf78 | 2,692 | class Customer::OrdersController < Customer::CustomerApplicationController
include ActionView::Helpers::NumberHelper
before_action :authenticate_customer!, only: [:index, :new, :create]
after_action :inc_total, only: [:create, :update]
before_action :set_order, only: [:edit, :update, :destroy]
before_action :... | 29.582418 | 104 | 0.670877 |
f80c3a914751daaeaddd525c3c4238423d59981d | 3,550 | module Commands
module Brewx
extend CommandHelpers
class << self
def init
require "yaml/store"
require_relative "../lib/cri_command_support"
extend CriCommandSupport
end
def run(args)
root_cmd = build_root_cmd
root_cmd.run(args, {}, hard_exit: false... | 26.691729 | 118 | 0.527887 |
e202d8df62b9f93c6b25a0acc0734a0d80fded01 | 669 | Pod::Spec.new do |s|
s.name = 'CoreTextLabel'
s.version = '1.3.2'
s.summary = "Label to draw NSAttributedString or HTML with custom font and color. textIsTruncated, numberOfLines and lineSpacing is supported."
s.homepage = "https://github.com/appfarms/CoreTextLabel"
s.author ... | 47.785714 | 152 | 0.612855 |
6a879e280c3edb14e0a48cf129c123ed87ab93df | 23,074 | # -*- encoding: utf-8 -*-
# This file generated automatically using vocab-fetch from etc/xsd.ttl
require 'rdf'
module RDF
class XSD < RDF::Vocabulary("http://www.w3.org/2001/XMLSchema#")
# Datatype definitions
term :ENTITIES,
comment: %(
ENTITIES represents the ENTITIES attribute type from [XML]. T... | 44.034351 | 86 | 0.68653 |
d597e0817c0d5ed652ba005c3470bd4023580996 | 2,787 | require './test/test_helper'
require 'backports/2.3.0/queue/close'
require 'backports/ractor/filtered_queue'
class FilteredQueueTest < Test::Unit::TestCase
def setup
@q = ::Backports::FilteredQueue.new
end
def assert_remains(*values)
remain = []
remain << @q.pop until @q.empty?
assert_equal valu... | 25.336364 | 85 | 0.584141 |
f7a0fafee69c15f9a7f2d0c62920fc1dfe9d3361 | 2,469 |
require 'Bacon_Colored'
require 'uga_uga'
require 'pry'
require 'awesome_print'
module Bacon
class Context
def clean o
return o.strip if o.is_a?(String)
return o unless o.is_a?(Array) || o.is_a?(Uga_Uga)
return clean(o.stack) if o.respond_to?(:stack)
o.inject([]) do |memo, hash|
... | 22.651376 | 91 | 0.480356 |
f818d368204f38fd00a05f634080a348a3f0060e | 294 | class RemoveDuplicatesDeadlineTypes < ActiveRecord::Migration
def up
execute <<-SQL
update due_dates set deadline_type_id=7 where deadline_type_id=9
SQL
execute <<-SQL
delete from deadline_types where id=9
SQL
end
def down
end
end
| 15.473684 | 75 | 0.64966 |
1c6ee0bad34dff687b4981bd5f7824ca68f36e51 | 3,051 | require 'spec_helper'
describe Locomotive::Concerns::Site::AccessPoints do
let(:domains) { [] }
let(:site) { build(:site, domains: domains) }
describe '#domains=' do
it 'downcases the domains' do
site.domains = ['FIRST.com', 'second.com', 'THIRD.com']
expect(site.domains).to eq(['first.com', ... | 23.469231 | 127 | 0.601114 |
f81305b57fafd7ea539f47f87ccbab53c617b208 | 799 | class TweetsController < ApplicationController
before_action :require_signed_in!
def index
@tweets = current_user.tweets
end
def new
@tweet = Tweet.new
end
def create
@tweet = current_user.tweets.new(tweet_params)
if @tweet.save
redirect_to tweet_url(@tweet)
else
flash.no... | 17.369565 | 54 | 0.668335 |
d5bcf422ce72934158876c632839dee21003cd02 | 1,563 | class Api::V1::SubmissionsController < ApplicationController
include ActionController::ImplicitRender
include SubmissionsHelper
def index
@type = type_for(params[:type])
@sort = sort_for(params[:sort])
@submissions = if params[:approved] == "0"
Submission.all
else
Submission.valid
... | 23.328358 | 90 | 0.636596 |
1ddf5ebee5413f89b76d78a9a0fb66d10ac10989 | 235 | # == Schema Information
#
# Table name: FORMAT
#
# id :integer not null, primary key
# format_name :string(20)
# av_category :string(3)
#
class Legacy::Format < Legacy::OracleBase
self.table_name = 'FORMAT'
end
| 18.076923 | 54 | 0.642553 |
2839f31fffee46b05dd6972df8c120d7fa5d4660 | 172 | class Api::V1::BaseController < ApplicationController
if Rails.env.production?
include ApiErrorConcern
end
self.responder = ApiResponder
respond_to :json
end
| 17.2 | 53 | 0.767442 |
f87a26f7107a2b2aceee1fcb411c8ad568ba7493 | 137 | # frozen_string_literal: true
FactoryBot.define do
factory :health_benefit, class: 'FinancialAssistance::HealthBenefit' do
end
end
| 17.125 | 73 | 0.79562 |
e83c7e41de83126bce22952f1c298f028ee274c4 | 1,208 | # Stream names are how we identify which updates should go to which users. All streams run over the same
# <tt>Turbo::StreamsChannel</tt>, but each with their own subscription. Since stream names are exposed directly to the user
# via the HTML stream subscription tags, we need to ensure that the name isn't tampered wit... | 48.32 | 123 | 0.764901 |
211b5d81a6946df82e13229bf6446d2c8922a581 | 1,009 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'prmd/version'
Gem::Specification.new do |spec|
spec.name = "prmd"
spec.version = Prmd::VERSION
spec.authors = ["geemus"]
spec.email = ["geemus@gmail.com"]
s... | 36.035714 | 78 | 0.64222 |
0336cd203424d5beba6f2e3e9ea27843823ff1a7 | 1,466 | require 'test_helper'
class ProblemsControllerTest < ActionController::TestCase
setup do
@problem = problems(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:problems)
end
test "should get new" do
get :new
assert_response :success
en... | 29.32 | 271 | 0.731241 |
5dff47eb2201c8f3e66ea6920919d6b6019206ce | 9,944 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe CARMA::Models::Submission, type: :model do
describe '#carma_case_id' do
it 'is accessible' do
value = 'aB935000000A9GoCAK'
subject.carma_case_id = value
expect(subject.carma_case_id).to eq(value)
end
end
describe '#s... | 32.077419 | 110 | 0.632542 |
f72d7234479b91f31b13c4abc08a39a20044c276 | 1,196 | require_relative "boot"
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_mailbox/engine"
require "action_text/en... | 30.666667 | 79 | 0.766722 |
ac38a882b9e345603a000f116495481a0a990996 | 8,355 | # frozen_string_literal: true
require "active_record"
require "rails"
require "active_model/railtie"
# For now, action_controller must always be present with
# Rails, so let's make sure that it gets required before
# here. This is needed for correctly setting up the middleware.
# In the future, this might become an o... | 36.806167 | 171 | 0.702214 |
8775826877b0dbb9d460e42b99c112c95936347c | 252 | require 'rails_helper'
module Lama
describe CartController, type: :controller do
routes { Lama::Engine.routes }
render_views
it 'can add to cart' do
get 'add', format: :json
expect(parsed_body).to be_empty
end
end
end
| 18 | 47 | 0.670635 |
6a0a9690929733d4dc8533bcae5b47869b9d8eb7 | 3,110 | require "support"
class TestList < Omise::Test
setup do
attributes = JSON.parse(JSON.generate({
object: "list",
location: "/charges",
offset: 0,
limit: 20,
total: 40,
data: 20.times.map { |i| { object: "charge", id: "chrg_#{i}" } },
}))
@parent = Object.... | 30.490196 | 83 | 0.727974 |
d537b4b488f1d02b2a4d8d6010d9c23724e92b30 | 2,648 | # frozen_string_literal: true
module Boring
module Pundit
class InstallGenerator < Rails::Generators::Base
desc "Adds pundit to the application"
class_option :skip_ensuring_policies, type: :boolean, aliases: "-s",
desc: "Skip before_action to ensure user is authorized"
class... | 33.1 | 136 | 0.637085 |
ed35aea228a1cd9acadcefd312a9909384d2def2 | 546 | cask 'instead' do
version '3.1.2'
sha256 '880d2e8f77a99cab8bac110cfb8473acf951c87b2bc26f8ac81870537e4174ae'
# sourceforge.net/instead was verified as official when first introduced to the cask
url "https://downloads.sourceforge.net/instead/instead/#{version}/Instead-#{version}.dmg"
appcast 'https://sourcefor... | 39 | 91 | 0.78022 |
e2192d683d17eeb25b3297524cde18c05053d25d | 268 | # frozen_string_literal: true
FactoryBot.define do
factory :channel_instagram_fb_page, class: 'Channel::FacebookPage' do
page_access_token { SecureRandom.uuid }
user_access_token { SecureRandom.uuid }
page_id { SecureRandom.uuid }
account
end
end
| 24.363636 | 71 | 0.757463 |
087fe29f13e0b3c8ee05bb5a0b961dc3dcd39c80 | 945 | module FloodRiskEngine
class SendEnrollmentSubmittedEmail
def initialize(enrollment)
@enrollment = enrollment
end
def call
validate_enrollment
distinct_recipients.each do |recipient|
EnrollmentMailer.submitted(enrollment_id: enrollment.id,
re... | 22.5 | 101 | 0.686772 |
5d7d679ae183e67e90c6ff742d3baafddd781cfd | 1,492 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/dialogflow/v2/conversation_event.proto
require 'google/api/annotations_pb'
require 'google/cloud/dialogflow/v2/participant_pb'
require 'google/rpc/status_pb'
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.buil... | 37.3 | 154 | 0.743298 |
21e4bfc1c6bcb17cdeca02f916d00af528b1f008 | 872 | # encoding: UTF-8
require 'blogger_api'
class BloggerService < ActionWebService::Base
web_service_api BloggerAPI
def initialize
@postid = 0
end
def newPost(key, id, user, pw, content, publish)
$stderr.puts "id=#{id} user=#{user} pw=#{pw}, content=#{content.inspect} [#{publish}]"
(@postid += 1).to... | 24.222222 | 94 | 0.619266 |
e2e1aa75d11960c5548e6010cb1a95c2acf52105 | 347 | require "tasks/data_hygiene/schema_validator"
namespace :schema_validation do
desc "validates all content items for a given format producing a report of errors"
task :errors_for_format, [:schema_name] => :environment do |_t, args|
schema_name = args[:schema_name]
DataHygiene::SchemaValidator.new(schema_nam... | 34.7 | 84 | 0.78098 |
2830a47d71abfa2f6c45575cce69c76c9297d43a | 2,982 | require 'vagrant/systems/linux/error'
require 'vagrant/systems/linux/config'
module Vagrant
module Systems
class Linux < Base
def distro_dispatch
vm.ssh.execute do |ssh|
if ssh.test?("cat /etc/debian_version")
return :debian if ssh.test?("cat /proc/version | grep 'Debian'")
... | 35.927711 | 137 | 0.558685 |
21308ca2f0b1280581bb6beafb27e2aa4e7f83b2 | 2,929 | # frozen_string_literal: false
module Hyperlapse
class Generator
def initialize(config_manager)
@config = config_manager.config
@pics_dir = config_manager.pics_dir
@maps_dir = config_manager.maps_dir
@empty_dir = config_manager.empty_dir
@output_dir = config_manager.output_dir
... | 30.831579 | 74 | 0.632981 |
261e91b65056b6bd5ec06e06a93c2395bc1b59ea | 1,043 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::Settings::RepositoryController do
let(:project) { create(:project_empty_repo, :public) }
let(:user) { create(:user) }
before do
project.add_maintainer(user)
sign_in(user)
end
describe 'GET show' do
context 'push rule'... | 23.704545 | 85 | 0.651965 |
e246e08372f6bedbc1e3955f911cc95b886f9a34 | 2,655 |
class SectionRowConverter < BaseRowConverter
@model_class = :Section
@@slugs = []
def setup_object
object = setup_object_by_slug(attrs)
if object.directive.present? && object.directive != @importer.options[:directive]
add_error(:slug, "Code is used in #{object.directive.meta_kind.to_s.titleize}:... | 26.029412 | 111 | 0.700942 |
b91a6f2c2c792bcddd0e02ffdeaed080af875343 | 365 | class Topic < ActiveRecord::Base
validates_presence_of :author_name
validates :title, numericality: { only_integer: true }, on: :context_test
has_many :books, inverse_of: :topic
belongs_to :parent, class_name: "Topic"
composed_of :description, mapping: [%w(title title), %w(author_name author_name)], allow_n... | 36.5 | 132 | 0.761644 |
f8b12507966b4f41013261720162e0e68fa0db66 | 539 | class UsersController < ApplicationController
before_action :require_user!
def edit
@timezones = ActiveSupport::TimeZone.all.collect(&:name).sort.map! { |zone| [zone, zone] }
end
def update
if @current_user.update(user_params)
@current_user.save!
flash[:success] = I18n.t('users.update.succ... | 22.458333 | 94 | 0.679035 |
08048314d006ff3ba198dea998404d74eecda134 | 378 | require 'rails/railtie'
require 'mandrill_action_mailer/delivery_handler'
module MandrillActionMailer
class Railtie < Rails::Railtie
config.mandrill_action_mailer = MandrillActionMailer.config
initializer 'mandrill_action_mailer.add_delivery_method' do
ActionMailer::Base.add_delivery_method(:mandrill,... | 29.076923 | 94 | 0.81746 |
388feb71912faca778bdf7a1b1b982c65bfe0e72 | 7,301 | require 'spec_helper'
WORKING_SPEC_VERSION = '2.19.0'.freeze
describe 'cfndsl', type: :aruba do
let(:usage) do
<<-USAGE.gsub(/^ {6}/, '').chomp
Usage: cfndsl [options] FILE
-o, --output FILE Write output to file
-y, --yaml FILE Import yaml file as local ... | 41.016854 | 134 | 0.658129 |
abace6ee84acc090262b4fd8c9aa6c6a2b7c2a60 | 74 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'tome'
| 24.666667 | 58 | 0.716216 |
217b10d1bfec87578ccdd7f2961f614f785800eb | 556 | class TweetParser
attr_reader :tweets
def initialize(user)
@tweets = (user.user_tweet ? user.user_tweet.tweets : nil)
end
def parse
results = []
@tweets.each do |tweet|
results << {
display_name: tweet["user"]["name"],
user_name: tweet["user"]["screen_name"],
avatar: ... | 24.173913 | 62 | 0.604317 |
e2d9234a8afa3578d3d9679ef73a4afb2ebb25d3 | 3,956 | module ActiveScaffold
module Helpers
# A bunch of helper methods to produce the common view ids
module IdHelpers
def id_from_controller(controller)
controller.to_s.gsub("/", "__").html_safe
end
def controller_id(controller = (params[:eid] || params[:parent_controller] || params[:con... | 30.90625 | 105 | 0.593023 |
e9df1f6cebdd7420c52fb7b68c0487877429e975 | 7,622 | # Copyright 2011-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | 29.773438 | 82 | 0.643007 |
39eda9ecfdf3bc104f36c3044aa103128186605b | 425 | require 'spec_helper'
describe GeoNamesAPI::CountrySubdivision do
describe "::find" do
it "should find one subdivision" do
result = GeoNamesAPI::CountrySubdivision.find("50.01","10.2")
result.should be_present
end
end
describe "::all" do
it "should find multiple subdivisions" do
re... | 25 | 67 | 0.684706 |
91e15ad0128b5a346e4ed0c6f0d996f50ae420a2 | 1,055 | require 'curb'
require 'github_api'
require 'json'
require 'nokogiri'
class Feed
attr_reader :version
attr_reader :url, :sha256
def initialize(name)
@name = name
end
def get_binding
binding()
end
def github(owner, repo, options = {})
options[:draft] = false if options[:draft].nil?
opti... | 24.534884 | 150 | 0.670142 |
1aeb4964eb88f5fec9b0bb0903a13320af436560 | 2,069 | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# This cop checks for trailing comma in hash literals.
# The configuration options are:
#
# * `consistent_comma`: Requires a comma after the
# last item of all non-empty, multiline hash literals.
# * `comma`:... | 21.112245 | 66 | 0.389077 |
919c749cb9d52dd179c88d407b7dc87b4d523125 | 3,420 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 39.767442 | 104 | 0.758187 |
114b25348c8cbb7f059b5e5024628c696e5938db | 1,000 | require File.dirname(__FILE__) + '/../../spec_helper'
describe "Fixnum#quo" do
it "returns the result of self divided by the given Integer as a Float" do
2.quo(2.5).should == 0.8
5.quo(2).should == 2.5
45.quo(0xffffffff).should_be_close(1.04773789668636e-08, TOLERANCE)
end
it "does not raise a ZeroD... | 27.027027 | 83 | 0.648 |
79f5cab92f1666be07b3af8dbb2983ceb4b75455 | 1,571 | =begin
#RadioManager
#RadioManager
OpenAPI spec version: 2.0
Contact: support@pluxbox.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.3.0
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for RadioManagerClient::TagRelationsContacts
# Automaticall... | 25.754098 | 103 | 0.733291 |
033fc33902fd741cf8d4fc20c1db29da73aef78e | 2,776 | describe "StoreExtension" do
before do
NanoStore.shared_store = NanoStore.store
end
after do
NanoStore.shared_store = nil
end
class Animal < NanoStore::Model
attribute :name
end
it "should open and close store" do
NanoStore.shared_store.open
NanoStore.shared_store.closed?.should.b... | 21.6875 | 88 | 0.628963 |
79bb93cbbe0ad2079160c442f66070e4520db340 | 1,358 | #
# Be sure to run `pod lib lint UMQCWorking.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'UMQCWor... | 32.333333 | 110 | 0.662003 |
f8bd1750411fd4898ab5b4cfd3a759fb59b121ee | 434 | require 'rails_helper'
feature 'cac proofing verify info step' do
include CacProofingHelper
before do
sign_in_and_2fa_user
complete_cac_proofing_steps_before_verify_step
end
it 'is on the correct page' do
expect(page).to have_current_path(idv_cac_proofing_verify_step)
end
it 'proceeds to the... | 20.666667 | 68 | 0.781106 |
28a294e61f759bd68d954307d5ca43fba31784eb | 1,031 | Gem::Specification.new do |s|
s.name = 'rbthemis'
s.version = '0.11.0'
s.date = '2019-03-28'
s.summary = 'Data security library for network communication and data storage for Ruby'
s.description = 'Themis is a data security library, providing users with high-quality security services for... | 64.4375 | 375 | 0.695441 |
01b127397fec3058c99561532ae0c4d91e41a3a7 | 2,111 | # frozen_string_literal: true
class Fisk
module Instructions
# Instruction VFRCZPD: Extract Fraction Packed Double-Precision Floating-Point
VFRCZPD = Instruction.new("VFRCZPD", [
# vfrczpd: xmm, xmm
Form.new([
OPERAND_TYPES[26],
OPERAND_TYPES[24],
].freeze, [
Class.new... | 27.064103 | 82 | 0.503553 |
91b4ebd8fa19f55aa81c9ecb0318983468d27a90 | 3,603 | class User < ApplicationRecord
has_many :microposts, dependent: :destroy
has_many :active_relationships, class_name: "Relationship",
foreign_key: "follower_id",
dependent: :destroy
has_many :passive_relationships, class_name: "Relationship",
... | 31.884956 | 135 | 0.68443 |
ff221bf27b50aa98330fe2f3c5cc7e3a32bf4c0d | 144 | require 'test_helper'
class MmsIntegrationTest < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, MmsIntegration
end
end
| 18 | 50 | 0.784722 |
21571de24179fc5f06423e56547790b922219cb9 | 8,732 | namespace :spec do
# This set of tasks will run ci and retrieve the proper version of specs.
# The specs below this section will run specs, but they will not retrieve
# the specs they run against. This is so we can run the similiar mspec
# runs against a stable and head version of the rubyspecs.
desc "Run... | 36.383333 | 106 | 0.698923 |
ab8d9317c18245074de7a2ce0ae610d8091b1aa1 | 3,061 | class GhcAT88 < Formula
desc "Glorious Glasgow Haskell Compilation System"
homepage "https://haskell.org/ghc/"
url "https://downloads.haskell.org/~ghc/8.8.4/ghc-8.8.4-src.tar.xz"
sha256 "f0505e38b2235ff9f1090b51f44d6c8efd371068e5a6bb42a2a6d8b67b5ffc2d"
license "BSD-3-Clause"
revision 1
bottle do
sha2... | 34.393258 | 99 | 0.690297 |
383b28f0e58ce1d276a0176953ba8f815b2fbac2 | 1,233 | control 'PHTN-67-000063' do
title "The Photon operating system RPM package management tool must
cryptographically verify the authenticity of all software packages during
installation."
desc "Installation of any non-trusted software, patches, service packs,
device drivers, or operating system components can signifi... | 32.447368 | 79 | 0.714517 |
abf57c9d93b4110d320072f5d59c8030ed870271 | 1,024 | require 'test_helper'
module MoCo
describe CompilerRegister do
before { Singleton.__init__(CompilerRegister) }
after { reset_register }
it 'registers the compiler class for the source extension' do
HtmlCompiler.register('haml')
assert_equal HtmlCompiler, MoCo.compiler_for('haml')
end
... | 24.380952 | 76 | 0.671875 |
ac95bac4adcee84af924cd7f2591d1a37d71e178 | 8,951 | require 'cases/helper'
require 'models/topic' # For booleans
require 'models/pirate' # For timestamps
require 'models/parrot'
require 'models/person' # For optimistic locking
class Pirate # Just reopening it, not defining it
attr_accessor :detected_changes_in_after_update # Boolean for if changes are detected... | 29.156352 | 87 | 0.720366 |
4a29675957091d4c13a8e065f4b946c1ce7db341 | 4,140 | require File.expand_path('../spec_helper', __FILE__)
describe Rack::Parser do
it "allows you to setup parsers for content types" do
middleware = Rack::Parser.new ParserApp, :parsers => { 'foo' => 'bar' }
assert_equal 'bar', middleware.parsers['foo']
end
it "should not remove fields from options in setu... | 37.636364 | 93 | 0.628986 |
339a57a1f209b02dfbb69e0816628c7587ac8df1 | 40,121 | require 'spec_helper'
describe API::Runner do
include StubGitlabCalls
let(:registration_token) { 'abcdefg123456' }
before do
stub_gitlab_calls
stub_application_setting(runners_registration_token: registration_token)
end
describe '/api/v4/runners' do
describe 'POST /api/v4/runners' do
con... | 34.797051 | 129 | 0.565664 |
abb560f1b4c641b25b10452b9e87a0f43d4d6c3d | 39 | module Polycom
VERSION = "0.1.0"
end
| 9.75 | 19 | 0.666667 |
ac3c03bf7a7e911b957da5cf56413563cc35c571 | 7,529 | =begin
#Kubernetes
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.2.3
=end
require 'date'
module Kubernetes
# MetricStatus describes t... | 32.038298 | 334 | 0.634214 |
e8ee0814ab17d9e9722e7312c1ea806af08d1fae | 303 | Sequel.migration do
up do
create_table(:contestants) do
primary_key :id
Integer :contest_id
String :first_name
String :last_name
DateTime :start_time_at
DateTime :end_time_at
String :end_time
end
end
down do
drop_table(:contestants)
end
end | 17.823529 | 33 | 0.660066 |
6a561d408bdd01b44ad10ece1e033d8914507312 | 1,274 | gem 'minitest', '~> 5.2'
require 'minitest/autorun'
require 'minitest/pride'
require_relative 'dragon'
class DragonTest < Minitest::Test
def test_it_has_a_name
dragon = Dragon.new("Ramoth", :gold, "Lessa")
assert_equal "Ramoth", dragon.name
end
def test_it_has_a_rider
dragon = Dragon.new("Ramoth", ... | 21.233333 | 53 | 0.688383 |
ed7ece23bb56b31e17311fe83fa023ab73196d65 | 1,679 | # frozen_string_literal: true
RSpec.describe Mutant::Expression::Parser do
let(:object) { Mutant::Config::DEFAULT.expression_parser }
describe '#call' do
subject { object.call(input) }
context 'on nonsense' do
let(:input) { 'foo bar' }
it 'raises an exception' do
expect { subject }.t... | 23.985714 | 84 | 0.595593 |
26596afe415dfdf241c1cbc54bc5d6c8da8c7ff8 | 944 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 32.551724 | 74 | 0.733051 |
0323d48406f5a8a2ce0eb42ba8e7136fc2ea2203 | 149 | class RemoveNumTotalEpisodeFromSeason < ActiveRecord::Migration[5.1]
def change
remove_column :seasons, :num_total_episode, :integer
end
end
| 24.833333 | 68 | 0.791946 |
03ad7c116ed15d8a3465d43e8d72c76320711128 | 2,217 | class CrystalLang < Formula
desc "Fast and statically typed, compiled language with Ruby-like syntax"
homepage "http://crystal-lang.org/"
url "https://github.com/manastech/crystal/archive/0.10.1.tar.gz"
sha256 "f567866ea4cf7d0ca1356806f4871c964eca939ddcd93796ecc0e3f3889cd7f3"
head "https://github.com/manastec... | 32.602941 | 109 | 0.713577 |
e9d6748c4420f16f9875103cf087a2204a390950 | 101 | json.extract! @strategy, :id, :name, :draw_type, :range, :interest, :sigma, :created_at, :updated_at
| 50.5 | 100 | 0.712871 |
bbd31d8b55385639b4af62cc199c76ed89746229 | 85 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'google_timeline'
| 28.333333 | 58 | 0.752941 |
aba46eb6405e90c0c90247c48a72bdf521319a68 | 29,336 |
Point = Struct.new(:x, :y)
Claim = Struct.new(:id, :x, :y, :w, :h) do
include Enumerable
def each
return unless block_given?
(x...(x + w)).each do |xp|
(y...(y + h)).each do |yp|
yield Point.new xp, yp
end
end
end
def top_left
Point.new x, y
end
def bottom_right
... | 21.586461 | 72 | 0.633181 |
6a774d508bfa82ba64c7f018a1e9bf1042ef3011 | 2,624 | cask 'nvidia-web-driver' do
if MacOS.version <= :yosemite
version '346.02.03f14'
sha256 '21df2785257c58b940168b4d4ff73e32f71e9f7e28ed879bf0d605e4abc74aef'
elsif MacOS.version <= :el_capitan
version '346.03.15f16'
sha256 'f0c1a23a262ba6db35f1d7a0da39e7b7648805d63d65be20af33e582cc7050bc'
elsif MacOS... | 35.945205 | 131 | 0.556784 |
1cf4f718fac036c478a29bed91ed75d08c6e8acb | 66 | module Gcpc
module Interceptors
VERSION = "0.0.2"
end
end
| 11 | 21 | 0.666667 |
28f8f758afd2eff45b55d2d565afadf1469a2297 | 1,166 | # frozen_string_literal: true
require "ruby_event_store/rom"
MIGRATIONS_PATH = "db/migrate".freeze
desc "Setup ROM EventRespository environment"
task "db:setup" do
Dir.chdir(Dir.pwd)
ROM::SQL::RakeSupport.env = ::RubyEventStore::ROM.configure(:sql).rom_container
end
desc "Copy RubyEventStore SQL migrations to d... | 31.513514 | 104 | 0.663808 |
1a229e3b87d99b890a8f38e33a256ecc66d344f3 | 57 | require 'carpetbomb/engine'
require 'carpetbomb/version'
| 19 | 28 | 0.824561 |
f78ea364147a0b20e0784c9db66c675ed7e8296f | 4,404 | # frozen_string_literal: true
# Use this for testing how a GraphQL query handles sorting and pagination.
# This is particularly important when using keyset pagination connection,
# which is the default for ActiveRecord relations, as certain sort keys
# might not be supportable.
#
# sort_param: the value to specify the... | 34.139535 | 114 | 0.689827 |
1af067ee83056fb1a9608dce4adfb7a8cde6bf69 | 1,091 | require 'test_helper'
require 'tilt'
begin
require 'tilt/rst-pandoc'
class RstPandocTemplateTest < Minitest::Test
test "is registered for '.rst' files" do
assert_equal Tilt::RstPandocTemplate, Tilt['test.rst']
end
test "compiles and evaluates the template on #render" do
template = Tilt::R... | 33.060606 | 103 | 0.654445 |
18a36486a2165514d8670ae64d8e820f606f36c0 | 31,714 | #
# Cookbook:: websphere
# Resource:: websphere_base
#
# Copyright:: 2015-2021 J Sainsburys
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | 43.325137 | 247 | 0.633979 |
03ff259c788ed78696f7fb8dc94f84623fda8a52 | 11,675 | module SlackGamebot
module Commands
class Set < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
class << self
def set_nickname(client, data, user, v)
target_user = user
slack_mention = v.split.first if v
if v && User.slack_mentio... | 47.45935 | 184 | 0.603084 |
280676df2476dabde401b11b17c59ba847d93a79 | 5,220 | #
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# htt... | 33.896104 | 125 | 0.561877 |
38a9ce361dd3c5a63345b527a424f547bfb31823 | 16,355 | module ActiveSupport
module NumberHelper
extend ActiveSupport::Autoload
eager_autoload do
autoload :NumberConverter
autoload :NumberToRoundedConverter
autoload :NumberToDelimitedConverter
autoload :NumberToHumanConverter
autoload :NumberToHumanSizeConverter
autoload :Numbe... | 47.268786 | 106 | 0.568389 |
916c205642bf5bbda5b8f94d5368bd7ae3f9cac2 | 62,886 | require 'pedant/rspec/common'
require 'pedant/acl'
describe "ACL API", :acl do
include Pedant::ACL
# Generate random string identifier prefixed with current pid
def rand_id
"#{Process.pid}_#{rand(10**7...10**8).to_s}"
end
# (temporarily?) deprecating /users/*/_acl endpoint due to its broken sta... | 39.700758 | 111 | 0.45829 |
1888f5b82c03a22988fa7bf917d4e01f0aef5ff8 | 4,427 | # frozen_string_literal: true
require 'bolt/task'
# Installs the puppet-agent package on targets if needed then collects facts, including any custom
# facts found in Bolt's modulepath.
#
# Agent detection will be skipped if the target includes the 'puppet-agent' feature, either as a
# property of its transport (PCP) ... | 42.980583 | 107 | 0.691891 |
1d3e741c06f73d674f39f517ab3ec5fe07187953 | 3,451 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::MediaServices::Mgmt::V2019_05_01_preview
module Models
#
# A metric emitted by service.
#
class Metric
include MsRestAzure
# @re... | 29.245763 | 79 | 0.470009 |
e2ec62f3723c5519281e7ab6f1da4a1c04103a95 | 469 | # frozen_string_literal: true
require "./config/environment"
class ApplicationController < Sinatra::Base
configure do
set :public_folder, "public"
set :views, "app/views"
enable :sessions
set :session_secret, "password_security"
end
get "/" do
erb :index
end
helpers do
def logged_i... | 17.37037 | 78 | 0.675906 |
39a2e628f25fcf7c9eead318ef068c6d0fd4f46e | 1,245 | class Dive < Formula
desc "Tool for exploring each layer in a docker image"
homepage "https://github.com/wagoodman/dive"
url "https://github.com/wagoodman/dive.git",
:tag => "v0.7.2",
:revision => "09296c0214c4cc7477fe53bc79c54805899c6d19"
bottle do
cellar :any_skip_relocation
sha256 "4736... | 28.953488 | 93 | 0.693976 |
1a1537707ed1b1d5bcd7a824d59bab7e06046a38 | 30,620 | require_relative 'test_helper'
require 'rack/cache/context'
describe Rack::Cache::Context do
before { setup_cache_context }
after { teardown_cache_context }
it 'passes options to the underlying stores' do
app = CacheContextHelpers::FakeApp.new(200, {}, ['foo'])
context = Rack::Cache::Context.new(app, f... | 29.64182 | 127 | 0.664729 |
1ce76490448c68594e6ebd088e07f3faeaa03ac1 | 1,376 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ContainerExpirationPolicy, type: :model do
describe 'relationships' do
it { is_expected.to belong_to(:project) }
end
describe 'validations' do
it { is_expected.to validate_presence_of(:project) }
describe '#enabled' do
it { i... | 32.761905 | 71 | 0.674419 |
01b8d397590d6355c54492eb1d86a834a9575970 | 2,222 | # frozen_string_literal: true
require "rails_helper"
describe Auth::EveOnlineSso::CallbacksController do
it { should be_a(ApplicationController) }
it { should rescue_from(EveOnline::Exceptions::ServiceUnavailable).with(:handle_service_unavailable) }
it { should rescue_from(EveOnline::Exceptions::InternalServe... | 33.164179 | 132 | 0.720072 |
115ab946224fadcf4f314fe8910443fe5d91e1f2 | 27,488 | require 'spec_helper'
class FakeCalculator < Spree::Calculator
def compute(computable)
5
end
end
describe Spree::Order, :type => :model do
let(:user) { stub_model(Spree::LegacyUser, :email => "spree@example.com") }
let(:order) { stub_model(Spree::Order, :user => user) }
before do
allow(Spree::Legac... | 30.781635 | 141 | 0.660506 |
0333e0664eeb7569b91717ec16831a93e82c57b3 | 4,335 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject,... | 31.875 | 91 | 0.690888 |
ed02f83bb3ee158256c91b4cfc7c9b5ba8fea556 | 3,742 | module MediaInstagramItem
extend ActiveSupport::Concern
INSTAGRAM_URL = /^https?:\/\/(www\.)?instagram\.com\/(p|tv)\/([^\/]+)/
included do
Media.declare('instagram_item', [INSTAGRAM_URL])
end
def data_from_instagram_item
id = self.url.match(INSTAGRAM_URL)[3]
handle_exceptions(self, StandardErr... | 42.522727 | 200 | 0.660609 |
08d761e23f52044a266de3431bf153a1fd0e3d6e | 3,041 | class Contribuicao < ApplicationRecord
belongs_to :usuario
belongs_to :plano
enum status: { pendente: 0, ativo: 1, cancelado: 2, suspenso: 3 }
enum tipo: { mensal: 0, avulsa: 1 }
attr_accessor :hash_cliente
attr_accessor :token_cartao
attr_accessor :nome_cartao
def check_status
# Atualiza o statu... | 25.554622 | 97 | 0.642552 |
e81d98236843975bc3b939ec56aa28f7a92c284f | 237 | # String
class String
def snakecase
# gsub(/::/, '/').
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
.tr('-', '_')
.gsub(/\s/, '_')
.gsub(/__+/, '_')
.downcase
end
end
| 18.230769 | 41 | 0.371308 |
e9eb6eedd2c75f82777b5e8bb301c668d8d2774d | 3,431 | #--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: pages.rb,v 1.2 2005/05/16 03:59:21 austin Exp $
#++
# object which is a parent t... | 29.577586 | 98 | 0.566599 |
4a4c4993af57341d8118ab7fdae13ae33d719ee9 | 2,563 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 41.33871 | 110 | 0.65158 |
33932d551f2cb3f3674f5d9765b86003f257ad3b | 138 | json.extract! @job, :id, :title, :description, :date, :start_time, :end_time, :place, :address, :size, :user_id, :created_at, :updated_at
| 69 | 137 | 0.702899 |
798770c46bb9a4c9291bb6edc7b09d859939ddfc | 2,243 | #!/usr/bin/env ruby
#
# RabbitMQ check alive plugin
# ===
#
# This plugin checks if RabbitMQ server is alive using the REST API
#
# Copyright 2012 Abhijith G <abhi@runa.com> and Runa Inc.
#
# Released under the same terms as Sensu (the MIT license); see LICENSE
# for details.
require 'rubygems' if RUBY_VERSION < '1.9.... | 25.781609 | 131 | 0.576014 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.