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 |
|---|---|---|---|---|---|
0163ab3e2db7724139c2831cb68d1ceb66accedd | 5,416 | # -*- encoding : utf-8 -*-
# 勘定にもたせる口座連携関係の機能を記述。
module Account::Linking
def self.included(base)
base.has_many :link_requests, -> { includes(:sender) },
class_name: "AccountLinkRequest",
foreign_key: "account_id",
dependent: :destroy
base.has_one :link, ... | 40.721805 | 184 | 0.724705 |
91e892efdc15a9955ff92270e60b45d4e851f42a | 41 | class Message < ActiveRecord::Base
end | 13.666667 | 34 | 0.756098 |
87ddeffbb681eec7ae91208f9d2603306adfad68 | 3,760 | # frozen_string_literal: true
require 'spec_helper'
require 'unit/cloud/shared_stuff'
describe Bosh::AzureCloud::Cloud do
include_context 'shared stuff'
describe '#snapshot_disk' do
let(:metadata) { {} }
let(:snapshot_cid) { 'fake-snapshot-cid' }
let(:snapshot_id_object) { instance_double(Bosh::Azure... | 35.471698 | 101 | 0.663298 |
ff0b16acbf317200e4270033c8d7b5ed58b76a64 | 543 | Pod::Spec.new do |s|
s.name = "YHKit"
s.version = "1.0.0"
s.summary = "YHKit is a easy test."
s.description = <<-DESC
This description is used to generate tags and improve search results;
DESC
s.homepage = "https://github.com/bill19/YHKitDemo"
s.license = "MIT"
s.author = { "... | 27.15 | 87 | 0.604052 |
d5bbd72c9a7c3c39d42a55b047ccd77799a9a4d0 | 310 | class Team < ApplicationRecord
mount_uploader :avatar, AvatarUploader
belongs_to :league, optional: true
has_many :players, dependent: :destroy
has_many :team_one, :class_name => 'Match', :foreign_key => 'team_one'
has_many :team_two, :class_name => 'Match', :foreign_key => 'team_two'
end
| 38.75 | 74 | 0.716129 |
4abd5b91847171b15a6803f0127ab5358bc104f4 | 49,888 | require 'rails_helper'
require 'permissions_spec_helper'
RSpec.describe PackagesController, type: :controller do
describe '#upload' do
let(:package) { VCAP::CloudController::PackageModel.make }
let(:space) { package.space }
let(:org) { space.organization }
let(:params) { { 'bits_path' => 'path/to/bit... | 34.935574 | 168 | 0.612993 |
ab147130c0c2233f21344ab40454ebd6d1338f4b | 1,327 | # frozen_string_literal: true
# The MIT License (MIT)
#
# Copyright <YEAR> <COPYRIGHT HOLDER>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitat... | 45.758621 | 79 | 0.779201 |
ab5b0a393808caabdff263e07e42119cd66e5b70 | 927 | module Spree
module Api
UsersController.class_eval do
before_action :authenticate_user, :except => [:sign_up, :sign_in]
def sign_up
@user = Spree::User.find_by_email(params[:user][:email])
if @user.present?
render "spree/api/users/user_exists", :status => 401 and return
... | 22.609756 | 79 | 0.599784 |
62e5c8ad308ba89d4bba284e09fb0f7bf1dcba54 | 2,014 | class Pastebinit < Formula
desc "Send things to pastebin from the command-line"
homepage "https://launchpad.net/pastebinit"
url "https://launchpad.net/pastebinit/trunk/1.5/+download/pastebinit-1.5.tar.gz"
sha256 "0d931dddb3744ed38aa2d319dd2d8a2f38a391011ff99db68ce7c83ab8f5b62f"
license "GPL-2.0"
revision 3
... | 41.102041 | 122 | 0.763654 |
ac910e6a50d819b3e5809b583ab5d1264cf8455c | 1,509 | # frozen_string_literal: true
ENV['RAILS_ENV'] ||= 'test'
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "dotenv/load"
require "jsonb_accessor"
require "pry"
require "pry-nav"
require "pry-doc"
require "awesome_print"
require "database_cleaner"
require "yaml"
class StaticProduct < ActiveRecord::B... | 24.737705 | 82 | 0.762757 |
4a22004d4bf72609a9a7e1cb2e4545aca217afc9 | 4,415 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 36.791667 | 100 | 0.616535 |
bb5c4bc9c5c2230ea43eee8178e0895c70943ae1 | 1,148 | describe "mail_shared/_email_reply.html.erb" do
it "renders 'Send a Comment' link with approve button" do
approval = create(:approval)
create(:api_token, step: approval)
proposal = approval.proposal
render(
partial: "mail_shared/call_to_action/email_reply",
locals: { show_step_actions: tru... | 38.266667 | 87 | 0.736934 |
6a50e2b7d160dd8d83ff846fce7c2cf372bb0a66 | 847 | class UsersController < ApplicationController
def search
search = User.search do
fulltext params[:q]
end
@users = search.results
render 'index'
end
def index
@users = User.all
end
def show
@user = User.find(params[:id])
end
def new
@user = User.new
end
def edit
... | 13.885246 | 56 | 0.606848 |
7adf3c8ee5414a5b72d865ca9d34d7af6df537e7 | 11,744 | # 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... | 36.246914 | 284 | 0.696185 |
ab9ba6f80911bb5e1e8b6af3ba5a3389f2f17b92 | 940 | # frozen_string_literal: true
require_relative "../../helpers/toggle"
module Byebug
#
# Reopens the +enable+ command to define the +breakpoints+ subcommand
#
class EnableCommand < Command
#
# Enables all or specific breakpoints
#
class BreakpointsCommand < Command
include Helpers::Toggle... | 21.860465 | 74 | 0.624468 |
f8ddaabda8accc84981008e925ea1b03ff16ffc6 | 133 | class TokyoMetro::Initializer::ApiKey::List < Array
def set
self.each do | namespace |
namespace.set
end
end
end
| 13.3 | 51 | 0.654135 |
bfc8709d727f1a1f291b2d0f1c1bd1fd0ced4149 | 5,507 | =begin
Ruby InsightVM API Client
OpenAPI spec version: 3
Contact: support@rapid7.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.0
=end
require 'date'
module Rapid7VmConsole
#
class CreatedReferenceScanIDLink
# The identifier of the resource created.
at... | 28.096939 | 107 | 0.609769 |
1899f87937c48c926e6c3489ee6edf5a4cd7b5fd | 4,803 | require 'rubyXL'
require 'rubyXL/convenience_methods/cell'
require 'rubyXL/convenience_methods/color'
require 'rubyXL/convenience_methods/font'
require 'rubyXL/convenience_methods/workbook'
require 'rubyXL/convenience_methods/worksheet'
class ReportWpByPeriodController < ApplicationController
include Downloadable
d... | 36.946154 | 122 | 0.671664 |
ed5626e52f0cbe711189e1df9050fc5cc8b1c98a | 477 | ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/reporters"
Minitest::Reporters.use!
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
include Applicati... | 26.5 | 82 | 0.746331 |
03642b603b987605a8aad6ac3584bb7de7ce8ed7 | 11,211 | require "test_helper.rb"
class RemoteOrbitalGatewayTest < Test::Unit::TestCase
def setup
Base.mode = :test
@gateway = ActiveMerchant::Billing::OrbitalGateway.new(fixtures(:orbital_gateway))
@amount = 100
@credit_card = credit_card('4112344112344113')
@declined_card = credit_card('400030001111222... | 37.245847 | 116 | 0.692356 |
e29f1c3f74f7df6a24f31eb22da707844f805fbb | 576 | # frozen_string_literal: true
class OpenAccessEbookTrustMailer < ApplicationMailer
default from: "fulcrum-info@umich.edu"
def send_report(tmp_zip)
@month_year = Time.zone.now.prev_month.strftime("%B %Y")
@email_subject = "Monthly Fulcrum reports for OAeBU Data Trust"
attachment_name = "Monthly Fulcrum... | 36 | 129 | 0.758681 |
01501374fcc839d30c8c9ac874592db675e60d81 | 734 | class Users::RegistrationsController < Devise::RegistrationsController
def create
return
if resource = User.where(id: session['devise.user_id']).first
else
build_resource
end
build_resource
if resource.save
if resource.respond_to?(:confirm!) && !resource.confirmed?
... | 30.583333 | 105 | 0.694823 |
f7d0c915c85b0f870e5de9fa8331f1e52fe84d07 | 8,970 | require "builder"
module Jenkins
class JobConfigBuilder
attr_accessor :job_type
attr_accessor :steps, :rubies
attr_accessor :scm, :public_scm, :scm_branches
attr_accessor :scm, :public_scm, :git_branches
attr_accessor :assigned_node, :node_labels # TODO just one of these
attr_accessor :envfil... | 31.254355 | 104 | 0.56466 |
f86ffcf1d7f0a04d25485ac5780c1cbf67912615 | 119 | class AddParentToProjects < ActiveRecord::Migration
def change
add_column :projects, :parent, :integer
end
end
| 19.833333 | 51 | 0.764706 |
f7a0fda47696cf1f65e2c5ac0374e6d14f181440 | 1,665 | require 'test/test_helper'
require 'mongo/gridfs'
class ChunkTest < Test::Unit::TestCase
include Mongo
include GridFS
@@db = Connection.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
ENV['MONGO_RUBY_DRIVER_PORT'] || Connection::DEFAULT_PORT).db('ruby-mongo-utils-test')
@@files = @@... | 20.060241 | 110 | 0.584384 |
6a0e7e9e9577e65255df787fd8327ec88bbe47bd | 3,819 | class Rpm < Formula
desc "Standard unix software packaging tool"
homepage "https://rpm.org/"
url "http://ftp.rpm.org/releases/rpm-4.15.x/rpm-4.15.0.tar.bz2"
sha256 "1e06723b13591e57c99ebe2006fb8daddc4cf72efb366a64a34673ba5f61c201"
version_scheme 1
bottle do
sha256 "a758f1a11bb8b5c794d6566988cc0a1d61aa5... | 32.092437 | 94 | 0.613511 |
e90a7fb0c4506978f991338e5f9da9c44febaa4a | 1,086 | class Tcpreplay < Formula
desc "Replay saved tcpdump files at arbitrary speeds"
homepage "https://tcpreplay.appneta.com/"
url "https://github.com/appneta/tcpreplay/releases/download/v4.2.6/tcpreplay-4.2.6.tar.gz"
sha256 "043756c532dab93e2be33a517ef46b1341f7239278a1045ae670041dd8a4531d"
bottle do
cellar :... | 36.2 | 93 | 0.695212 |
3880e737701806fb63af049b463864e43d6a237a | 2,158 | # encoding: UTF-8
control 'V-219229' do
title "The Ubuntu operating system must permit only authorized accounts
ownership of the audit log files."
desc "If audit information were to become compromised, then forensic
analysis and discovery of the true source of potentially malicious system
activity is impossible t... | 33.71875 | 79 | 0.716867 |
6155f03183d6efb9b5a6a213013fc8e71272365b | 1,072 | require 'cocoapods'
require 'cocoapods-mtxx-bin/gem_version'
if Pod.match_version?('~> 1.4')
require 'cocoapods-mtxx-bin/native/podfile'
require 'cocoapods-mtxx-bin/native/installation_options'
require 'cocoapods-mtxx-bin/native/specification'
require 'cocoapods-mtxx-bin/native/path_source'
require 'cocoapod... | 41.230769 | 58 | 0.798507 |
5dbc8657656ecbc8666daf5985dff6c39281a051 | 2,375 | 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 on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 37.698413 | 111 | 0.765474 |
d5e7b23103b886b2340e8916ea75f2abcfdb7f2c | 2,105 | # 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... | 38.272727 | 117 | 0.738717 |
e2b6128c4664ce32f513cec8bc695217717eecc3 | 1,288 | class Application < TestApp
get '/slow_page' do
sleep 1
"<p>Loaded!</p>"
end
get '/slow_ajax_load' do
<<-HTML
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>with_js</title>
<script src="/jquery.js" type="text/javascript" charset="utf-8"></script>
... | 18.666667 | 77 | 0.578416 |
b9dbf05b87438fa0a23f79ab1d3c3487d531d34e | 456 | name 'maven'
maintainer 'Chef Software, Inc.'
maintainer_email 'cookbooks@chef.io'
license 'Apache 2.0'
description 'Application cookbook which installs and configures Maven.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '2.0.0'
depends 'libarchive', '~> 0.6'
depends 'poise', '~> 2.... | 24 | 72 | 0.739035 |
91ca0e017d90e075488709c033b002450029ad70 | 499 | module CampusSolutions
module FinancialAidExpiry
def self.expire(uid=nil)
[
MyFinancialAidData,
MyFinancialAidFundingSources,
MyFinancialAidFundingSourcesTerm,
FinancialAid::MyAidYears,
FinancialAid::MyFinaidProfile,
FinancialAid::MyFinancialAidSummary,
... | 24.95 | 44 | 0.669339 |
edef3731e45117ac53db63147b4198590b4bf23d | 67 | class PostController < ApplicationController
def index
end
end
| 13.4 | 44 | 0.80597 |
33a9b0debf3e4ce2e184b9c602f134ad2115cb98 | 846 | # Ensure we require the local version and not one we might have installed already
require File.join([File.dirname(__FILE__),'lib','uyirmei','version.rb'])
spec = Gem::Specification.new do |s|
s.name = 'uyirmei'
s.version = Uyirmei::VERSION
s.author = 'RC'
s.email = 'rc.chandru@gmail.com'
s.homepage = 'https:/... | 36.782609 | 81 | 0.695035 |
11604e83f0d6f0fea4acb24807ca0f056bb76df3 | 1,586 | require 'spec_helper'
require 'support/requests/request_helpers'
describe 'api' do
before(:each) do
@user = create(:user, :with_company)
@company = @user.companies.first
end
context 'invite two users' do
let(:email1) { 'gug@gug.com' }
let(:email2) { 'gug2@gug.com' }
subject do
do_post ... | 31.098039 | 78 | 0.620429 |
03c73aaa074166ea4973c61cedfa1486995a0fbb | 250 | module Madmin
class BaseController < ActionController::Base
include Pagy::Backend
protect_from_forgery with: :exception
# Loads all the models for the sidebar
before_action do
Rails.application.eager_load!
end
end
end
| 19.230769 | 47 | 0.728 |
0377e50011a285fd73b4fbd1c96572d45bc7dcf9 | 114 | class Toy < ActiveRecord::Base
self.primary_key = :toy_id
belongs_to :pet
scope :with_pet, joins(:pet)
end
| 16.285714 | 30 | 0.719298 |
18b1e07ea0a1df5d701c61fdd4e28b2dcdb2cc84 | 10,428 | require 'miner/event/events'
# Triggers module
module Triggers
# Module logger
@@logger = nil
# ID -> instance maps
@@triggers = {}
# An event trigger
class Trigger
def initialize(id, triggerId, filters)
@id = id
@triggerId = triggerId
... | 34.876254 | 122 | 0.482643 |
61d7a4c0689be58bd1853c36ec3ccc456f0f69b7 | 2,561 | # frozen_string_literal: true
# Redmine - project management software
# Copyright (C) 2006-2019 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the L... | 34.146667 | 88 | 0.75166 |
4a957d7bd5c82553a17c67470befe740d4883332 | 1,075 | require 'shellwords'
module SimCtl
class Command
module Create
# Creates a device
#
# @param name [String] name of the new device
# @param devicetype [SimCtl::DeviceType] device type of the new device
# @param runtime [SimCtl::Runtime] runtime of the new device
# @return [SimC... | 39.814815 | 112 | 0.671628 |
ac6cc053b6dc8d943ee99904c75800fa51c3edf7 | 3,077 | require 'test_helper'
class MeasureTest < Minitest::Test
def setup
@subject = Geode::Measure
end
def test_numerics_return_new_instance_with_unit
assert_equal :degree, 1.degree.unit
assert_equal :kilometer, 1.kilometer.unit
assert_equal :mile, 1.mile.unit
assert_equal :radian, 1.radian.unit
... | 36.2 | 74 | 0.753656 |
87e4df415124afac9387ff1fe6d6d9c87b7cc3d6 | 10,325 | class Pool < ApplicationRecord
class RevertError < Exception;
end
array_attribute :post_ids, parse: /\d+/, cast: :to_i
belongs_to_creator
validates :name, uniqueness: { case_sensitive: false, if: :name_changed? }
validates :name, length: { minimum: 1, maximum: 250 }
validates :description, length: { max... | 25.182927 | 146 | 0.669249 |
ff86b0e83332a2794a53efae1187de6ff35628db | 148 | module MiqAeMethodService
class MiqAeServiceManageIQ_Providers_Openstack_CloudManager_CloudVolumeBackup < MiqAeServiceCloudVolumeBackup
end
end
| 29.6 | 111 | 0.912162 |
ab432486909db991a5703645057b59a6e895f0ff | 5,108 | # encoding: utf-8
require 'ostruct'
require_relative '../../lib/importer/loader'
require_relative '../../lib/importer/source_file'
require_relative '../../lib/importer/exceptions'
require_relative '../doubles/job'
require_relative '../doubles/ogr2ogr'
require_relative '../doubles/georeferencer'
require_relative '../../... | 39.596899 | 111 | 0.690681 |
03a1e2a4b851f2bba0ee5022566205034ae63327 | 916 | #
# Copyright:: Copyright (c) 2018 Chef Software 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
#
# http://www.apache.org/licenses/LICENSE-2.... | 28.625 | 74 | 0.740175 |
5d66a8db2858d9bbfe1ffe836e27881fcc2b8718 | 115 | module Log
module_function
def log(msg, indent = 3)
puts "- #{Time.now} #{'-' * indent}> #{msg}"
end
end | 16.428571 | 48 | 0.573913 |
7af333d623ffa512defb1c45e1b21bd4b688179c | 570 | cask :v1 => 'geppetto' do
version '4.2.0'
if Hardware::CPU.is_32_bit?
sha256 '78f578ff4cf0a9eadf85cc5a821e55125ee98ab4a8e1d4f0f5d1607487314804'
url "https://downloads.puppetlabs.com/geppetto/4.x/geppetto-macosx.cocoa.x86-#{version}-R201407250959.zip"
else
sha256 '7a09c823cea9900cb51d009f47fab69569e1d... | 35.625 | 113 | 0.773684 |
7a6a75c3185397f8e0f85ae14a848c2fb0a3b30d | 2,183 | # typed: false
# frozen_string_literal: true
require "macho"
require "os/mac/architecture_list"
# {Pathname} extension for dealing with Mach-O files.
#
# @api private
module MachOShim
extend Forwardable
delegate [:dylib_id, :rpaths, :delete_rpath] => :macho
def macho
@macho ||= begin
MachO.open(to_s... | 18.982609 | 80 | 0.613376 |
1c881f854c38480d2d7d8324dfd64487265feeaa | 1,278 | module AbAdmin
module Models
class TypeModel
include ::EnumField::DefineEnum
attr_reader :code
class_attribute :codes, :i18n_scope, instance_writer: false
self.codes = []
self.i18n_scope = [:admin, :type_model]
def initialize(code)
@code = code.to_sym
end
... | 22.821429 | 85 | 0.556338 |
5dc4085d333b2840ff745e7fc19e678912055ae6 | 2,020 | require 'spec_helper'
describe Puppet::Type.type(:iis_site).provider(:webadministration) do
subject(:webadministration) { described_class.new }
let(:resource) do
result = Puppet::Type.type(:iis_site).new(name: 'iis_site')
result.provider = webadministration
result
end
context 'verify provider' do... | 34.237288 | 93 | 0.544554 |
edfd66f0c1dc40749e585fd4eaf4d3395f8980f2 | 86 | # frozen_string_literal: true
require './server'
$stdout.sync = true
run Server.app | 12.285714 | 29 | 0.744186 |
8779577258b3b39d56d8dbc1ae26c78c0f9c209d | 2,317 | # LDAP authorization model
#
# * Check if we are allowed access (not blocked)
#
module Gitlab
module LDAP
class Access
attr_reader :provider, :user
def self.open(user, &block)
Gitlab::LDAP::Adapter.open(user.ldap_identity.provider) do |adapter|
block.call(self.new(user, adapter))
... | 26.329545 | 104 | 0.578334 |
38c36cc38712a9d5400f0035e4eaa7408ea8b234 | 769 | module Museum
class Loupe < ::ApplicationRecord
extend ::FriendlyId
friendly_id :title, use: :slugged
validates_presence_of :title
def self.id_by_slug(name)
( find_by_slug(name) || abort(name) ).id
end
def magnify(gem)
parse_as(data_format, response(gem))
end
def url(ge... | 19.717949 | 82 | 0.572172 |
39cbd01aa46a030cba06767a253fcc9bb5d130ce | 193 | class AddStatusIndexToSubmissions < ActiveRecord::Migration[5.0]
def change
add_index :submissions, [:exercise_id, :user_id, :status, :created_at], :name => 'ex_us_st_cr_index'
end
end
| 32.166667 | 104 | 0.751295 |
6a63b894875a8e0c0b6b95620c6d971e3b9e569d | 5,049 | require 'spec_helper_integration'
feature 'Authorization Code Flow' do
background do
config_is_set(:authenticate_resource_owner) { User.first || redirect_to('/sign_in') }
client_exists
create_resource_owner
sign_in
end
scenario 'resource owner authorizes the client' do
visit authorization_en... | 33.66 | 98 | 0.752822 |
385d943680ff73897a3066616d08e6ff93dc426e | 3,233 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'v1/roles', type: :request do
let!(:role1) { create(:role) }
let!(:role2) { create(:role) }
describe '#index' do
before { get '/api/v1/roles', params: params }
context 'with no options' do
let(:params) { {} }
it 'lists ro... | 29.935185 | 66 | 0.622642 |
5df9f3a3ee6dd14c6778d0c62e2c226cb7ead739 | 287 | class RemoveExtendingOrganisationFromActivities < ActiveRecord::Migration[6.0]
def change
remove_column :activities, :extending_organisation_name
remove_column :activities, :extending_organisation_reference
remove_column :activities, :extending_organisation_type
end
end
| 35.875 | 78 | 0.832753 |
26ba649a512211d09c832b91d776d56b80f03ad2 | 475 | Pod::Spec.new do |s|
s.name = "react-native-beacons-manager"
s.version = "1.1.0"
s.summary = "React-Native library for detecting beacons (iOS and Android)"
s.homepage = "https://github.com/MacKentoch/react-native-beacons-manager#readme"
s.license = { :type => "MIT" }
s.authors ... | 33.928571 | 86 | 0.555789 |
ab273908e7d0bc0e894cbb8f9c3667efcf00c5af | 376 | require 'rails_helper'
RSpec.describe Like, type: :model do
subject { Like.new(author_id: 7, post_id: 7) }
before { subject.save }
it 'checks that "author_id" is an integer' do
subject.author_id = 7.5
expect(subject).to_not be_valid
end
it 'checks that "post_id" is an integer' do
subject.author... | 22.117647 | 48 | 0.694149 |
1124413b5fd42dd65524918f327d77fbdcc34176 | 4,434 | # frozen_string_literal: true
require 'pathname'
require './lib/auxiliary/downloader'
require './lib/auxiliary/json_helper'
require './lib/auxiliary/string_helper'
require './lib/auxiliary/extra_software/exceptions'
require './lib/engines/hckinstall/setup_scripts_helper'
# AutoHCK module
module AutoHCK
# ExtraSoft... | 32.130435 | 113 | 0.633514 |
e2c495475467d92341f8724a205eab2272cebe34 | 1,711 | require 'spec_helper'
describe Tugboat::Middleware::SSHDroplet do
include_context "spec"
before do
allow(Kernel).to receive(:exec)
end
describe ".call" do
it "exec ssh with correct options" do
expect(Kernel).to receive(:exec).with("ssh",
"-o", "IdentitiesOnly=yes",
... | 30.553571 | 61 | 0.485096 |
281aee99ec0ff728bba32ee6d9526acaf08bb3d8 | 616 | # 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, ... | 38.5 | 74 | 0.766234 |
798f3fc86e1357be23259e34d3b5964b5fa5de0d | 4,027 | default['android-sdk']['name'] = 'android-sdk'
default['android-sdk']['owner'] = 'root'
default['android-sdk']['group'] = 'root'
default['android-sdk']['setup_root'] = nil # ark defaults (/usr/local) is used if this attribute is not defined
de... | 66.016393 | 141 | 0.427862 |
ff0e8296f29cf7aa6ad43719a9d6bdda2a913d57 | 458 | require 'test/unit'
require File.dirname(__FILE__) + '/../lib/die'
require 'shoulda'
class TestDie < Test::Unit::TestCase
context 'Die.roll' do
setup do
seed = 1234567890
srand(seed)
@expected_rand = rand
srand(seed)
end
should 'return a value between 1 and the number of sides'... | 19.913043 | 64 | 0.637555 |
e2758f9e100acd89770bfaa38cb6c663a7b659f0 | 741 | module Tori
class Controls
CONTROLS = {
'a' => :left,
'd' => :right
}
def initialize(window, player)
@window = window
@player = player
end
def button_down(key)
case CONTROLS[key]
when :left, :right then @player.walking!
end
end
def button_up(ke... | 17.642857 | 93 | 0.580297 |
e247ebdcd4c872979c72bbd60aa19a7615efcdc0 | 944 | class DropContactsTriggers < ActiveRecord::Migration[5.0]
def up
if respond_to?(:drop_trigger)
drop_trigger("not_ready_contacts_before_insert_update_row_tr", "contacts", :generated => true)
drop_trigger("contacts_before_insert_update_row_tr", "contacts", :generated => true)
end
end
def down
... | 37.76 | 112 | 0.6875 |
267eff645a61d6b13fc992144a4babf552da31d2 | 116 | RSpec.describe HerokuTool do
it "has a version number" do
expect(HerokuTool::VERSION).not_to be nil
end
end
| 19.333333 | 45 | 0.741379 |
ed200344439e6b828464551b35e5bdd00907940a | 5,153 | module Steep
module AST
module Annotation
class Collection
attr_reader :annotations
attr_reader :builder
attr_reader :current_module
attr_reader :var_type_annotations
attr_reader :const_type_annotations
attr_reader :ivar_type_annotations
attr_reader :... | 30.134503 | 91 | 0.599069 |
4a4dc0767b02f5bd3840a37083fcb7c6b5714cfd | 1,352 | require 'plain_model/querying/base'
require 'plain_model/querying/with_model'
require_relative 'querying/select'
require_relative 'querying/from'
require_relative 'querying/where'
require_relative 'querying/order_by'
require_relative 'querying/group_by'
require_relative 'querying/having'
require_relative 'querying/limi... | 32.190476 | 46 | 0.79142 |
873b599f84d4a4fc4161a8592df84f5ef48350e1 | 4,780 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Database::LoadBalancing::HostList do
def expect_metrics(hosts)
expect(Gitlab::Metrics.registry.get(:db_load_balancing_hosts).get({})).to eq(hosts)
end
before do
allow(Gitlab::Database)
.to receive(:create_connection_pool)
... | 25.291005 | 89 | 0.642887 |
e8a777af2a4c725e33ab43ede4eb31238475806a | 22,180 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 53.062201 | 347 | 0.660009 |
b9a3c34605bf1ae44a13e5f1f45d061d9409ea3f | 1,943 | # frozen_string_literal: true
require "test_helper"
require "project_types/extension/extension_test_helpers"
module Extension
module Tasks
module Converters
class VersionConverterTest < MiniTest::Test
include TestHelpers::FakeUI
def setup
super
ShopifyCLI::ProjectType.l... | 36.660377 | 103 | 0.686052 |
010ba809f24ff990d2ad2f22ddea03244ca63e52 | 507 | # app/lib/message.rb
class Message
def self.not_found(record = 'record')
"Sorry, #{record} not found."
end
def self.invalid_credentials
'Invalid credentials'
end
def self.invalid_token
'Invalid token'
end
def self.missing_token
'Missing token'
end
def self.unauthorized
'Unautho... | 16.9 | 61 | 0.704142 |
e9face6a2bec3e96360402448c8a6089f919488a | 1,137 | require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
describe Restful::Access::RuleSet do
describe "allow" do
before(:each) do
@ruleset = Restful::Access::RuleSet.new
@controller = ActionController::Base.new
@action = "index"
end
it "should return false if there are no ... | 35.53125 | 72 | 0.630607 |
01e52c55baea23a95f9bf15239872d5d2d3fc2e5 | 37 | class Team < ActiveRecord::Base
end
| 9.25 | 31 | 0.756757 |
33d8cd311b80bd5ecc043dd245f373d75e920507 | 222 | class CreateAccessTokens < ActiveRecord::Migration[5.1]
def change
create_table :access_tokens do |t|
t.references :user, foreign_key: true
t.string :password_digest
t.timestamps
end
end
end
| 20.181818 | 55 | 0.698198 |
fff30a9c1e772be7da46fc70b876df00e49392e5 | 133 | #encoding: utf-8
module GeeePay
class Railtie < Rails::Railtie
rake_tasks do
load 'rake/geee_pay.rake'
end
end
end
| 14.777778 | 32 | 0.676692 |
285a08500203fd1eefc6a873d5f3c0aeb778432e | 993 | require "spec_helper"
RSpec.describe Bruv do
it { expect(Bruv::VERSION).not_to be_nil }
class DummyClass
include Bruv
attribute :a
attribute :d, ->(d) { d.upcase }
attributes :b, :c
end
let(:a) { 1 }
let(:d) { "abc" }
let(:b) { 2 }
let(:c) { "3" }
context "correct number of params ... | 27.583333 | 90 | 0.654582 |
1de8e62195f161f04dee3e5a78c684b29c41f59d | 304 | module MemberHelper
def member
{
"object": "Member",
"id": "1",
"email": "email@example.com",
"quality_score": 0.86,
"credit": "$5.00",
"credit_cents": 500,
"created": "2015-05-22T14:56:29.000Z",
"updated": "2015-05-22T14:56:28.000Z"
}
end
end
| 20.266667 | 44 | 0.526316 |
03091eb871465026e2b00f84c93406f171870887 | 741 | require 'calculate_reverse_polish/core'
module CalculateReversePolish
module REPL
class << self
def run(client: nil)
@core = Core.new
catch_signals
loop do
repl('>')
end
end
private
def catch_signals
# Trap ^C
Signal.trap("INT"... | 16.466667 | 39 | 0.516869 |
03b444d77eeaafa41bcce506b401284b5bbff69d | 1,465 | #
# Be sure to run `pod lib lint AttributedString.swift.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.694444 | 119 | 0.656655 |
abed2e09ac8266d7be0aa752d23560fd9cf32fb7 | 172 | # frozen_string_literal: true
require 'rspec/cloud/core/matchers/be_equal_to'
require 'rspec/cloud/core/matchers/have_digits'
require 'rspec/cloud/core/matchers/have_key'
| 28.666667 | 47 | 0.825581 |
5da873290f2a654abcfc24ef9c7b1080c4968e83 | 1,459 | require 'vertx-web/template_engine'
require 'vertx/util/utils.rb'
# Generated from io.vertx.ext.web.templ.ThymeleafTemplateEngine
module VertxWeb
# A template engine that uses the Thymeleaf library.
class ThymeleafTemplateEngine < ::VertxWeb::TemplateEngine
# @private
# @param j_del [::VertxWeb::ThymeleafT... | 39.432432 | 166 | 0.710075 |
1a6ac658b92b9b58c0e6c2440d2436001bd1fa51 | 387 | ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'mocha/mini_test'
class ActiveSupport::TestCase
self.use_transactional_fixtures = true
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
... | 25.8 | 82 | 0.73385 |
bf7f51572a6eefea96bd092cd6d579da1bffcc7a | 3,763 | # Encoding: utf-8
# Cookbook Name:: dmg
# Provider:: package
#
# Copyright 2011, Joshua Timberman
#
# 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/LICENS... | 39.197917 | 180 | 0.701834 |
f7562acdcaa21f51bf188063c4d989c1497d097a | 398 | Spree::Api::V1::StockLocationsController.class_eval do
before_filter :artist_locations, only: [:index]
before_filter :artist_transfers, only: [:index]
private
def artist_locations
params[:q] ||= {}
params[:q][:artist_id_eq] = spree_current_user.artist_id
end
def artist_transfers
params[:q] |... | 20.947368 | 60 | 0.708543 |
91e21eedf03b59493cd17e15ac9aeb3419a52339 | 1,377 | class Class
def inherited s
p Object.constants.include?(s.name)
if s.name == "YAML::Syck::Resolver" then
raise IOError
end
if $raise then
$sub = s
puts "raise #{$raise}"
raise $raise
end
puts "#{s} < #{self}"
end
end
class B
end
class A < B
end
class << se... | 11.87069 | 45 | 0.586783 |
21bfa82e7b744bc06972f2c16448843fd7958842 | 2,850 | require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
module Polonium
module ServerRunners
describe ExternalServerRunner do
attr_reader :configuration, :rails_env, :rails_root, :runner, :start_server_command, :stop_server_command, :original_start_server_command, :original_stop_server... | 38.513514 | 175 | 0.639298 |
28bf9f4ae4bf8890f8d60f7d07212c338e271536 | 6,510 | class CLI
#Array of all pokemon for which pictures are available
@@picture_array = [
"Bulbasaur",
"Ivysaur",
"Venusaur",
"Charmander",
"Charmeleon","Charizard","Squirtle","Wartortle","Blastoise","Caterpie",
"Metapod","Butterfree","Weedle","Kakuna","Beedrill","Pidg... | 36.166667 | 127 | 0.583717 |
4a0ca32775651d9b60d7935c41ee67a41da50aac | 1,289 | class Rdup < Formula
desc "Utility to create a file list suitable for making backups"
homepage "https://github.com/miekg/rdup"
url "https://github.com/miekg/rdup/archive/1.1.15.tar.gz"
sha256 "787b8c37e88be810a710210a9d9f6966b544b1389a738aadba3903c71e0c29cb"
revision 1
head "https://github.com/miekg/rdup.gi... | 33.051282 | 101 | 0.723817 |
382f7529a919df4925cc0a071d4893fdc8e86bc1 | 301 | class CreateSites < ActiveRecord::Migration[5.0]
def change
create_table :sites do |t|
t.string :code, index: true
t.string :name
t.string :status
t.string :url
t.text :description
t.text :topics, array: true, default: []
t.timestamps
end
end
end
| 21.5 | 48 | 0.614618 |
e26fd1595fec1e40c4cca8c93e23d29cb2853717 | 1,508 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::ServiceFabric::V6_5_0_36
module Models
#
# Safety check that ensures that a quorum of replicas are not lost for a
# partition.
... | 25.133333 | 76 | 0.537798 |
7a2d7d68ce208c66e1924132128296dde33fda53 | 4,044 | require_relative '../../features/support/element_helper.rb'
module Accessors
def self.button(name, locator)
# generates method for clicking button.
# this method will not return any value.
# @example click on 'Submit' button.
# button(:login_button,"xpath~//UIButtonField")
# def click_login_but... | 27.69863 | 140 | 0.680762 |
e2e2453ca75b44e24a87f1dae14cc425192d38b9 | 1,411 | # encoding: utf-8
require 'spec_helper'
describe Github::Gists::Comments, '#create' do
let(:gist_id) { 1 }
let(:request_path) { "/gists/#{gist_id}/comments" }
let(:inputs) {
{ "body" =>"Just commenting for the sake of commenting",
"unrelated" => true }
}
before {
stub_post(request_path).with(... | 27.134615 | 72 | 0.666903 |
bb6741c9b4e02dc7308c57c908d31fd6baca881d | 1,263 | require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
module TrackerGit
describe Command::Deploy do
describe "#call" do
it "calls system command `cap demo deploy`" do
mock(Command::Deploy).system("cap demo deploy")
Command::Deploy.call(tracker)
end
context "w... | 30.071429 | 99 | 0.593032 |
01f608426bc7aa1b97162b1cae7f5691ec21e6b8 | 728 | # Returns a new instance of the Hash class being benchmarked. Define before
# loading if using a class besides Hash.
unless Object.public_method_defined? :new_hash
def hash_class
Hash
end
def new_hash
Hash.new
end
end
# Repeatable sequence of random numbers
srand(1)
STRING = "rdnqsp uxq\nhnokjirs\nb ... | 22.060606 | 115 | 0.677198 |
e95eba94b6ce7043dc098e6a098074f3417b43ee | 50 | require "ted_talks/version"
module TedTalks
end
| 8.333333 | 27 | 0.8 |
edd5eec4d698a8a882a8f81ae4f57b65fe9f277e | 811 | # frozen_string_literal: true
# Helpers for dealing with ContentItemSelectionParams which live in the session
# during the process of a Canvas deployment
module SelectionParams
extend ActiveSupport::Concern
included do
helper_method :selection_params
end
private
def selection_params
session[:conte... | 21.342105 | 79 | 0.787916 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.