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 |
|---|---|---|---|---|---|
18a6b12cf06ffbc877411cfa4a4097b14b2f0796 | 201 | class AddComplianceControlIdToComplianceControlBlocks < ActiveRecord::Migration
def change
add_reference :compliance_control_blocks, :compliance_control, index: true, foreign_key: true
end
end
| 33.5 | 97 | 0.835821 |
e9779a251f99cfdc20556bff3502d22a6a1de78f | 580 | name 'docker'
maintainer 'Sous Chefs'
maintainer_email 'help@sous-chefs.org'
license 'Apache-2.0'
description 'Provides docker_service, docker_image, and docker_container resources'
version '10.1.5'
source_url 'https://github.com/sous-chefs/docker'
issues_url ... | 27.619048 | 89 | 0.674138 |
b94105d482e2abdac5215917f880310be4ec9e52 | 4,494 | # Copyright © 2011-2016 MUSC Foundation for Research Development
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list... | 35.666667 | 145 | 0.720961 |
bb0774608fb303cb215f20355e6a1960d4544842 | 2,298 | module JSONQueryHelpers
extend ActiveSupport::Concern
OPERATORS = {
"in" => "in",
"any" => "any",
"lt" => "<",
"lteq" => "<=",
"gt" => ">",
"gteq" => ">="
}.freeze
FIELD_TYPES = %w[numeric date].freeze
class_methods do
def json_has_value(keys, value, json_column_name)
# Ad... | 31.054054 | 94 | 0.579199 |
6115ebce9a9b3e6a755d439e23eb0b431d391007 | 5,430 | # A multithreaded Amazon SQS queue processor that supports throttling and batched operations.
#
# This is an intentionally minimal and SQS-specific implementation to meet the
# needs of queueing high scale database writes in SQS, for which throttled and
# batched process are essential.
#
# Why a custom solution? For ou... | 41.136364 | 117 | 0.650829 |
2831177376c236e4845638f56a0ff147a6038360 | 3,759 | require 'test_helper'
class ImportToolsImportTest < ActiveSupport::TestCase
test '#new tries to lock the import' do
ImportTools::Import.any_instance.stubs(:create_db)
ImportTools::Import.any_instance.stubs(:use_import_db=)
ImportTools::Import.any_instance.expects(:lock_import)
ImportTools::Import.ne... | 34.172727 | 106 | 0.762703 |
08c28d983614c3578af4a708b606a57ca255f604 | 43 | module MirrorGithub
VERSION = "0.0.3"
end | 14.333333 | 19 | 0.72093 |
e9c6fe3dad152e33c9c876db66662818923cf0e4 | 275 | # frozen_string_literal: true
class CreateTasks < ActiveRecord::Migration[5.2]
def change
create_table :tasks do |t|
t.string :title
t.references :user, foreign_key: true
t.references :project, foreign_key: true
t.timestamps
end
end
end
| 19.642857 | 48 | 0.683636 |
261625a7e1ca2b0626b646a30d072ddf86d18b10 | 840 | # Encoding: UTF-8
#
# Cookbook Name:: shipyard
# Spec:: recipes/default
#
# Copyright (C) 2014, Jonathan Hartman
#
# 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/l... | 30 | 74 | 0.738095 |
5dbc4f237a9832d187e4d068d345d26c4776ec99 | 13,184 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe OrganizationWebhook, type: :model do
let(:organization) { classroom_org }
let(:client) { classroom_teacher.github_client }
subject do
organization_webhook = create(:organization_webhook, github_organization_id: organization.github_id)
o... | 31.922518 | 113 | 0.647148 |
33eece9196ce13533bdc8f01815de41615773a54 | 2,241 | require 'spec_helper'
describe Campaign do
let(:campaign) {
campaign = FactoryGirl.create(:campaign)
}
describe "#queued!" do
it "should notify admin" do
campaign.update_attribute(:aasm_state, 'queueing')
campaign.should_receive(:notify_admin_of_state_change){ true }
campaign.queued!... | 22.867347 | 70 | 0.651049 |
111776c16763acce37675b307539e4a8954befb2 | 402 | FactoryGirl.define do
factory :user do
password 'secret'
sequence(:email) { |n| "name_#{n}@example.com" }
factory :random_user do
sequence(:email) { |n| "#{Faker::Internet.user_name(nil, %w(._-))}_#{n}@example.com" }
sequence(:image_url) { |n| "https://randomuser.me/api/portraits/#{rand(2).ze... | 30.923077 | 122 | 0.609453 |
b9a01360c7c5de0b641b25594492831a6b1a3f31 | 27 | module TaskTypesHelper
end
| 9 | 22 | 0.888889 |
0392e43895fea69a97962abc7e23dc99b65d998b | 3,453 | require 'tempfile'
require 'rubygems'
require 'rubygems/remote_fetcher'
##
# A fake Gem::RemoteFetcher for use in tests or to avoid real live HTTP
# requests when testing code that uses RubyGems.
#
# Example:
#
# @fetcher = Gem::FakeFetcher.new
# @fetcher.data['http://gems.example.com/yaml'] = source_index.to_yaml... | 21.447205 | 92 | 0.663191 |
f70f8c7bd74f2032a44749f730f699b7a1ba6c37 | 1,159 | module RelaxDB
class Server
def initialize(host, port)
@host = host
@port = port
end
def delete(uri)
request(Net::HTTP::Delete.new(uri))
end
def get(uri)
request(Net::HTTP::Get.new(uri))
end
def put(uri, json)
req = Net::HTTP::Put.new(uri)
req... | 19 | 92 | 0.534944 |
e26a73ad0abc11f59cceb6d6d67f12cc6c7e8421 | 1,462 | Pod::Spec.new do |s|
s.name = 'RHScroll'
s.version = '1.0'
s.summary = 'With RHScroll you have a horizontal ScrollView with built in animations and notifications for tap and longPress gestures.'
s.swift_version = '4.2'
s.description = <<-DESC
RHScroll ... | 47.16129 | 346 | 0.627223 |
79ebf7e1340369be0528cf65853da48b1570cbe3 | 1,320 | module Patriot
module Tool
module PatriotCommands
# manage plugins
module Plugin
Patriot::Tool::PatriotCommand.class_eval do
desc 'plugin [options] install <path to plugin>',
'manage plugins'
method_option :force,
:aliases => '-f',
... | 31.428571 | 77 | 0.50303 |
bb015747649a7f4ab22df179a52f2ca69a6b4d5f | 10,655 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ApprovalRules::ParamsFilteringService do
let(:service) { described_class.new(merge_request, user, params) }
let(:project_member) { create(:user) }
let(:outsider) { create(:user) }
let(:accessible_group) { create(:group, :private) }
let(:inac... | 34.820261 | 155 | 0.601971 |
e8fc64374ad97e7dd8eef6f2276b4236cb17a1ad | 58 | class Income < ApplicationRecord
belongs_to :user
end
| 14.5 | 32 | 0.775862 |
798dc2ef920d4e18d38be594748846b5aa520e3f | 4,356 | #
# Cookbook Name:: nginx
# Recipe:: source
#
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Joshua Timberman (<joshua@opscode.com>)
#
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ... | 25.034483 | 100 | 0.662075 |
2641285656011ff9af2477e89f44fec34f9bd2bb | 441 | module WelcomeBot
class Contributors
include Aws::Record
string_attr :username, hash_key: true
string_attr :interactions
end
class Reporters
include Aws::Record
string_attr :username, hash_key: true
string_attr :interactions
end
class Messages
include Aws::Recor... | 18.375 | 45 | 0.678005 |
395d055fa5931de68676adcb7126f31018b92745 | 1,575 | RepMine::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# 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 su... | 39.375 | 84 | 0.786032 |
e895d30c7399e33b4899d094e2d0dcc09c4991b3 | 3,584 | describe TreeBuilderComplianceHistory do
context 'TreeBuilderComplianceHistory' do
before do
role = MiqUserRole.find_by(:name => "EvmRole-operator")
@group = FactoryBot.create(:miq_group, :miq_user_role => role, :description => "Compliance History Group")
login_as FactoryBot.create(:user, :useri... | 53.492537 | 112 | 0.605469 |
33ac526db37944357e32d040782412d56a29cc84 | 942 | class HomeController < ApplicationController
load_and_authorize_resource
def index
total_var
if @total_answered.zero?
@question = Question.where(:id=>1).first
@users_question = UsersQuestion.new
b = @users_question.users_questions_answers.build
c=b.users_q... | 30.387097 | 94 | 0.680467 |
bf588a9c31c169cf6c5348b376ae73b5bec66db8 | 808 | RSpec.describe ToughLove do
it "has a version number" do
expect(ToughLove::VERSION).not_to be nil
end
it 'exists' do
expect(ToughLove).to_not be nil
end
it "returns some tough love" do
list = [ "Is that the best you can do?",
"Keep it up! If you can...",
"Have I told you how good you... | 31.076923 | 68 | 0.627475 |
3974599b18a2a1f2ea7232a64745634941236574 | 268 | module AllSeeingPi
class Camera
attr_reader :script
def initialize
path = '../../../capture.sh'
@script = AllSeeingPi.config[:capture_script] || File.expand_path(path, __FILE__)
end
def capture
`#{script}`.strip
end
end
end
| 17.866667 | 87 | 0.626866 |
d5c8370e3e24128bc8770bd48115c9f229311c48 | 314 | # frozen_string_literal: true
module Stupidedi
module Versions
module ThirtyTen
module SyntaxNotes
P = Common::SyntaxNotes::P
R = Common::SyntaxNotes::R
E = Common::SyntaxNotes::E
C = Common::SyntaxNotes::C
L = Common::SyntaxNotes::L
end
end
end
end
| 20.933333 | 34 | 0.61465 |
f89e362b95748a13f324b8499ebc9097ae0f9d8e | 2,230 | class Goocanvas < Formula
desc "Canvas widget for GTK+ using the Cairo 2D library for drawing"
homepage "https://wiki.gnome.org/Projects/GooCanvas"
url "https://download.gnome.org/sources/goocanvas/2.0/goocanvas-2.0.4.tar.xz"
sha256 "c728e2b7d4425ae81b54e1e07a3d3c8a4bd6377a63cffa43006045bceaa92e90"
revision 2... | 54.390244 | 154 | 0.673094 |
ff26531b7a2b80aff86b3c61471c2b1373855894 | 528 | cask "electrumsv" do
version "1.3.5"
sha256 "036c7b64667529c7e1d2fe2e9220eb6a6e059e4c80884eebbec623b6d31228fe"
# s3.us-east-2.amazonaws.com/electrumsv-downloads/ was verified as official when first introduced to the cask
url "https://s3.us-east-2.amazonaws.com/electrumsv-downloads/releases/#{version}/ElectrumS... | 37.714286 | 111 | 0.772727 |
1c18311752510471c336de7460a568a3f861ef1f | 5,326 | # A connection pool allowing multi-threaded access to a pool of connections.
# This is the default connection pool used by Sequel.
class Sequel::ThreadedConnectionPool < Sequel::ConnectionPool
# The maximum number of connections this pool will create (per shard/server
# if sharding).
attr_reader :max_size
# ... | 35.039474 | 87 | 0.706722 |
790e6ce8cd8db9eb5d6e4a1180a58b7a12f8fd5a | 6,135 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe UuidStringList do
let(:connection) { described_class.connection }
let(:schema_cache) { connection.schema_cache }
let(:table_name) { described_class.table_name }
describe ".primary_key" do
subject { described_class.primary_key }
it { ... | 29.354067 | 113 | 0.659332 |
085631f315b0bbae432d98bb9d1ed68c7668623e | 172 | require 'spec_helper'
describe Nostalgia::Simulations do
it "should respond to simulate" do
Nostalgia::Simulations.respond_to?(:simulate).must_equal true
end
end
| 19.111111 | 65 | 0.773256 |
e88be5e3364669d1702ff085e7c494174e4f124c | 16,285 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
RSpec.describe HTTParty::ConnectionAdapter do
describe "initialization" do
let(:uri) { URI 'http://www.google.com' }
it "takes a URI as input" do
HTTParty::ConnectionAdapter.new(uri)
end
it "raises an ArgumentErro... | 32.635271 | 114 | 0.566779 |
e9efec1f68debc8023a3ecdd60ded1604566afe3 | 82,391 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::SecretsManager
module Types
# @note When making an API call... | 35.6671 | 134 | 0.635494 |
7937191c596ec66a1f3db07faa69ad861e780d0d | 2,961 | # frozen_string_literal: true
require 'test_helper'
module Shipit
module Api
class HooksControllerTest < ActionController::TestCase
setup do
authenticate!
@stack = shipit_stacks(:shipit)
end
test "the route has priority over stacks one" do
assert_recognizes({ controller... | 32.9 | 105 | 0.620061 |
ed112ba9345d1cd5758f76316f6b9db48eb931b7 | 66 | require 'rails_helper'
RSpec.describe Field, type: :model do
end
| 13.2 | 37 | 0.772727 |
03432a13a57c41990fda0230e60ca8aa7b83630d | 182 | class AddLatitudeAndLongitudeToListing < ActiveRecord::Migration[5.1]
def change
add_column :listings, :latitude, :float
add_column :listings, :longitude, :float
end
end
| 26 | 69 | 0.758242 |
2657119e2a2332aca80d0e3fcdf8df2e8a24da4a | 1,330 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core/handler/reverse_https'
require 'msf/base/sessions/meterpreter_options'
require 'msf/base/sessions/mettle_config'
require 'msf/base/sessions/meterpreter_ppc64le_lin... | 28.297872 | 99 | 0.633835 |
28f8b07934f520cedde4e6020724ed54d1a40552 | 195 | require 'Jekyll'
puts "this is a test!!!!!!"
Jekyll.logger.info("THIS IS A TEST!!!!!!!")
Jekyll::Hooks.register :site, :post_write do |site|
loop do
puts 'test!!!'
sleep 100
end
end | 17.727273 | 51 | 0.625641 |
281024f8ba86075e1a218afdfa993c64e6e527bf | 926 | class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable,
:omniauthable, :omniauth_providers => [:facebo... | 33.071429 | 103 | 0.690065 |
21d6fcb79d6a67236388ff10ddfb15bb3b944e81 | 1,617 | require 'test_helper'
require 'unit/response_stubs/list_payment_methods_stubs'
class ListPaymentMethodsTest < Test::Unit::TestCase
include ListPaymentMethodsStubs
def setup
@environment = Spreedly::Environment.new("key", "secret")
end
def test_successful_list_payment_methods
list = list_using(succes... | 29.4 | 98 | 0.770563 |
1ce2061ac6b0990ca7cfa12322bdbc1a25929747 | 1,219 | #
# Be sure to run `pod lib lint DroidTimeSelection.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 = '... | 40.633333 | 256 | 0.654635 |
39695a615c98fbd94f4c7687a3a212d70452c6d8 | 712 | require 'rails_helper'
RSpec.describe SlackEvent::TeamJoinJob, type: :job do
let(:options) {{
event: {
user: {
id: "user123",
name: "johndoe",
real_name: "John Doe",
is_bot: false,
},
}
}}
describe "#perform" do
it "does not welcome bots to the team" do
... | 23.733333 | 90 | 0.623596 |
878a238f8d13098f50e6208684aef8e46a8e4074 | 2,537 | # frozen_string_literal: true
require "abstract_unit"
module ActionController
class Base
include ActionController::Testing
end
end
class InfoControllerTest < ActionController::TestCase
tests Rails::InfoController
def setup
Rails.application.routes.draw do
get "/rails/info/properties" => "rails... | 28.188889 | 84 | 0.703981 |
5d43ee4db2a0b322fcfd52e64380df3ec0ca0887 | 15,142 | # frozen_string_literal: true
module ThemeCheck
# A node from the Liquid AST, the result of parsing a liquid file.
class LiquidNode < Node
attr_reader :value, :parent, :theme_file
def initialize(value, parent, theme_file)
raise ArgumentError, "Expected a Liquid AST Node" if value.is_a?(LiquidNode)
... | 28.302804 | 103 | 0.621186 |
623c7cfb63fc9145b2c8f7787359d3bf614e1af2 | 7,211 | require 'vanagon/platform/dsl'
describe 'Vanagon::Platform::DSL' do
let (:deb_platform_block) { "platform 'debian-test-fixture' do |plat| end" }
let (:el_5_platform_block) { "platform 'el-5-fixture' do |plat| end" }
let (:el_6_platform_block) { "platform 'el-6-fixture' do |plat| end" }
let... | 51.877698 | 175 | 0.712939 |
2136f06a13b657b5d2293b1f1bc2e58ccfcfa3dd | 2,397 | # File: config.rb
require 'yaml'
require_relative 'file-action'
module Cukedep # Module used as a namespace
FileMetaData = Struct.new(:name)
Config = Struct.new(
:feature_encoding, # The character encoding of feature files
:proj_dir, # The directory of the cucumber project
:feature2id, # Meta-dat... | 27.872093 | 80 | 0.657906 |
38a471670d195bcfa706580e402594d8c371938f | 557 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe AcaEntities::Operations::Encryption::Decrypt do
subject { described_class.new.call(input) }
context 'When any type of value is passed' do
let(:encrypted_value) {AcaEntities::Operations::Encryption::Encrypt.new.call({ value: "Hello World" }).... | 30.944444 | 115 | 0.716338 |
6175392cff7ef879203a2fd6c34d40c90d06832a | 1,486 | # frozen_string_literal: true
if RUBY_ENGINE == "jruby"
require "active_record/connection_adapters/jdbcpostgresql_adapter"
else
require "pg"
end
module ActiveRecord # :nodoc:
module ConnectionHandling # :nodoc:
if RUBY_ENGINE == "jruby"
def postgis_connection(config)
config[:adapter_class] ... | 31.617021 | 123 | 0.711306 |
6157279351d241afd36e456d702de0bc61f35c46 | 4,039 | # frozen_string_literal: true
require 'rails_helper'
include Warden::Test::Helpers
# NOTE: If you generated more than one work, you have to set "js: true"
RSpec.feature 'Create a DenverMultimedia' do
let(:user) { User.new(email: 'test@example.com') { |u| u.save(validate: false) } }
let(:admin_set_id) { AdminSet.fi... | 39.598039 | 179 | 0.693488 |
01e4f269ddc58c372b80a63496cc6b21efa712e8 | 3,048 | #
# Copyright:: 2020, Chef Software, Inc.
# Author:: Tim Smith (<tsmith@chef.io>)
#
# 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 req... | 32.425532 | 168 | 0.567913 |
187297bb0a1305dec92d1835a2cc2ebad58c0b93 | 3,476 | require 'browsermob/proxy'
require 'capybara/chromedriver/logger'
require 'capybara/cucumber'
require 'nokogiri'
require 'ptools'
require 'plek'
require 'selenium-webdriver'
require 'uri'
require 'webdrivers'
# Set up environment
case ENV["ENVIRONMENT"]
when "test"
ENV["GOVUK_APP_DOMAIN"] ||= "test.publishing.servic... | 33.423077 | 108 | 0.736479 |
4af79395ac2efcfb2441275dc9020a7817bd753d | 17,585 | module Facebooker
module Rails
# ActionMailer like module for publishing Facbook messages
#
# To use, create a subclass and define methods
# Each method should start by calling send_as to specify the type of message
# Valid options are :email and :notification, :user_action, :profile, :ref
#... | 34.821782 | 198 | 0.603867 |
33361d5fbcd83d42ab97f11c63d906ffc1bcab9e | 17 | steam_game 'l4d2' | 17 | 17 | 0.823529 |
18b391cc562a4fb37c87e83effb51a083e3b16ac | 41,720 | require 'cocoapods-core/specification/dsl/attribute_support'
require 'cocoapods-core/specification/dsl/attribute'
require 'cocoapods-core/specification/dsl/platform_proxy'
module Pod
class Specification
#- NOTE ------------------------------------------------------------------#
# The of the methods defined i... | 33.163752 | 114 | 0.518337 |
390d60967e0bc4ca5a63f7f650248efe5285d374 | 143 | class AddCheckedOutToCarts < ActiveRecord::Migration[6.0]
def change
add_column :carts, :checked_out, :boolean, default: false
end
end
| 23.833333 | 61 | 0.755245 |
182f1e17b9a0d11c0634ea274780c2b2141bc8d1 | 581 | # rubocop:disable all
class AddCiToProject < ActiveRecord::Migration[4.2]
def change
add_column :projects, :ci_id, :integer
add_column :projects, :builds_enabled, :boolean, default: true, null: false
add_column :projects, :shared_runners_enabled, :boolean, default: true, null: false
add_column :projec... | 44.692308 | 87 | 0.748709 |
614fdc11e39cfeb836d73a0d0216c2c37f6325c1 | 3,065 | TCPDFFontDescriptor.define('veramobi') do |font|
font[:type]='TrueTypeUnicode';
font[:name]='BitstreamVeraSansMono-BoldOb';
font[:desc]={'Ascent'=>928,'Descent'=>-236,'CapHeight'=>928,'Flags'=>97,'FontBBox'=>'[-73 -236 681 928]','ItalicAngle'=>-11,'StemV'=>120,'MissingWidth'=>602}
font[:up]=-108;
font[:u... | 98.870968 | 174 | 0.58956 |
181da1bb59403e5d1628b2ddb94a1f6f8f68c666 | 145 | class AddPercentagesToReportReports < ActiveRecord::Migration[4.2]
def change
add_column :report_reports, :percent_type, :string
end
end
| 24.166667 | 66 | 0.786207 |
5d6246371e02f82bc622121c1642697401be7b9a | 79 | class Country < ApplicationRecord
validates :code, :name, presence: true
end
| 19.75 | 40 | 0.772152 |
b9908f4d26a278af421f81afa60c494f54c8ada3 | 4,084 | require 'rails_helper'
RSpec.describe 'DeviseRegistrationNews', type: :system do
let(:user) { create(:user, :non_activate) }
let(:activate_user) { create(:user) }
# 有効な情報を保持したフォーム
def submit_with_information(email: 'valid@example.com', password: 'password', password_confirmation: 'password')
fill_in 'メールア... | 29.381295 | 114 | 0.579824 |
085a668c325beb14c4fcd1f793d4fec505f03fa6 | 541 | require 'rexml/document'
require File.dirname(__FILE__) + '/../../../spec_helper'
describe "REXML::Element#comments" do
before :each do
@e = REXML::Element.new "root"
@c1 = REXML::Comment.new "this is a comment"
@c2 = REXML::Comment.new "this is another comment"
@e << @c1
@e << @c2
end
it "r... | 24.590909 | 60 | 0.639556 |
7963ac388f82e11fb4faac0de4f1ba8286383de0 | 4,631 | require "test_helper"
describe Vanity do
describe "#configuration" do
it "returns the same configuration" do
assert_same Vanity.configuration, Vanity.configuration
end
it "returns nil if if skipping bang" do
Vanity.configuration = nil
assert_nil Vanity.configuration(false)
end
en... | 24.897849 | 83 | 0.657957 |
ed20b240cce5d90fbaab822f95947d352b78272f | 111 | # frozen_string_literal: true
class GroupVariableSerializer < BaseSerializer
entity GroupVariableEntity
end
| 18.5 | 46 | 0.855856 |
79f1d1dec5a389829b93a9b67c7546dc896d1215 | 3,603 | require "forwardable"
module Searchkick
class Results
include Enumerable
extend Forwardable
attr_reader :klass, :response, :options
def_delegators :results, :each, :any?, :empty?, :size, :length, :slice, :[], :to_ary
def initialize(klass, response, options = {})
@klass = klass
@res... | 24.344595 | 136 | 0.561477 |
18c560d0d8fbc31adaa4ded391e68fea6c648727 | 510 | # frozen_string_literal: true
module Leftovers
class ConfigLoader
class Suggester
def initialize(words)
@words = words
@did_you_mean = ::DidYouMean::SpellChecker.new(dictionary: words) if defined?(::DidYouMean)
end
def suggest(word)
suggestions = did_you_mean.correct(wo... | 22.173913 | 99 | 0.662745 |
e99370b2a1c6bba323a736d5b6e30a563de71d21 | 17,468 | require 'spec_helper'
require 'actions/build_create'
require 'isolation_segment_assign'
require 'isolation_segment_unassign'
module VCAP::CloudController
RSpec.describe BuildCreate do
subject(:action) do
BuildCreate.new(
user_audit_info: user_audit_info,
memory_limit_calculator: mem... | 40.623256 | 145 | 0.606251 |
1c85d6b0d66f8640bc9135792b306019d7635347 | 609 | module Cryptoexchange::Exchanges
module Cezex
module Services
class Pairs < Cryptoexchange::Services::Pairs
PAIRS_URL = "#{Cryptoexchange::Exchanges::Cezex::Market::API_URL}/markets"
def fetch
output = super
adapt(output)
end
def adapt(output)
... | 24.36 | 82 | 0.535304 |
7a53436ae5adab53a22fce2c014f08e2feb87c09 | 9,868 | require 'test_helper'
WickedPdf.config = { :exe_path => ENV['WKHTMLTOPDF_BIN'] }
HTML_DOCUMENT = '<html><body>Hello World</body></html>'.freeze
# Provide a public accessor to the normally-private parse_options function.
# Also, smash the returned array of options into a single string for
# convenience in testing below... | 40.946058 | 563 | 0.67045 |
7927072f41dac67f67a319a9df7c5dcb36221b32 | 1,787 | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... | 34.365385 | 103 | 0.636821 |
26c89bd5e370cd2ba1ed218844b32f105d1c5d04 | 1,505 | cask 'wkhtmltopdf' do
version '0.12.3'
if Hardware::CPU.is_32_bit?
sha256 '6e4613c060eb9e5eb0bd05b0ccd85d09086ef7a1156300e53a9dfba7969b6fc0'
# download.gna.org/wkhtmltopdf was verified as official when first introduced to the cask
url "http://download.gna.org/wkhtmltopdf/#{version.major_minor}/#{versio... | 40.675676 | 121 | 0.648505 |
6179879e6194014e7d58a861bca83da4c69ecc08 | 1,924 | # frozen_string_literal: true
require 'administrate/base_dashboard'
class CategoryDashboard < Administrate::BaseDashboard
# ATTRIBUTE_TYPES
# a hash that describes the type of each of the model's fields.
#
# Each different type represents an Administrate::Field object,
# which determines how the attribute i... | 28.716418 | 76 | 0.722973 |
26f0fb15d6cfea19c6e8935c54a78eb43810c9ae | 5,255 | require "rails_helper"
RSpec.describe UserMailer, type: :mailer do
describe "submission_notification" do
let!(:organization) { FactoryBot.create(:organization) }
let(:user) { FactoryBot.create(:user, organization: organization) }
let(:form) { FactoryBot.create(:form, organization: organization, user: use... | 35.993151 | 133 | 0.688677 |
f79ffc967ccd1c5cbe87511d779483fff3aaeff3 | 143 | class Note < RedisOrm::Base
property :body, :string, :default => "made by redis_orm"
belongs_to :user, :as => :owner, :index => true
end | 28.6 | 58 | 0.657343 |
6aaf7ed46a6ab4f5e7563d2b192bcbd15d8e3f74 | 561 | # class Interview
class Interview < JsonSerializer
ANSWERS = %w(open accepted rejected).freeze
RESULTS = %w(open accepted rejected wait).freeze
attribute :date, Date
attribute :comments, String, default: ''
attribute :invited, Boolean, default: false
attribute :answer, String, default: 'op... | 21.576923 | 50 | 0.654189 |
610e924ad20d8151a5df6a623d2bc21d38c1d6f7 | 787 | require 'term_canvas'
field = TermCanvas::Canvas.new(x: 0, y: 0, w: TermCanvas.width, h: TermCanvas.height)
text_pos = {y: 0, x: 0}
loop do
key = TermCanvas.gets
case key
when ?k
text_pos[:y] -= 1
when ?j
text_pos[:y] += 1
when ?h
text_pos[:x] -= 2
when ?l
text_pos[:x] += 2
when ?q
b... | 21.27027 | 105 | 0.595934 |
e9664c56f72336efbba8d213e8bb2f4f0efaa846 | 7,467 | module Pod
class Source
# The Aggregate manages a directory of sources repositories.
#
class Aggregate
# @return [Pathname] the directory were the repositories are stored.
#
attr_reader :repos_dir
# @param [Pathname] repos_dir @see repos_dir.
#
def initialize(repos_d... | 32.465217 | 98 | 0.566493 |
bbb25723af3a402443c3952f9f68504418324b78 | 5,310 | # frozen_string_literal: true
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to expl... | 47.837838 | 96 | 0.713936 |
bf2af0c96adaf300b4598111e2f9eab4740a206b | 332 | package "collectd"
service "collectd" do
supports :restart => true, :status => true
end
%w(collectd collection thresholds).each do |file|
template "/etc/collectd/#{file}.conf" do
source "#{file}.conf.erb"
owner "root"
group "root"
mode "644"
notifies :restart, resources(:service => "collectd")... | 19.529412 | 56 | 0.659639 |
0829d5d438c0acb59f38619df12fd9e807dc772a | 1,035 | require File.dirname(__FILE__) + '/../../../spec_helper'
has_tty? do # needed for CI until we figure out a better way
require 'readline'
describe "Readline::HISTORY.[]=" do
before(:each) do
Readline::HISTORY.push("1", "2", "3")
end
after(:each) do
Readline::HISTORY.pop
Readline::HISTORY.pop
R... | 27.236842 | 81 | 0.671498 |
8766ef9aec1519227882ea406213c9281c584bf3 | 464 | # encoding: utf-8
module RuboCop
# A basic wrapper around Parser's tokens.
class Token
attr_reader :pos, :type, :text
def self.from_parser_token(parser_token)
type, details = *parser_token
text, range = *details
new(range, type, text)
end
def initialize(pos, type, text)
@p... | 20.173913 | 68 | 0.601293 |
ac7b3a9b2a69463c3f49800d7a52c8a6d33bdf8e | 3,149 | #
# Copyright 2015-2016, Noah Kantrowitz
#
# 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 w... | 26.686441 | 83 | 0.63544 |
edae29eddcc3143f15f259f66aff368d719c6a4a | 273 | class AjoutListeMotCacher < ActiveRecord::Migration
def self.up
add_column :grilles, :listes_mots, :string
add_column :grilles, :mot_cache, :integer
end
def self.down
remove_column :grilles, :listes_mots
remove_column :grilles, :mot_cache
end
end
| 21 | 51 | 0.736264 |
28c825f1835f366071f763adea03446e294e7d3e | 917 | # frozen_string_literal: true
require_relative "filename_helpers"
module Delfos
module MethodTrace
module CodeLocation
class CallSite
include FilenameHelpers
attr_reader :line_number, :container_method, :called_method
def initialize(file:, line_number:, container_method:, called_m... | 23.512821 | 78 | 0.609597 |
39cef4b3575fd6cf2a20bf3434e46ea7ead7f294 | 822 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe "RenewingRegistrations", type: :request do
let(:registration) { create(:registration) }
describe "/bo/registrations/:reg_identifier" do
context "when a valid user is signed in" do
let(:user) { create(:user) }
before(:each) do
... | 26.516129 | 67 | 0.660584 |
e9860b80f73348fc09973911c99904c8a4ddf758 | 3,601 | require 'spec_helper'
describe 'elasticsearch::template', :type => 'define' do
on_supported_os(
:hardwaremodels => ['x86_64'],
:supported_os => [
{
'operatingsystem' => 'CentOS',
'operatingsystemrelease' => ['6']
}
]
).each do |os, facts|
context "on #{os}" do
let(... | 26.873134 | 80 | 0.465426 |
e2e836433c96a776b6ad4e60f394b18ff90a4f37 | 2,201 | # -*- encoding : us-ascii -*-
# frozen_string_literal: true
require 'minitest/autorun'
require 'rack/contrib/enforce_valid_encoding'
if "a string".respond_to?(:valid_encoding?)
require 'rack/mock'
require 'rack/contrib/enforce_valid_encoding'
VALID_PATH = "h%C3%A4ll%C3%B2"
INVALID_PATH = "/%D1%A1%D4%F1%D7%A2... | 33.861538 | 129 | 0.679691 |
2866613d9db455fab8b4792aeb7b6853804e0eb4 | 725 |
Pod::Spec.new do |s|
s.platform = :ios
s.ios.deployment_target = '10.0'
s.name = "PodLocation"
s.version = "1.0.15"
s.summary = "PodLocation classes"
s.description = <<-DESC
A bunch of classes i have found useful for PodLocation
DESC
s.license = { :type => ... | 26.851852 | 103 | 0.588966 |
e8f527ee19dff075122ab78bf4282801c4e098e7 | 1,582 | #
# Be sure to run `pod lib lint A_Category.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 = 'A_Catego... | 36.790698 | 102 | 0.6378 |
f78f79a8bf5b2ba4c6a53bbf6404de6e73c54d00 | 267 | class CreateCharacter < ActiveRecord::Migration[6.0]
def change
create_table :characters do |t|
t.string :name
t.string :dynasty
t.boolean :marriage_status
t.string :culture
t.string :religion
t.string :sex
end
end
end
| 20.538462 | 52 | 0.64794 |
ac200fb86f9e801248283a9bd92b782abbce92f5 | 926 | KepplerBlog::Engine.routes.draw do
mount Ckeditor::Engine => '/ckeditor'
scope :admin, :blog do
resources :posts do
get 'find/subcategories', action: :subcategories_of_cagegory, on: :collection
get '(page/:page)', action: :index, on: :collection, as: 'search'
delete '/destroy_multiple', ac... | 35.615385 | 109 | 0.674946 |
ac18e8fca0cb580b344a84ea9b059fdf8913815e | 5,108 | test_name "Setup environment"
require 'json'
require 'open-uri'
step 'Configure paths' do
add_aio_defaults_on(hosts)
add_puppet_paths_on(hosts)
end
step "Install git and tar"
PACKAGES = {
:redhat => ['git'],
:debian => [
['git', 'git-core'],
],
:solaris_10 => [
'coreutils',
'git',
'gtar',... | 33.827815 | 127 | 0.667189 |
f8ba77e2bbaa46c8c0ce1472b91bcb2590569d9e | 179 | # frozen_string_literal: true
class AddSearchOnlyToAccounts < ActiveRecord::Migration[5.2]
def change
add_column :accounts, :search_only, :boolean, default: false
end
end
| 25.571429 | 64 | 0.776536 |
91f4441eab5cdbd9d25285c94893b85b14c301bf | 4,549 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 34.992308 | 94 | 0.650473 |
18ad44cb3b772fd3b393fe42b04f0a69a45b920d | 659 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
describe "Kernel#untrusted?" do
it "returns the untrusted status of an object" do
o = mock('o')
o.untrusted?.should == false
o.untrust
o.untrusted?.should == true
end
it "has no e... | 22.724138 | 58 | 0.649469 |
38d436f5bdfc0b62037ef08ac41b5aed024a3846 | 1,904 | # 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 there!
Rails.application.configure do
# Settings... | 38.857143 | 85 | 0.77416 |
26e17a7553ef616d1fb4aa06ddfac1ad45803758 | 1,614 | class Explore::ProjectsController < Explore::ApplicationController
include FilterProjects
def index
@projects = ProjectsFinder.new.execute(current_user)
@tags = @projects.tags_on(:tags)
@projects = @projects.tagged_with(params[:tag]) if params[:tag].present?
@projects = @projects.where(visibility_l... | 29.888889 | 114 | 0.66171 |
01cbf50fde6ed63b462fd0582753706a50078622 | 666 | Pod::Spec.new do |s|
s.name = "MaterialCatalog"
s.version = "95.0.0"
s.summary = "Helper Objective-C classes for the MDC catalog."
s.description = "This spec is made for use in the MDC Catalog."
s.homepage = "https://github.com/material-components/material-components-ios"
s.license ... | 44.4 | 124 | 0.648649 |
bf00922ed63cc119da7867e815a3546d45838277 | 1,183 | require 'test_helper'
class UsersEditTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
end
test "unsuccessful edit" do
log_in_as(@user)
get edit_user_path(@user)
assert_template 'users/edit'
patch user_path(@user), params: { user: { name: "",
... | 32.861111 | 78 | 0.509721 |
ff27f135746f3e0cec96129b83d9f69324912df0 | 4,401 | 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.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your applica... | 44.908163 | 114 | 0.76778 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.