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 |
|---|---|---|---|---|---|
267f7dd71118d954d2ab7ba26f6e0641fa566290 | 1,684 | require 'rails_helper'
RSpec.describe CoursesController, type: :controller do
before(:each) do
@user = FactoryBot.create(:user)
@attr = FactoryBot.attributes_for(:course)
@model = FactoryBot.create(:course)
@entity = 'Course'
@path = courses_path
end
include_examples "permission_controller"
... | 31.185185 | 83 | 0.643705 |
872aadc14619ac8caa4812039400edf13117fce3 | 749 | class Redis
module Objects
class ConnectionPoolProxy
def initialize(pool)
raise ArgumentError "Should only proxy ConnectionPool!" unless self.class.should_proxy?(pool)
@pool = pool
end
def method_missing(name, *args, &block)
@pool.with { |x| x.send(name, *args, &block) }... | 24.16129 | 101 | 0.606142 |
abdc2cb7e042fb2806eb0a81366ed0feb7976d5c | 2,204 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: 'Example User', email: "user@example.com",
password: 'foobar', password_confirmation: "foobar")
end
test 'should be valid' do
assert @user.valid?
end
test "name should be present" do... | 28.25641 | 110 | 0.679673 |
fffbbb97a9b0379182991c3ac794b421b6072535 | 1,490 | # 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::MediaServices::Mgmt::V2019_05_01_preview
module Models
#
# Represents a token claim.
#
class ContentKeyPolicyTokenClaim
... | 25.689655 | 70 | 0.536242 |
3319115ebfc98bb298c1f2f22db399d40c880e08 | 12,967 | module Doozer
class App
include Doozer::Util::Logger
attr_accessor :options
def initialize(args={})
@options=args
# load routes
load_routes
# load the application models, coontrollers, views, and helpers
load_files
# attach the file watcher for the... | 38.250737 | 185 | 0.568443 |
f740727f627ab5a25fc7c9450cc584959b71a9ff | 756 | cask 'lingon-x' do
if MacOS.version <= :high_sierra
version '6.6.4'
sha256 'fc788402fa16df39a3d48cdc501dae31368ec6fd69ffe0026ba99932b28cae19'
else
version '7.3.1'
sha256 '13f39ef6859ada42398389376906e12b07b48a4938907f26f7658df0ccfe99a2'
end
url "https://www.peterborgapps.com/downloads/LingonX#{... | 31.5 | 89 | 0.708995 |
b9ee3e758c290c417944a7a3f08c27baf4bdf28f | 1,237 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Users API', type: :request do
let(:user) { build(:user) }
let(:headers) { valid_headers.except('Authorization') }
let(:valid_attributes) do
attributes_for(:user, password_confirmation: user.password)
end
# User signup test suite
des... | 28.113636 | 140 | 0.660469 |
281df2dfa2c1d5fc3743f3f970fef691b1e29041 | 3,867 | module ConfigurationScriptHelper
include TextualMixins::TextualGroupTags
def textual_group_properties
TextualGroup.new(
_("Properties"),
%i[hostname ipmi_present ipaddress mac_address provider_name zone]
)
end
def textual_hostname
{:label => _("Hostname"),
:icon => "ff ff-configu... | 28.226277 | 109 | 0.633307 |
ff4aa6db79ca31cb28a383adbae864006801fce3 | 1,618 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::AlertsManagement::Mgmt::V2018_05_05_preview
module Models
#
# Summary of alerts by state
#
class AlertsSummaryPropertiesSummaryByState < Alert... | 27.423729 | 76 | 0.510507 |
e85702a020101ac4bb982d644366ba1f89c0d2c1 | 120 | require "quick_search/blacklight/engine"
module QuickSearch
module Blacklight
# Your code goes here...
end
end
| 15 | 40 | 0.75 |
1c136c5066530bb4cc3289dbe43f7930cf164d91 | 1,234 | =begin
#Datadog API V1 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://openapi-generator.tech
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product... | 29.380952 | 112 | 0.730956 |
ed0ae18307648b500c1dfdf52f3d581cb8ea08ed | 361 | name 'barricade'
maintainer 'Barricade Security Systems Limited'
maintainer_email 'engineering@barricade.io'
license 'Simplified 2-Clause BSD License'
description 'Installs/Configures the barricade agent'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version ... | 40.111111 | 72 | 0.700831 |
acb89ce3ccc0de38ce16c9ae57b4f3b6d6e7cd1d | 5,538 | require_relative "../spec"
describe SparkleFormation::SparkleCollection do
describe "Basic behavior" do
before do
@collection = SparkleFormation::SparkleCollection.new
end
let(:collection) { @collection }
let(:root_pack) {
SparkleFormation::Sparkle.new(
:root => File.join(File.di... | 32.576471 | 96 | 0.673709 |
1cfc8a02bd7e6b3a34816874f37a8fcac3068f2d | 334 | require "active_model/type"
require "active_record/type"
require "tod/time_of_day_type"
module Tod
class Railtie < Rails::Railtie
initializer "tod.register_active_model_type" do
ActiveModel::Type.register(:time_only, Tod::TimeOfDayType)
ActiveRecord::Type.register(:time_only, Tod::TimeOfDayType)
... | 25.692308 | 65 | 0.760479 |
f8e2e20c10a143b0e786e2a7c02d718147fd58be | 1,355 | # -*- coding: utf-8 -*-
# /(^o^)\
require File.expand_path(File.dirname(__FILE__+'/utils'))
miquire :core, 'environment', 'serialthread', 'skin'
miquire :mui, 'web_image_loader'
require 'gtk2'
require 'observer'
# Web上の画像をレンダリングできる。
# レンダリング中は読み込み中の代替イメージが表示され、ロードが終了したら指定された画像が表示される。
# メモリキャッシュ、ストレージキャッシュがついてる。
modul... | 30.795455 | 90 | 0.628044 |
f85f6184494637f955110ff43d6e489a78772267 | 1,740 | #
# Be sure to run `pod lib lint CustomUIWidget.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 = 'Cust... | 36.25 | 106 | 0.659195 |
b941582016b0063e02b606b796a0992614d41653 | 645 | Pod::Spec.new do |s|
s.name = "TransitionableTab"
s.version = "0.2.0"
s.summary = "between tab animation"
s.description = "TransitionableTab makes it easy to animate when switching between tab"
s.homepage = "https://github.com/Interactive-Studio/TransitionableTab"
s.license = { :... | 46.071429 | 116 | 0.629457 |
abd016a6dfe8cdd5d76e7a3ccab5483064c5f5fc | 158 | if __FILE__ == $0
dir = File.dirname(__FILE__)
Dir["#{dir}/**/*_spec.rb"].reverse.each do |file|
# puts "require '#{file}'"
require file
end
end
| 19.75 | 51 | 0.601266 |
08277a7633672ebca32a41f5f2ae8d06aea78f56 | 577 | module ProsperWorks
class Client
extend Forwardable
API_VERSION_NUMBER = 1
def headers
{
"Content-Type": "application/json",
"X-PW-Application": "developer_api",
"X-PW-UserEmail": configuration.user_email,
"X-PW-AccessToken": configuration.access_token
}
e... | 19.896552 | 74 | 0.64818 |
0843f08c9a650886071286405fe6a6351e78a587 | 3,179 | # -*- coding: binary -*-
require 'msf/base'
module Msf
module Simple
###
#
# Wraps interaction with a generated buffer from the framework.
# Its primary use is to transform a raw buffer into another
# format.
#
###
module Buffer
#
# Serializes a buffer to a provided format. The formats support... | 25.031496 | 78 | 0.54514 |
913c712c1199e3380cbcbced0b54cf1b4393ae5e | 2,366 | RSpec.describe Airbrake::NestedException do
describe "#as_json" do
context "given exceptions with backtraces" do
it "unwinds nested exceptions" do
begin
begin
raise AirbrakeTestError
rescue AirbrakeTestError
Ruby21Error.raise_error('bingo')
end
... | 31.972973 | 63 | 0.586644 |
262994b06c476efef0cea6f0b741ff2a6580463b | 525 | class AddAttributesToSchools < ActiveRecord::Migration
def change
add_column :schools, :bpsid, :integer
add_column :schools, :org_code, :integer
add_column :schools, :teachers_count, :integer
add_column :schools, :core_areas_teachers_count, :integer
add_column :schools, :licensed_teachers_percenta... | 40.384615 | 63 | 0.773333 |
e99d720058a5a83872aade0c9634e448c0280254 | 6,030 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Usage::MetricDefinition do
let(:attributes) do
{
description: 'GitLab instance unique identifier',
value_type: 'string',
product_category: 'collection',
product_stage: 'growth',
status: 'data_available',
... | 29.271845 | 163 | 0.635655 |
1d72dbc63f82f5cc6068c4efc1584f854d692d66 | 506 | # frozen_string_literal: true
class PostMessageToKikService
def initialize(message, token, uid)
@message = message
@token = token
@uid = uid
end
def call
kik_client.call('message', 'POST', options)
end
private
attr_reader :message, :token, :uid
def kik_client
@_kik_client ||= Kik.n... | 14.882353 | 47 | 0.573123 |
e2994bdd99d4f83e1d110a84c8fde2898005ccd7 | 162 | FactoryBot.define do
factory :sys_site, class: Sys::Site do
name { "sys" }
host { "test-sys" }
domains { "test-sys.com" }
#group_id 1
end
end
| 18 | 40 | 0.598765 |
f7a1cec4519e31d3dbe5299d1005967b559a496a | 2,630 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 39.253731 | 96 | 0.756654 |
abaf6117bb86f61b8d6082328828229f456d0c6f | 1,025 | require 'helper'
class TestConfiguration < Test::Unit::TestCase
context "loading configuration" do
setup do
@path = File.join(Dir.pwd, '_config.yml')
end
should "fire warning with no _config.yml" do
mock(YAML).safe_load_file(@path) { raise SystemCallError, "No such file or directory - #{@pat... | 35.344828 | 106 | 0.668293 |
62edfd63d62369504a26c55aad0e3060652f56c4 | 120 | require 'test_helper'
class MeganeTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15 | 42 | 0.7 |
ab0870742a148d3edcc4a37caaf06a580f5b795e | 863 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'The photographer field of the item display view', :clean, type: :system do
before do
solr = Blacklight.default_index.connection
solr.add(work_attributes)
solr.commit
end
let(:ark) { 'ark:/123/photographer_display' }
let(:solr_id)... | 26.96875 | 110 | 0.674392 |
79d59aa4549960b433270e68349f27081e3664ba | 139 | require 'test_helper'
describe NewsController, :locale do
it "gets index" do
get news_path
must_respond_with :success
end
end
| 15.444444 | 35 | 0.741007 |
21fc983fb1b0f1f51fa33736d3dcc2f7fb867082 | 1,893 | class Crc32c < Formula
desc "Implementation of CRC32C with CPU-specific acceleration"
homepage "https://github.com/google/crc32c"
url "https://github.com/google/crc32c/archive/1.1.1.tar.gz"
sha256 "a6533f45b1670b5d59b38a514d82b09c6fb70cc1050467220216335e873074e8"
license "BSD-3-Clause"
head "https://github.... | 37.117647 | 106 | 0.665082 |
e251b445223f24216fc10d2ad33ed56009a791b7 | 324 | # frozen_string_literal: true
FactoryBot.define do
factory :conviction_reason_form do
revoked_reason { "foo" }
initialize_with do
new(create(:renewing_registration,
:requires_conviction_check,
workflow_state: "renewal_received_pending_conviction_form"))
end
end
... | 23.142857 | 77 | 0.697531 |
39828967433014acf262e056e9adbd35349c26a4 | 1,113 | require_relative "../test_helper"
describe Yahoofx::Converter do
before do
mock_eur_dkk_bid = MiniTest::Mock.new
mock_eur_dkk_bid.expect(:bid, 7.4556)
mock_rate_pair_class = MiniTest::Mock.new
mock_rate_pair_class.expect(:new, mock_eur_dkk_bid, ['EUR', 'DKK'])
@converter = Yahoofx::Converter.new(... | 32.735294 | 81 | 0.709793 |
1dd472ed17a731ea997ed591ad82ea3b1b9f1d5b | 1,006 | class Mustang < Formula
# cite Konagurthu_2006: "https://doi.org/10.1002/prot.20921"
desc "Multiple structural alignment algorithm"
homepage "https://lcb.infotech.monash.edu/mustang/"
url "https://lcb.infotech.monash.edu/mustang/mustang_v3.2.3.tgz"
sha256 "f1c8d64acc04c70e30b3128c370e485438eb38db96b1b3180d31e... | 34.689655 | 121 | 0.751491 |
abcfb3d501a8b1a6b862d327e455e65999046674 | 406 | # frozen_string_literal: true
require 'yaml'
require 'json'
require 'pathname'
require 'rspec'
require 'rspec_file_fixtures/version'
require 'rspec_file_fixtures/fixture'
# Provides a `fixture` method in all RSpec tests.
module RSpecFileFixtures
class Error < StandardError; end
def fixture(path)
Fixture.new... | 17.652174 | 49 | 0.775862 |
7a1462ae981339735621e6cddb4f92f91ccbcadf | 6,476 | require 'test/unit'
require 'external/test_support'
IWATestSupport.set_src_dir
require 'iowa/caches/DiskCache'
require 'iowa/caches/DiskStore'
require 'tmpdir'
require 'fileutils'
require 'benchmark'
require 'pstore'
TMPDIR = Dir::tmpdir
class TC_DiskCache < Test::Unit::TestCase
def make_tmpdir_path; FileUtils.mkdir... | 29.570776 | 132 | 0.647159 |
39b0e5d9032b0ddeffa6e01ea22585aa8e55d203 | 1,350 | cask 'netbeans' do
version '8.2'
sha256 'ddcf37e91d960cca6b6a37c95eabf2c6f15330ed708bfd79be796de00da20e5e'
url "http://download.netbeans.org/netbeans/#{version}/final/bundles/netbeans-#{version}-macosx.dmg"
name 'NetBeans IDE'
homepage 'https://netbeans.org/'
pkg "NetBeans #{version}.pkg"
# Theoretical... | 39.705882 | 101 | 0.744444 |
39a44075f2876fd5d72502d8f4d3ab202d52d4af | 188 | class StoreController < ApplicationController
include Current_Cart
skip_before_action :authorize
before_action :set_cart
def index
@products = Product.order(:title)
end
end
| 18.8 | 45 | 0.781915 |
1c839cc1ffb6e14fae9f955575cbe95debdc96a0 | 892 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint fair.podspec' to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'fair'
s.version = '0.0.1'
s.summary = 'A new Flutter plugin.'
s.description = <<-DESC
A new ... | 37.166667 | 104 | 0.587444 |
03fc20a52207ae1208a424fc9224f7e790d02467 | 1,558 | RSpec.describe SiteguardLite::CustomSignature::TextDumper do
describe '.dump' do
context 'have a exclusion_action' do
let(:rule_hash) {
{
name: 'name',
comment: 'comment',
exclusion_action: 'EXCLUDE_OFFICIAL',
signature: '^.+$',
}
}
let(:ru... | 27.333333 | 75 | 0.57638 |
e93ff9cdd44ab64a8a0ffa57869d741918555424 | 3,045 | # Copyright 2012 The ham21/radio Authors
#
# 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 ... | 32.052632 | 89 | 0.6 |
03ddc3456c334815eccf122430fe37e2b0e4809d | 5,332 | #
# Be sure to run `pod spec lint LiveneoGaoDeSDK.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://gi... | 38.359712 | 171 | 0.597149 |
d53cbf07c7a1cf177c968de6f7396b5db1a87509 | 1,589 | #
# Cookbook Name:: apache2
# Recipe:: fastcgi
#
# Copyright 2008-2013, 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 may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | 29.981132 | 75 | 0.702329 |
ff4b913b1f7cac309b15ced05ec6ce2f68788192 | 2,739 | #!/usr/bin/env ruby
# -*- encoding: us-ascii -*-
# TODO Extract multiple files
# TODO Extract multiple shards
desc "decode FILE [TO]", "Uncompress a frozen Honeywell file"
option 'asis', :aliases=>'-a', :type=>'boolean', :desc=>"Do not attempt to unpack file first"
option "delete", :aliases=>'-d', :type=>'boolean'... | 51.679245 | 154 | 0.673604 |
f8ec97fbbbbf15fcf209673644b3ebd2ed69dcd0 | 3,922 | require File.expand_path("../../helpers", __FILE__)
class ParserProperties < Test::Unit::TestCase
modes = ['p', 'P']
example_props = [
'Alnum',
'Any',
'Age=1.1',
'Dash',
'di',
'Default_Ignorable_Code_Point',
'Math',
'Noncharacter-Code_Point', # test dash
'sd',
'Soft Dotted',... | 29.051852 | 80 | 0.666242 |
0190ad81c34b841ce15437dbef249ea696b50797 | 911 | # Copyright 2011-2019, The Trustees of Indiana University and Northwestern
# University. 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
#
# ... | 35.038462 | 119 | 0.742042 |
ac2d360be27667234f496637cc30214fd636871a | 4,871 | require File.dirname(__FILE__) + '/../../spec_helper.rb'
require 'spec/expectations/differs/default'
describe "should ==" do
it "should delegate message to target" do
subject = "apple"
subject.should_receive(:==).with("apple").and_return(true)
subject.should == "apple"
end
it "should return tr... | 25.369792 | 130 | 0.63334 |
21b9504996abce15c2dbe68374d6ef42c81c6af4 | 5,326 | #!/opt/puppetlabs/puppet/bin/ruby
require 'json'
require 'puppet'
require 'openssl'
def delete_extensions_v1beta1_collection_pod_security_policy(*args)
header_params = {}
params=args[0][1..-1].split(',')
arg_hash={}
params.each { |param|
mapValues= param.split(':',2)
if mapValues[1].include?(';')
... | 31.329412 | 135 | 0.656027 |
eda6c2fb38b8386d8771e898aeaf072841a2f66d | 692 | require File.dirname(__FILE__) + '/../../test/test_helper'
class FleximageOperatorAutoOrientTest < Test::Unit::TestCase
def setup
@photo = PhotoBare.create(:image_file => files(:auto_orient_photo))
end
def test_should_auto_orient
# image is stored as landscape orientation
assert_equal 672, @photo... | 31.454545 | 83 | 0.726879 |
d591e3e0a91404dba3eec66002c5cd05c79f1b80 | 2,824 | # 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 source for your
# dat... | 37.157895 | 126 | 0.719193 |
e976fe5d33a8c2f37a10279f4cf285e0cde863d0 | 5,672 | class Member < ActiveRecord::Base
acts_as_taggable
acts_as_reader
has_many :orders
has_many :accounts
has_many :payment_addresses, through: :accounts
has_many :withdraws
has_many :fund_sources
has_many :deposits
has_many :api_tokens
has_many :tickets, foreign_key: 'author_id'
has_many :comments, ... | 24.239316 | 132 | 0.65885 |
1a631558d0734bb845f1a85cc75fef436b65a4c5 | 3,540 | require 'albacore'
require 'version_bumper'
require './packages/packaging'
task :default => [:build]
desc "Build the project as debug"
task :build => 'build:debug'
directory 'dist'
namespace :build do
desc "create solutioninfo.cs file"
assemblyinfo :solutioninfo do |asm|
asm.version = bumper_version.to_s... | 40.689655 | 252 | 0.657345 |
ffacd05338df9ecf6341fe8cfc3c91641218b3d0 | 3,766 | require 'rails_helper'
RSpec.describe 'Articles', type: :feature do
context 'Creation' do
before(:each) do
@article = {
title: 'test',
category: 'test2',
author: 'Megaman',
text: '# Testing'
}
@article2 = {
title: 'test2',
category: 'test3',
... | 25.794521 | 75 | 0.598513 |
627859f8b7b73b95f8d18d8302e64e732d649210 | 854 |
class ExecutionJournal < ActiveRecord::Base
unloadable
belongs_to :test_case
belongs_to :version
belongs_to :result, :class_name => 'ExecutionResult'
belongs_to :executor, :class_name => 'User'
belongs_to :environment, :class_name => 'ExecutionEnvironment'
# attr_protected :id
# TODO: Move to view f.ex. usin... | 24.4 | 63 | 0.677986 |
61455c3358ad49e42c1c5012b4ead7186ad96837 | 2,390 | class TowersOfHanoiGame
def self.disks
# can always make the game harder by changing max value :-)
(1..3).to_a.reverse
end
def self.default_stacks
[TowersOfHanoiGame.disks, [], []]
end
def initialize(stacks = TowersOfHanoiGame.default_stacks)
@stacks = stacks
end
def render
max_heig... | 24.141414 | 70 | 0.634728 |
61e66eec08b2b23e3b19d930001a63f1a087ecc5 | 2,911 | require 'spec_helper'
describe "Admin::Projects" do
before do
@project = Factory :project,
name: "LeGiT",
code: "LGT"
login_as :admin
end
describe "GET /admin/projects" do
before do
visit admin_projects_path
end
it "should be ok" do
current_path.should == admin_proje... | 24.462185 | 80 | 0.648918 |
ab24235df6c845736a5c2ddacf463ba562f7c702 | 1,466 | #
# Be sure to run `pod lib lint MXCardsSwipingView.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 http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'M... | 47.290323 | 112 | 0.686903 |
d5574a8b3232d0aa7ef94fb128d09e67dbc8cf4e | 3,049 | # frozen_string_literal: true
class Users::RegistrationsController < Devise::RegistrationsController
# before_action :configure_sign_up_params, only: [ :create ]
before_action :configure_account_update_params, only: [ :update ]
before_action :set_filters_open, only: :index
def index
params[:page] ||= 1
... | 24.991803 | 183 | 0.681207 |
e9ac5b4be564a9b03106fde80f862853dd61cfb9 | 143 | class AddEntriesCountToPacks < ActiveRecord::Migration[6.0]
def change
add_column :packs, :entries_count, :integer, default: 0
end
end
| 23.833333 | 59 | 0.755245 |
d5225893060735fc79604e6e285b952afe3aae3c | 1,182 | # This file is copied to spec/ when you run 'rails generate rspec:install'
require "spec_helper"
ENV["RAILS_ENV"] ||= "test"
require File.expand_path("../config/environment", __dir__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.en... | 26.266667 | 86 | 0.763959 |
ac3f895a0a28f816f33919750f11bc925f682d41 | 920 | module Rapns
module Daemon
class DeliveryHandler
include Reflectable
attr_accessor :queue
def start
@thread = Thread.new do
loop do
handle_next_notification
break if @stop
end
end
end
def stop
@stop = true
... | 18.039216 | 56 | 0.53587 |
87f458773045b51a87af8d517c8512381d5c2891 | 159 | Rails.application.config.middleware.use OmniAuth::Builder do
provider :github, ENV['GITHUB_CLIENT_ID'], ENV['GITHUB_CLIENT_SECRET'], scope: 'user:email'
end
| 39.75 | 93 | 0.786164 |
e80331a3fce428cdd83b5c17ca8e39f677811352 | 6,188 | require 'date'
require 'spec_helper'
require 'bibliografia'
describe Bibliografia do
before :each do
serie = "Serie1"
autores = Array.new
autores = %w{ Autor1 Autor2 }
isbn = { "isbn-1" => " 193778", "isbn-12" => " 978-19377" }
@libro = Bibliografia::Libro.new(autores, "Tit... | 44.84058 | 160 | 0.557046 |
e921e58a3688831bd0deaffe8e79343da579fc5f | 542 | require 'spec_helper'
module BugReport600
describe "stubbing a class method" do
class ExampleClass
def self.method_that_uses_define_method
define_method "defined_method" do |attributes|
load_address(address, attributes)
end
end
end
it "works" do
ExampleClass.... | 23.565217 | 72 | 0.715867 |
031ff14d616f6300ce04ec7ecf93c7c59e558754 | 93 | module Ordering
class FakeNumberGenerator
def call
"2019/01/60"
end
end
end | 13.285714 | 27 | 0.666667 |
edd3d40ea57b4269785982bfba5a5e6b18f07fcb | 10,074 | # ------------------------------------------------------------------------------------
# <copyright company="Aspose" file="document.rb">
# Copyright (c) 2020 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associ... | 34.149153 | 247 | 0.62696 |
216bc0cc955779c6b97b89119ef5ff0e407935f4 | 997 | # typed: true
require 'datadog/core/utils/only_once'
require 'datadog/tracing/contrib/httpclient/instrumentation'
require 'datadog/tracing/contrib/patcher'
module Datadog
module Tracing
module Contrib
# Datadog Httpclient integration.
module Httpclient
# Patcher enables patching of 'httpclien... | 23.738095 | 84 | 0.588766 |
031a6e75103194f288e1a9520bd88893a683ed73 | 17,078 | module Sass::Script::Value
# A SassScript object representing a number.
# SassScript numbers can have decimal values,
# and can also have units.
# For example, `12`, `1px`, and `10.45em`
# are all valid values.
#
# Numbers can also have more complex units, such as `1px*em/in`.
# These cannot be inputted... | 32.161959 | 97 | 0.623492 |
abb08a3ae7f208e143cd1158198ffb4fdb12d293 | 372 | require "bundler/setup"
require "protest_articles"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_... | 24.8 | 66 | 0.758065 |
abb22d30885dbc5e637c6a0f8cb05dbc8d818067 | 1,005 | # coding: utf-8
Gem::Specification.new do |spec|
spec.name = 'agency-jekyll-theme'
spec.version = '1.0.0'
spec.authors = ["Klaudia Alvarez"]
spec.email = 'klaudia.devel@gmail.com'
spec.summary = "Agency Jekyll Theme is a jekyll theme gem, based on Agency theme created by St... | 52.894737 | 230 | 0.689552 |
91d4182f7d3a74203f9f8e4e9e3b7ad6c9ba55ec | 879 | # Pull down EPEL repo
remote_file "/tmp/epel-release-latest-7.noarch.rpm" do
source "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
owner 'root'
group 'root'
mode 0755
end
# Install epel-release package
package 'epel-release' do
source "/tmp/epel-release-latest-7.noarch.rpm... | 23.131579 | 83 | 0.724687 |
79c7efbb18eecb8c80f443809d0a222873a18950 | 223 | service 'explicit_action' do
action :start
end
service 'with_attributes' do
pattern 'pattern'
action :start
end
service 'specifying the identity attribute' do
service_name 'identity_attribute'
action :start
end
| 15.928571 | 46 | 0.775785 |
87094531df386a633964f740679632e42c19c228 | 765 | require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
require "capybara/rails"
require 'fuubar'
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.... | 30.6 | 86 | 0.756863 |
4a12baf19d9320d759a9bcea82fe9ca8ae387101 | 5,112 | FactoryBot.define do
factory :school_profile, class: 'Schools::SchoolProfile' do
before(:create) do |sp|
sp.bookings_school = Bookings::School.find_by(urn: 123456) || create(:bookings_school, urn: 123456)
end
trait :with_dbs_requirement do
after :build do |profile|
profile.dbs_require... | 27.934426 | 105 | 0.689554 |
bbffda50e4bc08f5832e095c987e1635cc112377 | 1,345 | module Network
class Config
attr_reader :cells
COUNTRY_REGEX = /country=(?<country>[A-Z]{2})/
UPDATE_CONFIG_REGEX = /update_config=(?<update_config>[0-1])/
NETWORK_REGEX = /(?<network>network\s*=\s*{(?:\s*[^}]*){2}})/x
def initialize
file_output = `cat /etc/wpa_supplicant/wpa_supplicant.co... | 24.907407 | 75 | 0.613383 |
87189b736a1722d35926b034ede6488d198164ac | 3,370 | #
# Copyright (c) 2021 Michael Morris. All Rights Reserved.
#
# Licensed under the MIT license (the "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at
#
# https://github.com/mmmorris1975/aws-runas/blob/master/LICENSE
#
# or in the "license" file accompanyi... | 32.403846 | 102 | 0.630861 |
7a7c0db5e8a28aaa274e173b4f69f87a42ff2059 | 2,452 | module Jets::Resource::ApiGateway
class Authorizer < Jets::Resource::Base
def initialize(props={})
@props = props # associated_properties from dsl.rb
end
def definition
{
authorizer_logical_id => {
type: "AWS::ApiGateway::Authorizer",
properties: props,
}
... | 29.542169 | 99 | 0.593393 |
28c422921acc83546cf309dd262d844fa5485bc6 | 502 | require File.expand_path('boot', __dir__)
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 TestApp
class Application < Rails::Application
# Settings in config/environments/* take precedenc... | 31.375 | 82 | 0.760956 |
e8f9f09e2e2660ad1728392a794bc63fb274fb5f | 113 | json.extract! contact, :id, :email, :phone, :created_at, :updated_at
json.url contact_url(contact, format: :json) | 56.5 | 68 | 0.752212 |
bf77eafa626a1aaf092411f30ff221b76d6d8500 | 1,007 | require "story_teller"
require "story_teller/sidekiq"
describe StoryTeller::Sidekiq do
around(:each) do |example|
StoryTeller.clear!
example.run
StoryTeller.clear!
end
context "clearing the books" do
it "clears the books before the middleware exits" do
middleware = StoryTeller::Sidekiq.new... | 27.216216 | 73 | 0.650447 |
1c59c5e2a72fb7d7bd0899c3dc14239e8898c7f6 | 683 | Rails.application.routes.draw do
# Pages controller Route
root 'pages#index'
# Sessions controller routes
get '/signin', to: 'sessions#new'
post '/signin', to: 'sessions#create'
delete '/signout', to: 'sessions#destroy'
# User controller routes
get '/signup', to: 'users#new'
post '/users', to: 'user... | 27.32 | 64 | 0.674963 |
acc3b679cff44c4e88252a6806b5e50028427cb9 | 124 | module SendgridThreads
class Exception < StandardError
def initialize(message)
super(message)
end
end
end
| 15.5 | 33 | 0.717742 |
ab002a840e5499006aeff47a8b1801cf5de87b35 | 322 | require File.dirname(__FILE__) + "/test_helper"
class MoneyTest < Test::Unit::TestCase
should "parse '-14.24 EUR' as 14.24 EUR" do
assert_equal Money.new(-1424, "EUR"), "-14.24 EUR".to_money
end
should "parse '14.24 CAD' as 14.24 CAD" do
assert_equal Money.new(1424, "CAD"), "14.24 CAD".to_money
end
en... | 26.833333 | 63 | 0.677019 |
1c1d0aee176ae5d3c1a29d0544bf309880d5edee | 1,821 | require 'spec_helper'
describe SlimLint::Runner do
let(:options) { {} }
let(:runner) { described_class.new }
before do
runner.stub(:extract_applicable_files).and_return(files)
end
describe '#run' do
let(:files) { %w[file1.slim file2.slim] }
let(:mock_linter) { double('linter', lints: [], name:... | 28.015385 | 81 | 0.587589 |
4a1fe95e0fd22a0b9a61105d6d2803e926e515a5 | 5,950 | Hadean::Application.configure do
# Rails 4
config.eager_load = true
config.assets.js_compressor = :uglifier
# Settings specified here will take precedence over those in config/environment.rb
config.force_ssl = true
# The production environment is meant for finished, "live" apps.
# Code is not reloaded ... | 39.403974 | 109 | 0.568571 |
628b4293f36417597a018d964e310733ceb0e400 | 159 | module AdaptivePayments
class FundingTypeList < JsonModel
attribute :funding_type_info, NodeList[FundingTypeInfo], :param => "fundingTypeInfo"
end
end
| 26.5 | 88 | 0.792453 |
1c7b9be7a8a57b893a17752a4512751c86ff4976 | 1,325 | ##
# @api REST
# Describes an SSH Key associated with a user
# @see RestUser
#
# Example:
# ```
# <key>
# <name>default</name>
# <content>AAAAB3Nz...SeRRcMw==</content>
# <type>ssh-rsa</type>
# <links>
# ...
# </links>
# </key>
# ```
#
# @!attribute [r] name
# @return [String] Name of ... | 28.191489 | 109 | 0.602264 |
031cd25a10d1856bd97be096321aa1959bc1ad6d | 4,713 | # frozen_string_literal: true
RSpec.describe SqlAttributes do
let!(:invoice) { Invoice.create!(number: '2020-0042', reference: 'My cool new course') }
let!(:invoice_lines) do
[
invoice.invoice_lines.create!(name: 'Introduction', units: 1, unit_price: 52.25),
invoice.invoice_lines.create!(name: 'Boo... | 42.080357 | 119 | 0.728835 |
33eb1235fcaf6952221c66cb37739f536c48cbf2 | 1,214 | require_relative "lib/ahoy/version"
Gem::Specification.new do |spec|
spec.name = "ahoy_matey"
spec.version = Ahoy::VERSION
spec.summary = "Simple, powerful, first-party analytics for Rails"
spec.homepage = "https://github.com/ankane/ahoy"
spec.license = "MIT"
spec.author ... | 34.685714 | 74 | 0.714168 |
085ab1e21a08c49798fdf707e7b497a6b3ed4457 | 55,776 | # 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,... | 44.443028 | 139 | 0.637945 |
39ebd49dc52db28ccf9922abba79cc16976e1d76 | 1,379 | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# require "rails/test_u... | 39.4 | 99 | 0.751269 |
1178615f3f54c574d39682db9aab6bd4bbe5800d | 119 | class AddAvatarColumnsToUsers < ActiveRecord::Migration[5.2]
def change
add_attachment :users, :avatar
end
end
| 19.833333 | 60 | 0.764706 |
b922b66e95008ab354c06a596b03a204d3c11218 | 411 | cask 'vuescan' do
version '9.5.64'
sha256 :no_check # required as upstream package is updated in-place
url "https://www.hamrick.com/files/vuex64#{version.major_minor.no_dots}.dmg"
appcast 'https://www.hamrick.com/old-versions.html',
checkpoint: 'd6e88549f481993c8bfe21a551c5a19e7d6fe83a7a0b5010ee5b3ff... | 31.615385 | 88 | 0.744526 |
91f5c68304d6c23a92e6544bf9a1ccb295aad932 | 167 | class NewsItem < ApplicationRecord
validates :body, presence: true, allow_blank: false
validates :title, presence: true, allow_blank: false
belongs_to :user
end
| 27.833333 | 54 | 0.778443 |
f879406ad2e646b730abcbaf2361cb07f06e044b | 26,677 | # encoding: utf-8
require 'base64'
# The module name doesn't matter, just make sure at the end to 'extend' it
# because it will be 'eval'ed by the initialize method of the XhtmlReportGenerator::Generator class.
module Custom
# creates the basic page layout and sets the current Element to the main content area (midd... | 44.240464 | 187 | 0.647337 |
6a7b8cce3758308e10cfacb8efe07ed1a63f9feb | 3,253 | class User < ApplicationRecord
has_many :microposts, dependent: :destroy
has_many :active_relationships, class_name: "Relationship",
foreign_key: "follower_id",
dependent: :destroy
has_many :passive_relationships, class_name: "Relationship",
foreign_ke... | 29.844037 | 89 | 0.702429 |
339b14a8aaf0500f87a18351c7d2a0cd462c052f | 3,479 | require 'spec_helper'
RSpec.describe SearchResultPresenter do
subject(:presenter) { SearchResultPresenter.new(document) }
let(:document) {
double(
Document,
title: title,
path: link,
metadata: metadata,
summary: 'I am a document',
is_historic: false,
government_name: ... | 29.235294 | 109 | 0.620293 |
f8a473475a13b5e7b6332f5393aaa4dab2cfe47b | 908 | class Fonttools < Formula
include Language::Python::Virtualenv
desc "Library for manipulating fonts"
homepage "https://github.com/fonttools/fonttools"
url "https://github.com/fonttools/fonttools/releases/download/4.2.3/fonttools-4.2.3.zip"
sha256 "da069660a5074a538729aa908b25ceab5fb8bd39e0bf6c0c21b5e6405672c... | 32.428571 | 93 | 0.790749 |
ff5ea98a0630cae27170af7e64ab52209c6180a1 | 713 | module ClearData
def self.clear_datasets
StashEngine::Identifier.all.each do |iden|
puts "Destroying #{iden.identifier}"
iden.destroy
end
clear_solr
end
def self.clear_solr
clear_solr_url = "#{Blacklight.connection_config[:url]}/update?stream.body" +
'=<delete><query>*:*</que... | 28.52 | 104 | 0.69425 |
ed42e91ff9a9f709eedac142b5ee725f828e32bc | 9,276 | # 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... | 40.330435 | 245 | 0.673458 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.