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 |
|---|---|---|---|---|---|
ffda1ebdab60c59ff115c8a2d7445bf0f7fb8c7a | 4,683 | require 'spec_helper'
require 'sidekiq/testing'
describe SweepsController do
render_views
let(:project) { create(:project) }
describe '#index' do
subject do
get :index, { project_id: project.to_param }
end
context 'with no sweeps' do
it { should be_success }
end
context 'with t... | 23.183168 | 70 | 0.568866 |
21f4e116673031f850197c87f012a94bd8025352 | 153 | # typed: false
require_relative "computer"
program = ARGF.read.split(?,).map(&:to_i)
computer = Computer.new(program)
computer.run(StringIO.new("5\n"))
| 21.857143 | 41 | 0.72549 |
b92ee83ba44179677eb14dc6a0639f07e598a1ac | 760 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Users::UpdateHighestMemberRoleService do
let_it_be(:user) { create(:user) }
subject(:execute_service) { described_class.new(user).execute }
describe '#execute' do
context 'with an EE-only access level' do
before do
allow(user... | 28.148148 | 104 | 0.693421 |
28f3abd57ed0ab474ea95d11289c3d0de6a98b54 | 854 | module RubyEventStore
module ROM
module Memory
class UnitOfWork < ROM::UnitOfWork
def self.mutex
@mutex ||= Mutex.new
end
def commit!(_gateway, changesets, **_options)
self.class.mutex.synchronize do
committed = []
begin
unt... | 24.4 | 94 | 0.512881 |
794351d592f504065ef90d28e3d6ab188a007e19 | 1,185 | class Progress < Formula
desc "Coreutils progress viewer"
homepage "https://github.com/Xfennec/progress"
url "https://github.com/Xfennec/progress/archive/v0.15.tar.gz"
sha256 "1ed0ac65a912ef1aa605d524eaddaacae92079cf71182096a7c65cbc61687d1b"
license "GPL-3.0"
head "https://github.com/Xfennec/progress.git"
... | 28.902439 | 94 | 0.729114 |
87cd9c5404a7591a481457abe330f5718aa05010 | 640 | module Workbaskets
class EditQuotaBlockingPeriodSettings < Sequel::Model(:edit_quota_blocking_period_workbasket_settings)
include ::WorkbasketHelpers::SettingsBase
extend ActiveSupport::Concern
attr_accessor :description,
:start_date,
:end_date
def collection_mode... | 19.393939 | 104 | 0.665625 |
03aa4c0f12e05b4d29f0572ae37af48322ba99a8 | 536 | class AddSecretIdToShares < ActiveRecord::Migration[4.2]
def up
add_column :stash_engine_shares, :secret_id, :string, after: :sharing_link
# transform data from old to new column
StashEngine::Share.reset_column_information
StashEngine::Share.all.each do |s|
s.update_column(:secret_id, s.sharing_... | 33.5 | 133 | 0.718284 |
ed1ad22123f171c5f0ef8ff30dbdf0b2acbafaf3 | 10,570 | #
# Fluentd
#
# 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, so... | 27.815789 | 192 | 0.667077 |
1dc63b4aafe87889826e3122d702bcf3e2f7c3de | 1,319 | require 'test_helper'
class RaceCondidationRegistrationTest < ActionDispatch::IntegrationTest
setup do
class ActiveRecord::Validations::UniquenessValidator
alias saved_validate_each validate_each
def validate_each(_record, _attribute, _value)
true
end
end
end
teardown do
cla... | 26.38 | 71 | 0.629265 |
e8de94cb4521ec6f45082d3118a6b1036549edca | 707 | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module RailsForms
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rail... | 30.73913 | 79 | 0.738331 |
1c18820cb8c7750c547dffc2c3f80210bc77ed4e | 1,625 | #-- 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,... | 30.660377 | 91 | 0.713231 |
08c2f3e10d60779290cdf4cfbc37530c6bb43472 | 7,579 | module DataMapper
module Is
module List
##
# method for making your model a list.
# it will define a :position property if it does not exist, so be sure to have a
# position-column in your database (will be added automatically on auto_migrate)
# if the column has a different name, s... | 38.668367 | 116 | 0.593878 |
5d0d6f4544d3dd0c261975a17945c4055ddcd1f8 | 375 | require "json"
module Terastream
class JsonBuilder < Terastream::Query::BaseFormatter
def call(&block)
row_data = {}
@app.headers.each_with_index do |header, index|
row_data[header] = @app.record_set.getString(index + 1)
end
if block_given?
yield row_data.to_json
els... | 20.833333 | 63 | 0.634667 |
e27788f4b0901d80e43a7cbc762868628de203ce | 8,804 | #
# Author:: Tim Dysinger (<tim@dysinger.net>)
# Author:: Christopher Brown (cb@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... | 43.369458 | 329 | 0.627896 |
26e6a74a104d4a3af02cbbc8d66b2a100be99db6 | 4,731 | module Honeybadger
class Sender
NOTICES_URI = '/v1/notices/'.freeze
HTTP_ERRORS = [Timeout::Error,
Errno::EINVAL,
Errno::ECONNRESET,
EOFError,
Net::HTTPBadResponse,
Net::HTTPHeaderSyntaxError,
Net... | 28.847561 | 181 | 0.609808 |
089b8590ca98236ac5f749b9099c814f6952f0a3 | 3,014 | test_name "puppet module list (with invalid dependencies)"
teardown do
on master, "rm -rf #{master['distmoduledir']}/thelock"
on master, "rm -rf #{master['distmoduledir']}/appleseed"
on master, "rm -rf #{master['distmoduledir']}/crakorn"
on master, "rm -rf #{master['sitemoduledir']}/crick"
end
step "Setup"
on... | 31.072165 | 106 | 0.586264 |
91d36e9fe6b496440868e7adafcb6ab20a955f86 | 1,028 | # Copyright 2018 Noragh Analytics, Inc.
#
# 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 i... | 29.371429 | 77 | 0.718872 |
87b6bdd22a915411a64601158055fdfe218eb3c2 | 714 | require 'test_helper'
class MicropostTest < ActiveSupport::TestCase
def setup
@user = users(:michael)
@micropost = Micropost.new(content: "Lorem ipsum", user_id: @user.id)
end
test "should be valid" do
assert @micropost.valid?
end
test "user id should be present" do
@micropost.user_id = ni... | 21.636364 | 73 | 0.693277 |
01a966941bef767e3354ddc5c41843dd72252098 | 505 | require 'spec_helper.rb'
describe 'curation_concern/base/_related_files.html.erb' do
it 'displays a donload button' do
file = stub_model(GenericFile, audit_stat: true, pid: '1234')
work = stub_model(GenericWork, pid: '5678')
work.generic_files += [file]
allow(view).to receive(:can?) { true }
ren... | 29.705882 | 65 | 0.710891 |
7a36f8dc6d6a392098e6e44b8bff50083c341023 | 4,418 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 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... | 28.875817 | 94 | 0.729742 |
3940886bb1379d59234c36c6e781b38bc3deda65 | 1,425 | #--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
class Gem::Ext::Builder
def self.class_name
name =~ /Ext::(.*)Builder/
$1.downcase
end
def self.make(dest_path, results)
unless File.exist? 'Makefile' then
r... | 25 | 78 | 0.604211 |
79839a81e52ee548f49cc9723b8468514286b026 | 652 | ActiveAdmin.register ActiveAdmin::Comment, :as => 'Comment' do
menu label: 'Комментарии',
:if => proc { current_admin_user.can_view_comments? },
:priority => 12
batch_action :destroy, false
config.clear_action_items!
index do
# selectable_column
id_column
column :author
column ... | 23.285714 | 95 | 0.599693 |
38520cc1e6b762430508ef3ca16557e6a640d48d | 233 | #!/usr/bin/env ruby
require_relative 'simulator'
simulator = Simulator.new
while a = gets
puts "Reading: #{a}"
err, msg = simulator.execute(a)
if err == true
puts msg
exit
elsif a == "REPORT"
puts err
end
end | 14.5625 | 33 | 0.639485 |
019309eb7be91cbf436647e59e40b913e32bb0c6 | 207 | $LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'pinbo'
require 'spec'
require 'spec/autorun'
Spec::Runner.configure do |config|
end
| 20.7 | 66 | 0.7343 |
e9cd7c8219def68bb66331a6ebc6ae3960cb8786 | 666 | class Loan < ActiveRecord::Base
REGULAR_PERIOD = 30.days
EXTENSION_PERIOD = 15.days
scope :by_most_recent, -> { order('started_at desc') }
belongs_to :borrower, foreign_key: :user_id, class_name: 'User'
belongs_to :book
validates_presence_of :book, :borrower
def start!
update! started_at: Time.now,... | 18 | 66 | 0.6997 |
d57a39d133f7f98bd00a8a27b20ade11db538049 | 134,427 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
include ProjectForksHelper
include StubRequests
include Ci::SourcePipelineHelpers
let_it_be(:user) { create(:user) }
let_it_be(:namespace) { create_default(:namespace).freeze }
let_it_be(:p... | 30.981102 | 152 | 0.641887 |
621186f24535f0c30bcac0676986132cbc8228cd | 69 | module Materialist
class ResourceNotFound < StandardError; end
end
| 17.25 | 45 | 0.826087 |
f880798086f51b996ae235c8a9022dbdfa49d540 | 590 | # frozen_string_literal: true
module Hearth
module HTTP
# Base class for HTTP errors returned from an API. Inherits from
# {Hearth::ApiError}.
class ApiError < Hearth::ApiError
def initialize(http_resp:, **kwargs)
@http_status = http_resp.status
@http_headers = http_resp.headers
... | 22.692308 | 68 | 0.640678 |
03087084851c5c107133ee03e7981e95e0d81a3e | 24 | require 'mix-rails-core' | 24 | 24 | 0.791667 |
bfa3a2f5ccee2a7b4cc6eeeed566dc97ce0aefe4 | 183 | # frozen_string_literal: true
module DateHelper
def to_date_format(date)
date.strftime(RubyOpenFormValidators::Constants::DATE_FORMAT) if date.respond_to?(:strftime)
end
end
| 22.875 | 96 | 0.797814 |
33ad53adc557c9008ae994567aeb723efebde58f | 357 | cask 'fluxcenter' do
version '1.2.13.47658'
sha256 'c28ae7d6185e86c22cb3d293d33ba2dd9a696f1221fc254ad47a074e4da28486'
url "https://fluxhome.com/wp-content/uploads/files/Center/MacOS/Flux_FluxCenter_MacOS_Installer_(#{version}).dmg"
name 'FluxCenter'
homepage 'http://www.fluxhome.com/'
depends_on macos: '>... | 27.461538 | 115 | 0.764706 |
f805b3de7e7eebfd9c8fb9d24d47d012067df07a | 103 | def fixtures_dir(path = '')
File.join(File.join(File.dirname(__FILE__), '..', path, 'fixtures'))
end
| 25.75 | 70 | 0.669903 |
87283bce17f846e6f4dd5a16fd133f82815cf77d | 1,258 | #!/usr/bin/env ruby
require 'rubygems'
require 'minitest/unit'
require 'minitest/autorun'
require 'quartz_torrent/interruptiblesleep'
class TestInterruptibleSleep < MiniTest::Unit::TestCase
def setup
end
def testWake
sleeper = QuartzTorrent::InterruptibleSleep.new
woke = false
Thread.new do
... | 17.232877 | 69 | 0.653418 |
1827ba5af1c662e1147362ae11ae25d6dcfe7083 | 300 | cask 'delta' do
version '1.0.0'
sha256 'bd99115957d9235d2353a48aee1bef0cc9679796a26cf557873dec58c37d3385'
url "https://static-assets.getdelta.io/desktop_app/Delta-#{version}.dmg"
appcast 'https://delta.app/en/download'
name 'Delta'
homepage 'https://getdelta.io/'
app 'Delta.app'
end
| 25 | 75 | 0.743333 |
62d52605fc67311198a861768c82a83c9d327484 | 1,220 | module Fog
module Storage
class AWS
class Real
require 'fog/aws/parsers/storage/get_bucket_website'
# Get website configuration for an S3 bucket
#
#
# @param bucket_name [String] name of bucket to get website configuration for
#
# @return [Excon::Re... | 29.756098 | 94 | 0.536066 |
f7b5980abda13c25293a90c7cfbb02ae48568713 | 443 | class AccountActivationsController < ApplicationController
def edit
user = User.find_by(email: params[:email])
if user && !user.activated? && user.authenticated?(:activation, params[:id])
user.activate
log_in user
flash[:success] = "Account activated!"
redirect_to use... | 29.533333 | 84 | 0.620767 |
1a524f85caa3d1a2adf7d919f666e6b844a54424 | 2,249 | # frozen_string_literal: true
require 'test_helper'
require 'test_selector/test_helper'
class TestSelector::TestHelperTest < ActiveSupport::TestCase
include TestSelector::TestHelper
test 'right value for 3 arguments' do
assert_equal test_selector('/some/long/path.html.erb', 'dummy', 1), 'test-selector=__some... | 45.897959 | 179 | 0.745665 |
1accde304d1cb1eda849fde328a55418fdb44d39 | 442 | gitlab_ci_runner 'ruby-1.9.3' do
executor 'docker'
docker_options({
'image' => 'ruby/ruby-1.9.3',
'postgresql' => '9.1'
})
end
gitlab_ci_runner 'ruby-2.1' do
executor 'docker'
docker_options({
'image' => 'ruby/ruby-2.1',
'postgresql' => '9.2'
})
end
gitlab_ci_runner 'local' do
# shell
en... | 15.785714 | 33 | 0.597285 |
33ab23569db38b9db4cc34142c75b47d6a483b70 | 5,413 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::EXE
include Msf::Exploit::FileDropper
... | 30.581921 | 127 | 0.586736 |
183ab953aeb486389983dde9aa09a36ff7e330d4 | 1,023 | RSpec.describe "Templates Types" do
before(:each) do
@field_01 = Faker::Company.name
@field_02 = Faker::Name.name
report.add_field(:field_01, @field_01)
report.add_field(:field_02, @field_02)
report.generate("spec/result/specs.odt")
@data = Inspector.new("spec/result/specs.odt")
end
... | 22.23913 | 90 | 0.646139 |
335221cd5ea326110c5cdd45bb5f4f6732fd3e62 | 634 | class <%= @target_prefix %>NotificationsController < ActivityNotification::NotificationsController
# GET /:target_type/:target_id/notifications
# def index
# super
# end
# POST /:target_type/:target_id/notifications/open_all
# def open_all
# super
# end
# GET /:target_type/:target_id/notificatio... | 20.451613 | 98 | 0.676656 |
d5048604fc7c8c093b9562aeba30225ace79de35 | 1,624 | defined?(ComfortableMexicanSofa::Application) && ComfortableMexicanSofa::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. Rememb... | 43.891892 | 97 | 0.778325 |
61bb6b82397ff89a71272a1d3b7fd187edb6fd41 | 24 | module CensusHelper
end
| 8 | 19 | 0.875 |
7ab5f10157c630e9424c8c7b75c5e38ade4293b7 | 226 | require "spree/core"
module SpreePos
class Configuration < Spree::Preferences::Configuration
preference :pos_shipping, :string
preference :pos_printing, :string , :default => "/admin/invoice/number/receipt"
end
end | 32.285714 | 83 | 0.756637 |
edfdf842f850b44f69a7b6aee9d864556bd09a83 | 4,036 | require 'mime/types'
require 'uri'
module API
# Projects API
class Branches < Grape::API
before { authenticate! }
before { authorize! :download_code, user_project }
resource :projects do
# Get a project repository branches
#
# Parameters:
# id (required) - The ID of a project... | 33.633333 | 95 | 0.623637 |
bf9e5a50382cf77e4647bf3ea60214a3518d08ea | 896 | def storage_name_valid?(name)
!!(name =~ /\A[a-zA-Z0-9\-_]+\z/)
end
def storage_validation_error(message)
raise "#{message}. Please fix this in your gitlab.yml before starting GitLab."
end
def validate_storages_config
storage_validation_error('No repository storage path defined') if Gitlab.config.repositories.s... | 33.185185 | 110 | 0.745536 |
26c23fb627820784ed159522af4569ae3e483693 | 30 | require "google/cloud/speech"
| 15 | 29 | 0.8 |
e9b78416c856c6058fc1c53c1bd1d336a65bdfb2 | 855 | module Blazer
module Adapters
class BaseAdapter
attr_reader :data_source
def initialize(data_source)
@data_source = data_source
end
def run_statement(statement, comment)
# the one required method
end
def tables
[] # optional, but nice to have
en... | 15.833333 | 44 | 0.554386 |
18ffeffadc0370221e2cc89c3f788aed2c916289 | 380 | # frozen_string_literal: true
# ntalk_service.rb
# Check if ntalk services is enabled
Facter.add('srv_ntalk') do
confine :osfamily => 'RedHat'
setcode do
ret = ''
ntalk = Facter::Core::Execution.exec('systemctl is-enabled ntalk')
if (ntalk =~ %r{^Failed}) or (ntalk.empty?) then
ret = 'disabled'
... | 19 | 70 | 0.626316 |
3314f39a126b0148598b62d4a175a9c7b4584dbe | 487 | require 'bio-ucsc'
describe "Bio::Ucsc::Hg19::ChainPonAbe2" do
describe "#find_by_interval" do
context 'given range chr1:1-15,000' do
it 'returns a record with column accessors (r.tName == "chr1")' do
Bio::Ucsc::Hg19::DBConnection.default
Bio::Ucsc::Hg19::DBConnection.connect
i = B... | 28.647059 | 72 | 0.640657 |
f8bce4e76a9514a938ab30e19cb963a36df1ffd0 | 469 | # This migration comes from spree (originally 20201006110150)
class AddCheckoutZoneFieldToStore < ActiveRecord::Migration[6.0]
def change
unless column_exists?(:spree_stores, :checkout_zone_id)
add_column :spree_stores, :checkout_zone_id, :integer
Spree::Store.reset_column_information
default_... | 33.5 | 89 | 0.773987 |
f830a57db2985fe4ce814e47624397951c32f965 | 1,875 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'meeseeker/version'
Gem::Specification.new do |s|
s.name = 'meeseeker'
s.version = Meeseeker::VERSION
s.licenses = 'CC0-1.0'
s.summary = 'Redis based block follower is an efficient way for... | 50.675676 | 244 | 0.661333 |
abf56232affad2f8a0a099bfdc60a3ffe4d10fce | 1,219 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'User searches group settings', :js do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
before do
group.add_owner(user)
sign_in(user)
end
context 'in general settings page' do
before do
visit edit_g... | 22.574074 | 89 | 0.712879 |
876b9c1f20316fdc8611cbe8b64fca7222e01e4a | 553 | module APIv2
module Constraints
class <<self
def included(base)
apply_rules!
base.use Rack::Attack
end
def apply_rules!
Rack::Attack.blacklist('block api access from other ip if trusted ip set ') do |req|
req.env['api_v2.token'] && !req.env['api_v2.token'].all... | 24.043478 | 92 | 0.598553 |
18bf7f4a4c46179bce3ca4bfd7e55116635f4863 | 5,104 | require 'helper'
require 'ddtrace/tracer'
require 'ddtrace/span'
require 'ddtrace/propagation/distributed_headers'
class DistributedHeadersTest < Minitest::Test
def test_valid_without_sampling_priority # rubocop:disable Metrics/MethodLength
test_cases = {
{ 'HTTP_X_DATADOG_TRACE_ID' => '123',
'HTTP... | 41.495935 | 115 | 0.625196 |
388fc33a90b0166f9ccba8714665b5b2f35b7f51 | 1,337 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | 34.282051 | 86 | 0.738968 |
1d90e8272d212597150f8a75dc9a83a2f4cb202b | 716 | require 'rails_helper'
require 'shoulda/matchers'
describe MainMenu do
before do
@year_1 = FactoryGirl.create(:year, name: 2017)
@year_2 = FactoryGirl.create(:year, name: 2018)
@conf_1 = FactoryGirl.create(:conference, date: '01-01-2017')
@conf_3 = FactoryGirl.create(:conference, date: '01-01-2018')
@conf... | 26.518519 | 63 | 0.701117 |
6afb24a89755b1b40d4992d8380c13ddcb3cf57e | 189 | def main
nn, kk = gets.split(' ').map(&:to_i)
rr = gets.split(' ').map(&:to_f)
rs = rr.sort.last(kk)
val = rs.inject(0) do |acc, rate|
(acc + rate) / 2
end
p val
end
main | 14.538462 | 38 | 0.539683 |
624158c449615bae5ecbf121e3ca000b29c148c9 | 3,997 | module Pod
class Installer
def major_specs
root_specs
end
def clean_pods_about_freezed
Pod::Freezer.shared.frozen_pod_names.each do |pod_name|
sandbox.clean_pod(pod_name)
end
if sandbox.manifest && sandbox.manifest.frozen_pod_names
sandbox.manifest.frozen_pod_name... | 31.976 | 177 | 0.699775 |
ed5198d12c49764d777e4f55972d4e73fd994efa | 118 | json.extract! @post, :id, :heading, :body, :price, :neighborhood, :external_url, :timestamp, :created_at, :updated_at
| 59 | 117 | 0.728814 |
ac76cbd3e135c22612b472a4a034fef411f5c958 | 5,791 | # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 37.121795 | 245 | 0.691936 |
2173ba54f550007adca05eb42943402cdd9d1d69 | 278 | require "spec_helper"
describe Mongoid::Errors::DocumentNotFound do
describe "#message" do
let(:error) do
described_class.new(Person, "3")
end
it "contains document not found" do
error.message.should include("Document not found")
end
end
end
| 17.375 | 56 | 0.683453 |
edc6c5964eef1c7505def3484b8cd2e2a47db2b3 | 7,163 | # represents the details to connect to an openbis space
class OpenbisEndpoint < ActiveRecord::Base
belongs_to :project
belongs_to :policy, autosave: true
attr_encrypted :password, key: :password_key
has_many :external_assets, as: :seek_service # , dependent: :destroy
validates :as_endpoint, url: { allow_nil... | 29.477366 | 122 | 0.739355 |
accc079043f520c15ac02da7ed6b87f9f50922a3 | 3,182 | require_relative "../helpers"
module InventoryRefresh
class InventoryCollection
module Helpers
module QuestionsHelper
# @return [Boolean] true means we want to call .changed? on every ActiveRecord object before saving it
def check_changed?
check_changed
end
# @ret... | 35.355556 | 119 | 0.648334 |
1ac7ff64be8226ffe66bfa2aede3b512031fd316 | 607 | cask 'nativedisplaybrightness' do
version '0.0.5'
sha256 '2b79979892170036a5170746ca542518f20c980f5b5b08e067debd3e6fd14e11'
url "https://github.com/Bensge/NativeDisplayBrightness/releases/download/v#{version}/NativeDisplayBrightness_#{version.dots_to_underscores}.app.zip"
appcast 'https://github.com/Bensge/Nat... | 40.466667 | 150 | 0.799012 |
910c7605d4959763d58179e03d7aafc447e95ec5 | 2,189 | # encoding: utf-8
require 'ting_yun/support/helper'
require 'ting_yun/agent'
require 'ting_yun/instrumentation/support/external_error'
module TingYun
module Instrumentation
module ThriftHelper
def operator result_klass
namespaces = result_klass.to_s.split('::')
operator_name = namespaces[0]... | 30.830986 | 160 | 0.60804 |
fffefc19bb232e015df7d1c5cc77f5dd6d86e248 | 126 | class AddThumbnailToGallery < ActiveRecord::Migration
def change
add_column :gallery, :thumbnail_url, :string
end
end
| 21 | 53 | 0.777778 |
bb3f180f974992375c0f56aecdcc764ae3536770 | 534 | # frozen_string_literal: true
require 'chamber/commands/cloud/base'
require 'chamber/commands/comparable'
require 'chamber/commands/securable'
module Chamber
module Commands
module Cloud
class Compare < Chamber::Commands::Cloud::Base
include Chamber::Commands::Securable
include Chamber::Commands::Comparable
... | 19.777778 | 59 | 0.79588 |
9129fa56172489656d2e2eb1d6204e2b428f756a | 44,125 | # 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... | 63.216332 | 444 | 0.599773 |
79f6eb0a387a8df0812044dfb182d2c78947bbb5 | 2,520 | class Mydumper < Formula
desc "How MySQL DBA & support engineer would imagine 'mysqldump' ;-)"
homepage "https://launchpad.net/mydumper"
url "https://github.com/maxbube/mydumper/archive/v0.10.1.tar.gz"
sha256 "66b64f0c9410143ab4a32794f58769965495ac0385882b239f2c928281c1e798"
license "GPL-3.0-or-later"
bott... | 40.645161 | 108 | 0.729762 |
8744c9236097f1035a3e1f1cb2c5366d6c21e1d8 | 1,831 | # 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, software
# distributed under t... | 29.063492 | 99 | 0.694702 |
abc2d46cb1b8b00e1100d99e8cfa7e9d5a87fb54 | 433 |
# frozen_string_literal: true
require 'rails_helper'
shared_examples 'pipeline step builder' do
it 'associates created computation with pipeline' do
computation = subject.builder_for(pipeline, {}).call
expect(computation.pipeline).to eq pipeline
end
it 'associates created computation with user' do
... | 25.470588 | 56 | 0.759815 |
e954d7a44babd0eb900a04860192f93d1c6926ec | 4,731 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Sidebars::Groups::Menus::PackagesRegistriesMenu do
let_it_be(:owner) { create(:user) }
let_it_be(:group) do
build(:group, :private).tap do |g|
g.add_owner(owner)
end
end
let(:user) { owner }
let(:context) { Sidebars::Groups::C... | 27.034286 | 87 | 0.621644 |
798bd2faf6430313190bfc40b0bca885cb076285 | 1,375 | # Copyright 2015 Google Inc.
#
# 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,... | 37.162162 | 82 | 0.753455 |
4a9a0e8b19509a8c4881e04a7fa5310d45d25a76 | 11,509 | # Copyright 2018 Google Inc.
# 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, so... | 32.789174 | 95 | 0.640195 |
4abf0fa09f0f398ebe550964966bd7dea57d144d | 332 | # frozen_string_literal: true
class MergeRequestReviewer < ApplicationRecord
include MergeRequestReviewerState
belongs_to :merge_request
belongs_to :reviewer, class_name: 'User', foreign_key: :user_id, inverse_of: :merge_request_reviewers
def cache_key
[model_name.cache_key, id, state, reviewer.cache_key... | 25.538462 | 103 | 0.801205 |
b9176a161f4f25b7a0120f44bce255118fb15051 | 264 | require 'db/sqlite3'
require 'schema_dump'
class SQLite3SchemaDumpTest < Test::Unit::TestCase
include SchemaDumpTestMethods
def test_excludes_sqlite_sequence
output = standard_dump
assert_no_match %r{create_table "sqlite_sequence"}, output
end
end
| 22 | 62 | 0.795455 |
215ee3a97a64e11d858309a78b630fc01015a081 | 184 | require_dependency "cache_manager/application_controller"
module CacheManager
class StatsController < ApplicationController
def index
@stats = Stats.all
end
end
end
| 18.4 | 57 | 0.771739 |
e9553cd5d586d237cb4cab3d558dfdee749b50ab | 48 | class TestRouter
def url(**)
'#'
end
end | 9.6 | 16 | 0.5625 |
e82076eb805945e2eccc4ce6e88220ebc8a70be4 | 955 | #
# Copyright 2011 Red Hat, Inc.
#
# 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... | 28.088235 | 76 | 0.694241 |
7a8c86ecde9790b16ba4e4bfa007a97336e7c0c4 | 1,568 | #
# Be sure to run `pod lib lint JSPodTest.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 = 'JSPodTest... | 36.465116 | 103 | 0.633929 |
390c6bf0f21a24b7ea5b602a2f3dad1125175b10 | 3,300 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module A... | 30 | 76 | 0.460606 |
4a628ee4e7f7d9b63e89efa251d43cd4891c6aa5 | 3,331 | # (c) Copyright 2020 Hewlett Packard Enterprise Development LP
#
# 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... | 26.228346 | 94 | 0.739418 |
ff30b68b9cd9a42b5e5f4f8307129f03b744260f | 821 | class CreateShortenedUrlsTable < ActiveRecord::Migration
def change
create_table :shortened_urls do |t|
# we can link this to a user for interesting things
t.integer :owner_id
t.string :owner_type, :limit => 20
# the real url that we will redirect to
t.string :url, :null => false
... | 30.407407 | 65 | 0.665043 |
e92c227204087d7deb9f4bc9813a0090775dfcb9 | 80 | require 'rails_helper'
describe User do
it { should have_many :reviews }
end
| 13.333333 | 34 | 0.75 |
ab0c146d710267299b3d15a774e3eccaab4b34b3 | 49 | module DependencyManager
VERSION = "0.0.1"
end
| 12.25 | 24 | 0.734694 |
2136fead7d51045494b0555f09f9e5ae0b316d7a | 2,747 | # encoding: utf-8
module Base32
class Electrologica < Base ## Base32 (2^5 - 5-bits)
ALPHABET = %w[ 00 01 02 03 04 05 06 07
08 09 10 11 12 13 14 15
16 17 18 19 20 21 22 23
24 25 26 27 28 29 30 31 ]
def self.alphabet() ALPHABET; end ## add alpha / c... | 25.915094 | 116 | 0.488897 |
33b5d6d5b4ed2b4e0715f0a99eda2039b4f52a75 | 104 | $:.unshift File.dirname(__FILE__)
%w[remote remotes storage].each do |lib|
require "ruku/#{lib}"
end
| 17.333333 | 40 | 0.701923 |
6a6bf3c7f55a431ec29dc1b8989cb27c00c7d9e1 | 8,984 | require 'spec_helper'
require './spec/controllers/squash_many_duplicates_examples'
module Calagator
describe VenuesController, :type => :controller do
routes { Calagator::Engine.routes }
render_views
context "concerning duplicates" do
let!(:venue_master) { FactoryGirl.create(:venue) }
let!(:venue_dupl... | 29.455738 | 133 | 0.637578 |
d59680ded506242db82dd36b9d1a392d99408e55 | 4,016 | #
# Cookbook Name:: iptables-ng
# Attributes:: default
#
# Copyright 2012, Chris Aumann
#
# 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 3 of the License, or
# (at your option) a... | 38.990291 | 73 | 0.708665 |
e97d08c4ccc05a37f46246ab0c6618132a839039 | 11,781 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use yo... | 48.481481 | 150 | 0.744928 |
ff36ef84b50bbc47ac24f5c8cc1206ae633065e7 | 167 | module Afiper
class WsaaToken < ActiveRecord::Base
belongs_to :contribuyente
def auth_hash
{ Token: token, Sign: sign, Cuit: cuit }
end
end
end
| 16.7 | 46 | 0.670659 |
7992e94d8ad920e54a8c9ad55075dff4be274c64 | 351 | class Breed < ActiveRecord::Base
include Sluggable
has_many :dogs
default_scope -> { order(:name) }
def dog_image_url
return self.image_url unless self.image_url.blank?
if self.dogs.count > 0
self.image_url = self.dogs.first.image_url
self.save
return self.image_url
else
... | 15.26087 | 54 | 0.660969 |
e20f9d3cf983905e0916e12364ed24802c901369 | 1,440 | RSpec.describe Freecell::MoveLegality do
describe '#tableau_move_legal?' do
subject { described_class.tableau_move_legal?(src_card, dest_card) }
let(:five_of_spades) { Freecell::Card.new(5, :spades) }
let(:six_of_diamonds) { Freecell::Card.new(6, :diamonds) }
let(:six_of_spades) { Freecell::Card.new(... | 31.304348 | 80 | 0.665278 |
e20ef20dd6a33a214162d863fa5ffebb61e2a5d5 | 1,225 | require "formula"
class Lz4 < Formula
homepage "http://code.google.com/p/lz4/"
url "https://dl.dropboxusercontent.com/u/59565338/LZ4/lz4-r114.tar.gz"
sha1 "7b6c4c3b01edbb60e4c07657c3c41e8b5e95770e"
version "r114"
bottle do
cellar :any
sha1 "d81daa2070d46528c4fa70c4eb77ee15fe790687" => :mavericks
... | 33.108108 | 74 | 0.689796 |
03f94f0cd30cf37aa608bb760d06828249ff5364 | 27,755 | # == Schema Information
#
# Table name: communities
#
# id :integer not null, primary key
# uuid :binary(16) not null
# ident :string(255)
# domain :s... | 41.425373 | 164 | 0.591641 |
f807a114453d7c0952b6b88a413704bd1b47eb65 | 584 | module SteemApi
module Tx
class Custom < SteemApi::SqlBase
self.table_name = :TxCustoms
scope :any_required_auths, lambda { |required_auth|
where("? IN(JSON_VALUE(required_auths, '$'))", required_auth)
}
scope :any_required_posting_auths, lambda { |required_posting_auth|
... | 22.461538 | 85 | 0.652397 |
1c5ddc8c1b574b0e562e8ed340c5414971cb7b78 | 4,121 | require 'spec_helper'
describe "Option Types", :type => :feature do
stub_authorization!
before(:each) do
visit spree.admin_path
click_nav "Products"
end
context "listing option types" do
it "should list existing option types" do
create(:option_type, :name => "tshirt-color", :presentation =>... | 35.525862 | 84 | 0.6843 |
03adc76efe5c8786fbd367c963ecdd07cf6c3f8e | 2,966 | require_relative '../../spec_helper'
describe "File.utime" do
before :all do
@time_is_float = /mswin|mingw/ =~ RUBY_PLATFORM && RUBY_VERSION >= '2.5'
end
before :each do
@atime = Time.now
@mtime = Time.now
@file1 = tmp("specs_file_utime1")
@file2 = tmp("specs_file_utime2")
touch @file1
... | 35.309524 | 76 | 0.673635 |
1dbf131e87fdab0ed6777e4e101e0c62215cab9a | 116 | # frozen_string_literal: true
ActiveRecord::Base.public_send(:include, ActiveModel::ForbiddenAttributesProtection)
| 29 | 84 | 0.853448 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.