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 |
|---|---|---|---|---|---|
39ff9326503a254d7d879c7e3c379e6960aec06e | 4,081 | require_relative '../spec_helper'
module PacketGen
module Header
describe MDNS do
let(:mdns_raw_packets) { read_raw_packets('mdns.pcapng') }
describe 'binding' do
it 'in UDP packets' do
expect(UDP).to know_header(MDNS).with(sport: 5353)
expect(UDP).to know_header(MDNS).wi... | 36.765766 | 158 | 0.54619 |
ac13f3bcdd61085d3fe7455f23d3300da33fe18e | 1,278 | # Validate that a grid reference can be processed.
module FloodRiskEngine
class GridReferenceValidator < ActiveModel::EachValidator
require "os_map_ref"
attr_reader :message, :allow_blank, :value
def initialize(options)
@message = options[:message]
@allow_blank = options[:allow_blank]
s... | 23.666667 | 77 | 0.668232 |
1aaa6c34e8b3a17f45fb18b0edaef51f48d56ddb | 3,683 | # frozen_string_literal: true
module Helpers
def default_test_author
@default_test_author ||= User.find_by_email(default_test_user_details[:email])
@default_test_author = create(:user, default_test_user_details) if @default_test_author.nil?
@default_test_author
end
def test_ip_address
'127.0.0.1... | 24.553333 | 96 | 0.632908 |
2131243f94bd29dd7071e114b569ddc76af7c0a8 | 513 | # 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::Storage::Mgmt::V2018_11_01
module Models
#
# Defines values for SkuName
#
module SkuName
StandardLRS = "Standard_LRS"
... | 24.428571 | 70 | 0.688109 |
e2c065dba9df883263d3e49cc8f9cb2e906bc5db | 888 | Gem::Specification.new do |s|
s.name = "gtm"
s.version = "0.0.1"
s.default_executable = "gtm"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Luis Ibanez"]
s.date = %q{2013-03-02}
s.description = %q{Driver for ... | 31.714286 | 121 | 0.646396 |
61d28ec0799b91b29c8e761ec82e568d907d5ad8 | 882 | #Solution Below
first_name = "Todd"
last_name = "Seller"
age = 45
# RSpec Tests. They are included in this file because the local variables you are creating are not accessible across files. If we try to run these files as a separate file per normal operation, the local variable checks will return nil.
describe 'firs... | 23.837838 | 236 | 0.716553 |
f86dc53ceabe1aeebc91c7776856db6796e19899 | 154 | class CreateVotes < ActiveRecord::Migration
def change
create_table :votes do |t|
t.integer :value
t.belongs_to :post
end
end
end
| 17.111111 | 43 | 0.668831 |
e880995232bbec4036fd6e99bf0afec1bcb89aac | 61,454 | # frozen_string_literal: true
require "date"
require "action_view/helpers/tag_helper"
require "active_support/core_ext/array/extract_options"
require "active_support/core_ext/date/conversions"
require "active_support/core_ext/hash/slice"
require "active_support/core_ext/object/acts_like"
require "active_support/core_e... | 51.211667 | 175 | 0.605412 |
08dde6967bd7c53c57568ccbe2719f719f24561c | 1,292 | module Cryptoexchange::Exchanges
module Bancor
module Services
class Market < Cryptoexchange::Services::Market
class << self
def supports_individual_ticker_query?
true
end
end
def fetch(market_pair)
output = super(ticker_url(market_pair))
... | 34.918919 | 142 | 0.609133 |
b9c570cc6c6329703b7b828b9a96e5c9e1178668 | 257 | # This file has the same name as the spree 3.0 migration to prevent it from
# being run twice for those users.
class RenameIdentifierToNumberForPayment < ActiveRecord::Migration
def change
rename_column :spree_payments, :identifier, :number
end
end
| 32.125 | 75 | 0.785992 |
f8d961d1592e83574236680f2af8edc078205895 | 1,346 | # Encoding: utf-8
#
# This is auto-generated code, changes will be overwritten.
#
# Copyright:: Copyright 2015, Google Inc. All Rights Reserved.
# License:: Licensed under the Apache License, Version 2.0.
#
# Code generated by AdsCommon library 0.11.0 on 2015-10-08 10:50:36.
require 'ads_common/savon_service'
require ... | 24.472727 | 69 | 0.696137 |
f73083dc43cc949560311353295b65836978f4d8 | 2,114 | require 'rails_helper'
RSpec.describe UnfriendsBuilder do
describe '#unfriends' do
end
describe '#unfollowers' do
end
end
RSpec.describe UnfriendsBuilder::Util do
let(:older) { TwitterUser.new }
let(:newer) { TwitterUser.new }
before do
allow(older).to receive(:friend_uids).with(no_args).and_ret... | 28.567568 | 123 | 0.652318 |
bb809ba841e7e0b2f4a5248c2d6dbb02b48d6f68 | 3,159 | require 'spec_helper'
#from spec/support/surveyforms_helpers.rb
include SurveyFormsCreationHelpers::CreateSurvey
include SurveyFormsCreationHelpers::BuildASurvey
feature "User creates a dependency using browser", %q{
As a user
I want to create logic on questions
So that I can display one question depending on th... | 45.782609 | 131 | 0.709402 |
4a5f9130a0dab795a4d5200e0801e653952ba119 | 1,339 | # -*- coding:utf-8; mode:ruby; -*-
require 'rbindkeys'
require 'revdev'
include Rbindkeys
describe DeviceOperator do
before do
@dev = double Device
@vdev = double VirtualDevice
@operator = DeviceOperator.new @dev, @vdev
end
describe "#send_key" do
context "with a code and a press value" do
... | 23.086207 | 85 | 0.585512 |
ab56453245ec1ecc5964485a1249745751e06b2a | 111 | require "minitest/autorun"
require_relative "../lib/mccandlish"
require 'webmock/minitest'
include Mccandlish
| 18.5 | 36 | 0.810811 |
285861e69b67cbf031a40a71407526348d2c6076 | 146 | # frozen_string_literal: true
class UserSerializer
include FastJsonapi::ObjectSerializer
attributes :id, :email, :first_name, :last_name
end
| 20.857143 | 49 | 0.80137 |
266e6a4ba33125b6ec2993d0df5e69f994c20b0b | 6,628 | module Enumerable
# ############################################################################
# *************************** my_each ********************************
# ############################################################################
def my_each
return to_enum(:my_each) unless block_... | 26.618474 | 101 | 0.33268 |
f8a251dd1e477d775981b797d26e64c6ec20a9e6 | 3,882 | class VolunteersController < ApplicationController
skip_before_action :authenticate_user!, only: [:new, :thank_you]
before_action :set_volunteer, only: [:show, :edit, :update, :destroy]
# GET /volunteers
# GET /volunteers.json
def index
@volunteers = Volunteer.all
end
def index_for_selections
@v... | 32.082645 | 243 | 0.586038 |
265e441df692450042e1801d4cfcfbd3c2bcca1b | 272 | class CreateFeedbacks < ActiveRecord::Migration
def self.up
create_table :feedbacks do |t|
t.references :user
t.string :email
t.string :title
t.text :body
t.timestamps
end
end
def self.down
drop_table :feedbacks
end
end
| 16 | 47 | 0.643382 |
e268577ec2d4c3071e4c282d7fbc3e366eb926c8 | 1,484 | class Redstore < Formula
desc "Lightweight RDF triplestore powered by Redland"
homepage "https://www.aelius.com/njh/redstore/"
url "https://www.aelius.com/njh/redstore/redstore-0.5.4.tar.gz"
sha256 "58bd65fda388ab401e6adc3672d7a9c511e439d94774fcc5a1ef6db79c748141"
license "GPL-3.0"
livecheck do
url :ho... | 44.969697 | 106 | 0.752022 |
e91ca35e2fc8c7fc361161bebfa395b16f497a18 | 3,042 | Shindo.tests('Fog::Rackspace::Monitoring | agent_tests', ['rackspace','rackspace_monitoring']) do
account = Fog::Rackspace::Monitoring.new
agent_token = nil
options = { "label" => "Bar" }
values_format = Hash
tests('success') do
tests('#create new agent token').formats(DATA_FORMAT) do
response = a... | 40.56 | 125 | 0.704799 |
79b431f66b63d43c93235fbc244a83e0b71b1ddd | 69,009 | # balsamiq-symbol-dump.rb
# File auto generated by irb on Thu Dec 25 22:00:36 -0800 2008
# Used by rspec stories in parse_controls_spec.rb
# Control XML
BalsamiqTestXMLAccordion = %Q{
<control zOrder="0" w="-1" x="128" controlID="0" y="390" isInGroup="-1" controlTypeID="com.balsamiq.mockups::Accordion" h="-1" locked=... | 22.603669 | 365 | 0.616499 |
08e4bc5ca5b8bd266aa486d45729c34e03204467 | 1,523 | require 'rubygems'
require 'test/unit'
require 'mocha'
require 'active_support'
require 'active_record'
require 'active_record/fixtures'
require File.join(File.dirname(__FILE__), '..', 'init')
begin
# pulls from one of test/connections/#{adapter}/connection.rb depending on how rake setup our lib paths
require '... | 31.729167 | 105 | 0.730794 |
6175bbfbd9016342c00011ec92d6975b44bad36a | 2,609 | module GraphQL
module StaticValidation
class DirectivesAreInValidLocations
include GraphQL::StaticValidation::Message::MessageHelper
include GraphQL::Language
def validate(context)
directives = context.schema.directives
context.visitor[Nodes::Directive] << ->(node, parent) {
... | 43.483333 | 182 | 0.675738 |
018d21b690e0f581ea46d7148317c87b585cdfed | 5,002 | require 'rails_helper'
# TODO: Combine this with the involved_civilian_spec, it's really identical.
describe '[Involved Officer Page]', type: :request do
before :each do
login
end
describe '[incident with one officer]' do
before :each do
create(:incident, stop_step: :officers)
visit incident... | 42.389831 | 82 | 0.708916 |
f79dd4186b4727370d3b421e5e6fba037e5d0782 | 796 | require 'chefspec/matchers/shared'
module ChefSpec
module Matchers
define_resource_matchers([:start, :stop, :restart, :reload, :nothing, :enable, :disable], [:service], :service_name)
RSpec::Matchers.define :set_service_to_start_on_boot do |service|
match do |chef_run|
chef_run.resources.any?... | 30.615385 | 121 | 0.689698 |
394342398135ff00f318458f7a44a5c468238395 | 34,189 | # frozen_string_literal: true
# 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 applicabl... | 52.117378 | 166 | 0.573927 |
381f8acc0a27fe6db2c8769c2e0c036699ac684d | 1,016 | # frozen_string_literal: true
module GraphQL
class Client
module Schema
module BaseType
# Public: Get associated GraphQL::BaseType with for this class.
attr_reader :type
# Internal: Get owner schema Module container.
attr_accessor :schema_module
# Internal: Cast JS... | 25.4 | 85 | 0.601378 |
0138aeecfb6bb3a702af1a53662f1ad6d715a810 | 32 | APPLICATION_NAME = 'M-Explorer'
| 16 | 31 | 0.78125 |
bf0019e07998f939cd68e16c17a05f8f7fd069c1 | 7,438 | module QuotaHelper
def create_category_and_tag(category, tag)
cat = Classification.find_by_name(category)
cat = Classification.create_category!(:name => category,
:single_value => false,
:description => category) unle... | 46.779874 | 116 | 0.518688 |
21ca907296312e16be5276e53e593fb603c8b097 | 939 | Shindo.tests('Fog::Rackspace::Queues | claim', ['rackspace']) do
service = Fog::Rackspace::Queues.new
queue = service.queues.create({
:name => "fog_queue_#{Time.now.to_i.to_s}",
})
queue.messages.create({
:ttl => VALID_TTL,
:body => { :random => :body }
})
params = {
:ttl => VALID_TTL,
... | 22.357143 | 67 | 0.591054 |
6afe98dd4d3039f3e8918eb79fd1a0737717f2d1 | 397 | # frozen_string_literal: true
require "bundler/setup"
require "prependers"
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_pa... | 23.352941 | 66 | 0.758186 |
26c0c06fa1375bc297c396dc3afeaabb12c0e3da | 3,013 | # Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: MIT
# DO NOT MODIFY. THIS CODE IS GENERATED. CHANGES WILL BE OVERWRITTEN.
# vcenter - VMware vCenter Server provides a centralized platform for managing your VMware vSphere environments
require 'spec_helper'
require 'json'
# Un... | 45.651515 | 415 | 0.773316 |
ab26a1a63e2f2af56b58be85c79513fda53bb1fd | 233 | require 'mkmf'
extension_name = 'uel'
dir_config(extension_name)
find_header('ruby.h')
find_header('endian.h')
find_header('stdlib.h')
if have_library('z')
have_header('zlib.h')
end
create_header
create_makefile(extension_name)
| 15.533333 | 31 | 0.772532 |
8737ced397ebc1159e62ccd3a4d2b914d26f49a2 | 2,120 | module RTables
module Table
class UnicodeMonoTableAlt < TableBuilder
CORNER_POS_LTOP = '┌'
CORNER_POS_RTOP = '┐'
CORNER_POS_MTOP = '┬'
CORNER_POS_LMID = '├'
CORNER_POS_RMID = '┤'
CORNER_POS_MMID = '┼'
CORNER_POS_LBOT = '└'
CORNER_POS_RBOT = '┘'
CORNER_POS_MB... | 26.835443 | 110 | 0.558019 |
1cfeb5f34a0ef42c2842ad7896134e000f64f66f | 21,964 | # coding: utf-8
require 'rails_helper'
describe ArticlesController, 'base', type: :controller do
let!(:blog) { create(:blog) }
let!(:user) { create :user }
describe 'tag' do
before(:each) { get :tag }
it { expect(response).to redirect_to(tags_path) }
end
describe 'index' do
let!(:article) { cr... | 34.643533 | 143 | 0.649153 |
335fec3b148e5e28e5058e77645236e7792e220e | 676 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-entity_snapshot-postgres'
s.version = '2.1.1.0'
s.summary = 'Projected entity snapshotting for Postgres'
s.description = ' '
s.authors = ['The Eventide Project']
s.email = 'opensource@eventide-project.org'
s.homepage = 'https://github.... | 29.391304 | 77 | 0.695266 |
18506c943d9f6fd6e85691524c812b0f2fe0ffc9 | 151 | #http://stackoverflow.com/questions/4110866/ruby-on-rails-where-to-define-global-constants
AVAILABLE_TYPES = %w(photo text quote link chat audio video) | 75.5 | 90 | 0.81457 |
4aa7208741783b80605a8dbcd8efc911d51f4e29 | 9,691 | module TestCenter::Helper::MultiScanManager
describe 'TestBatchWorkerPool' do
describe 'serial' do
describe '#wait_for_worker' do
it 'returns an array of 1 TestBatchWorker' do
pool = TestBatchWorkerPool.new(parallel_testrun_count: 1)
pool.setup_workers
worker = pool.wai... | 41.063559 | 124 | 0.618512 |
393c4c64d512e4f71e10e4b67e41c42c1b32ede6 | 766 | # frozen_string_literal: true
require "test_helper"
class NoteTest < ActiveSupport::TestCase
def setup
@admin = build(:user, :admin)
end
def test_valid_note
valid_note = { description: "oliver@example.com",
title: "Oliver Smith",
user: @admin
... | 23.212121 | 75 | 0.58094 |
6a4619674e880dd74bc4327461ef878c909c2895 | 690 | module Xeroizer
module Record
class ExpenseClaimModel < BaseModel
set_permissions :read, :write, :update
end
class ExpenseClaim < Base
set_primary_key :expense_claim_id
list_contains_summary_only true
guid :expense_claim_id
string ... | 22.258065 | 68 | 0.571014 |
620d3c69256ff4e05ac64427a485a38abf606d7f | 423 | # Copyright (c) 2012-present, Facebook, Inc.
name 'fb_ntp'
maintainer 'Facebook'
maintainer_email 'noreply@facebook.com'
source_url 'https://github.com/facebook/chef-cookbooks/'
license 'Apache-2.0'
description 'Installs/Configures NTP'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0... | 28.2 | 72 | 0.780142 |
e2febe5c321ebfad897b6d765ae70e3e315cfcca | 14,505 | # Copyright 2015 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, ... | 33.041002 | 138 | 0.713823 |
6234138c1adbd1b6546d484a884c39340f388a5a | 9,083 | # Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 36.332 | 118 | 0.669272 |
4aba1f147aaaa90b787555956a58f27e1b1a8c83 | 787 | class Mse6AT0210 < Formula
desc "HTTP/1.1 server implementing mock responses for testing of edge cases"
homepage "https://github.com/simonmittag/mse6"
url "https://github.com/simonmittag/mse6/archive/v0.2.10.tar.gz"
sha256 "698e117439289145aab0cf8e046fbc93ae8c8259891a9607cd95d6fb7ecfb838"
depends_on "go" => ... | 32.791667 | 78 | 0.719187 |
e868a564745f4f677ea0e01a4e28a863b48529e2 | 2,262 | ##
# 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::Tcp
def initialize(info = {})
super(update_info(info,
'Name' ... | 23.081633 | 76 | 0.490274 |
282c8c34efeb4931287625f363bb2a0ff9cf429a | 19,121 | #!/usr/bin/ruby
require_relative 'taskpaperexportpluginmanager'
class TaskPaperItem
TYPE_ANY = 0
TYPE_NULL = 1
TYPE_TASK = 2
TYPE_PROJECT = 3
TYPE_NOTE = 4
LINEBREAK_UNIX = "\n" # Unix, Linux, and Mac OS X
LINEBREAK_MAC = "\r" # classic Mac OS 9 and older
LINEBREAK_WINDOWS = "\r\n" # DOS and Windows
@line... | 26.44675 | 172 | 0.638199 |
bf029630549d790e075cf8a3e02c170b853e0361 | 1,274 | class Src < Formula
homepage "http://www.catb.org/~esr/src/"
url "http://www.catb.org/~esr/src/src-0.19.tar.gz"
sha256 "3d9c5c2fe816b3f273aab17520b917a774e90776c766f165efb6ae661378a65c"
head "git://thyrsus.com/repositories/src.git"
bottle do
cellar :any
sha256 "654b13895e6e8e7c1f99a007a17d0c6ab26625... | 32.666667 | 95 | 0.710361 |
e98a246b803effd3da55dc95ef28035a556f411c | 1,597 | class Speech < Announcement
include Edition::Appointment
include Edition::HasDocumentCollections
include Edition::CanApplyToLocalGovernmentThroughRelatedPolicies
include LeadImagePresenterHelper
validates :speech_type_id, presence: true
validates :delivered_on, presence: true, unless: ->(speech) { speech.c... | 21.013158 | 100 | 0.74953 |
1c82eb7adc8987e79e6f08e4e0ee856f771b78be | 8,455 | =begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.5.1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.7
=end
require 'date'
module NSXT
# Backup operation status
class BackupOperationStatus
# Unique identifier of a backup
... | 30.196429 | 252 | 0.627321 |
33719dfb96faa04d1c8e8472b21d59d54dc3c993 | 3,754 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'metasploit/framework/login_scanner/pop3'
require 'metasploit/framework/credential_collection'
class Metasploit3 < Msf::Auxiliary
include Msf::Exploit:... | 31.024793 | 138 | 0.636388 |
7af8dbe1a5bd63e5f7723e4ba16f70a78fc81760 | 7,019 | FactoryGirl.define do
# Project without repository
#
# Project does not have bare repository.
# Use this factory if you don't need repository in tests
factory :empty_project, class: 'Project' do
sequence(:name) { |n| "project#{n}" }
path { name.downcase.gsub(/\s/, '_') }
namespace
creator
... | 32.799065 | 114 | 0.689984 |
1a2c97b10f6ac428a3ca904121cd1dc1eceb8183 | 85 | Dummy::Application.routes.draw do
mount JasperserverRails::Engine => '/jasper'
end
| 21.25 | 46 | 0.764706 |
4a17353e08d4142f5573c190b9609d8c06ce1407 | 832 | # frozen_string_literal: true
require_dependency 'thredded/topic_view'
module Thredded
# A view model for a page of BaseTopicViews.
class TopicsPageView
delegate :to_ary,
:blank?,
:empty?,
to: :@topic_views
delegate :total_pages,
:current_page,
... | 33.28 | 110 | 0.670673 |
01c3a1b2aba967a2e8be02a0dbc73a5c26035b31 | 368 | module CompletedTransactionHelper
def promote_organ_donor_registration?
organ_donor_registration_attributes && organ_donor_registration_attributes['promote_organ_donor_registration']
end
def organ_donor_registration_attributes
@attributes ||= @publication.presentation_toggles && @publication.presentatio... | 36.8 | 118 | 0.847826 |
916da36a944f8d2e2d4b77a17b24f6fe0c510030 | 936 | class OrdersBase
def self.create(days, choices, offices)
raise 'Days cannot be empty' if days.empty?
raise 'Choices cannot be empty' if choices.empty?
raise 'Offices cannot be empty' if offices.empty?
offices << 'total'
new(days, choices, offices)
end
def add(day, choice, office, quantity)
... | 29.25 | 107 | 0.685897 |
f8f5e94fddfbdc6a586a8b01bd3f9dc2445ebf08 | 1,114 | # encoding: utf-8
# frozen_string_literal: true
module RuboCop
module Cop
# Common functionality for checking surrounding space.
module SurroundingSpace
def space_between?(t1, _t2)
# Check if the range between the tokens starts with a space. It can
# contain other characters, e.g. a una... | 26.52381 | 77 | 0.597846 |
33c00e21a7b738ec7dc24a4ce770a2eba0cc4bf3 | 758 | cask "rekordbox" do
version "6.0.3,20200713191837"
sha256 "c7a071e51ba41cb2c512260aedab75d55819c6469723430c1ef4795c7d92f275"
url "https://cdn.rekordbox.com/files/#{version.after_comma}/Install_rekordbox_#{version.before_comma.dots_to_underscores}.pkg_.zip"
appcast "https://rekordbox.com/en/support/releasenote/... | 32.956522 | 133 | 0.748021 |
4a61093b97b8221aa56c44d612a6454c0d90f68f | 848 | module Cartograph
class Artist
attr_reader :object, :map
def initialize(object, map)
@object = object
@map = map
end
def properties
map.properties
end
def draw(scope = nil)
if map.cache
cache_key = map.cache_key.call(object, scope)
map.cache.fetch(cac... | 24.228571 | 99 | 0.634434 |
bbf4a4f6efe6ba5ac92dca8e4697c10dab5edb4a | 3,057 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require 'simplecov'
SimpleCov.start 'rails'
require 'spec_helper'
require File.expand_path('../dummy/config/environment.rb', __FILE__)
require 'rspec/rails'
# Add additional requires below this line. Rails is not loa... | 36.392857 | 80 | 0.738633 |
6af453997182130d78bdb4bd358468f54fa041a3 | 1,729 | require 'test_helper'
module Coinmarketcap
module Api
module Config
class LoggerTest < Minitest::Test
def setup
CoinMarketCap::Api.logger.reset!
end
def test_default_values_are_set
assert_nil CoinMarketCap::Api.logger.instance
assert_equal CoinMarketCa... | 30.333333 | 66 | 0.634471 |
39392d94a67fbc779a7c82880839713a5f66157d | 2,805 | # frozen_string_literal: true
require 'spec_helper'
require 'rspec/webservice_matchers'
describe 'SSL tests' do
before(:each) { WebMock.allow_net_connect! }
after(:each) { WebMock.disable_net_connect! }
describe 'have_a_valid_cert matcher' do
it 'passes when SSL is properly configured' do
# EFF crea... | 31.875 | 108 | 0.682353 |
d5b4c5a872672695853865c0ef88683dec5fd6c5 | 919 | # frozen_string_literal: true
require 'rails/engine'
module Cherrystone
class << self
def configure
yield Engine.config
end
end
class Engine < ::Rails::Engine
config.custom_node_class_lookup = nil
config.default_node_class = 'Cherrystone::Node::Base'
config.enhance_exceptions = true
... | 22.975 | 76 | 0.712731 |
01b86e2e505aa29e891db66160a53ac7684cb8ac | 1,104 | class PreviousGasConsumptionsController < ApplicationController
before_action :set_consumer
before_action :detect_invalid_user
rescue_from ActiveRecord::RecordNotFound, with: :denied_action
load_and_authorize_resource
def index
@previous_gas_consumptions = @consumer.previous_gas_consumption.all.order(date: :d... | 30.666667 | 105 | 0.757246 |
b90f4d362d3d47fa442bcd6375b027f41079d1c6 | 17,541 | Sketchup::require 'geores_src/geores_import/geores_rexml/parseexception.rb'
Sketchup::require 'geores_src/geores_import/geores_rexml/source.rb'
module REXML
module Parsers
# = Using the Pull Parser
# <em>This API is experimental, and subject to change.</em>
# parser = PullParser.new( "<a>text<b att='val... | 37.722581 | 153 | 0.501226 |
39358a6c7fa0625c97623ddd0b66bba8de819f8f | 1,260 | module Axlsx
# a vml drawing used for comments in excel.
class VmlDrawing
# creates a new Vml Drawing object.
# @param [Comments] comments the comments object this drawing is associated with
def initialize(comments)
raise ArgumentError, "you must provide a comments object" unless comments.is_a?(... | 29.302326 | 95 | 0.677778 |
111aa2cab480cd9d749138f2f6d427eb5838cb7e | 2,177 | # frozen_string_literal: true
module Gitlab
module Metrics
module Subscribers
# Class for tracking the total query duration of a transaction.
class ActiveRecord < ActiveSupport::Subscriber
attach_to :active_record
IGNORABLE_SQL = %w{BEGIN COMMIT}.freeze
DB_COUNTERS = %i{db_co... | 31.550725 | 169 | 0.628388 |
87114d44bce57ada540a6698c1f693082f92cd6a | 3,160 | # frozen_string_literal: true
require 'spec_helper'
describe Projects::Serverless::FunctionsController do
include KubernetesHelpers
include ReactiveCachingHelpers
let(:user) { create(:user) }
let(:cluster) { create(:cluster, :project, :provided_by_gcp) }
let(:knative) { create(:clusters_applications_knativ... | 28.990826 | 118 | 0.653481 |
7a43f24813b42705f8eb52c58101dfc2e80d2225 | 2,831 | # 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.108434 | 126 | 0.691275 |
87f78d82ecf534aa71f64989a653e060ac1e2e3a | 759 | class ResultsController < ApplicationController
def index
@results = current_user.results
json_response(@results)
end
def show
@result = Result.find(params[:id])
render json: @result
end
def create
@result = current_user.results.create!(result_params)
json_response(@result, :created... | 16.866667 | 57 | 0.638999 |
d561a25bc3c2b12cc75ebeeabaa505930577373a | 280 | module Spiffy
class SpiffyController < ApplicationController
class << self
def super_spiffy_loaded?
true
end
def common_method
"Super Spiffy"
end
end
def super_spiffy
render :text => "Im super spiffy"
end
end
end | 16.470588 | 48 | 0.614286 |
f8d33f99faba8e9d3f87efe630c3d337b75b675d | 4,720 | require 'abstract_unit'
require "fixtures/person"
require "fixtures/street_address"
class FormatTest < Test::Unit::TestCase
def setup
@matz = { :id => 1, :name => 'Matz' }
@david = { :id => 2, :name => 'David' }
@programmers = [ @matz, @david ]
end
def test_http_format_header_name
header_name ... | 41.769912 | 194 | 0.68178 |
62ae82858a3ee37225b6cb7ff9bcc028172fa29a | 1,961 | require "gds_api/router"
router = GdsApi::Router.new(Plek.find("router-api"))
document_publications_urls = [
%w(applying-for-a-uk-visa-in-japan apply-for-a-uk-visa-in-japan),
%w(argentina-apply-for-a-uk-visa apply-for-a-uk-visa-in-argentina),
%w(bankruptcy-what-will-happen-to-my-pension bankruptcy-pension),
%... | 40.854167 | 153 | 0.700153 |
91a65d92cb34bf19329187a2edba1c1d07ddbcb8 | 199 | # This migration comes from spree (originally 20130203232234)
class AddIdentifierToSpreePayments < ActiveRecord::Migration
def change
add_column :spree_payments, :identifier, :string
end
end
| 28.428571 | 61 | 0.80402 |
284de678912f0e9890be6767a8123451b14d047e | 362 | module Databender
class ForeignConstraint
attr_accessor :table_name, :column_name, :ref_table_name, :ref_column_name
def initialize(table_name, column_name, ref_table_name, ref_column_name)
@table_name = table_name
@column_name = column_name
@ref_table_name = ref_table_name
@ref_colum... | 30.166667 | 78 | 0.754144 |
01483906612be4935cb76b60a8f46e83105afd99 | 3,244 | require 'rails_helper'
describe Chapter do
let(:git) { Git.new("radar", "markdown_book_test") }
let(:book) { FactoryBot.create(:book) }
before do
FileUtils.rm_rf(git.path)
git.update!
book.path = 'spec/fixtures/repos/radar/markdown_book_test'
end
it "can process markdown" do
chapter = book.... | 23.507246 | 78 | 0.59217 |
3367f4fe73ec059ec4be0379be2f8a7aaf42aea6 | 4,631 | class WidgetPresenter
include ApplicationHelper
include ActionView::Helpers::UrlHelper
def initialize(view, controller, widget)
@view = view
@controller = controller
@widget = widget
@sb = controller.instance_eval { @sb }
end
extend Forwardable
def_delegators(:@controller, :current_user, :... | 42.1 | 114 | 0.515008 |
61eb4e88566a55ed9b31402d7c20110ca1bdbdf4 | 1,084 | # frozen_string_literal: true
class Parser::Source::Range
def succ
adjust(begin_pos: +1, end_pos: +1)
end
def wrap_rwhitespace(whitespaces: /\A\s+/)
whitespace = @source_buffer.slice(end_pos..-1)[whitespaces] || ''
adjust(end_pos: whitespace.size)
end
def wrap_rwhitespace_and_comments(whitespac... | 31.882353 | 96 | 0.683579 |
91baafe0591aaed9ba3151b784353f30a3e53337 | 10,171 | require 'bosh/director/rendered_job_templates_cleaner'
module Bosh::Director
class InstanceUpdater
include DnsHelper
UPDATE_STEPS = 7
WATCH_INTERVALS = 10
attr_reader :current_state
# @params [DeploymentPlan::Instance] instance
def initialize(instance, event_log_task, job_renderer)
@... | 30.00295 | 99 | 0.630715 |
0310241a12b1c313f52fcc48f1d6801fff834329 | 561 | # frozen_string_literal: true
module Facts
module El
module Os
class Release
FACT_NAME = 'os.release'
ALIASES = %w[operatingsystemmajrelease operatingsystemrelease].freeze
def call_the_resolver
version = Facter::Resolvers::OsRelease.resolve(:version_id)
[Facter... | 26.714286 | 78 | 0.659537 |
79a36def81b00fab053a63fac4fc6b79887c2ecc | 1,634 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 the OpenProject GmbH
#
# 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, which is a fork ... | 38 | 91 | 0.749082 |
1df3ec03a3529c92ea63c1d40a32b91f02d2b090 | 258 | class CreateCategories < ActiveRecord::Migration
def change
create_table :categories do |t|
t.string :title
t.string :ancestry
t.integer :position
t.timestamps null: false
end
add_index :categories, :ancestry
end
end
| 19.846154 | 48 | 0.678295 |
e86cb912ec8c29b8c16b222199bf68c3aaf90b6e | 684 | require_relative '../../../../../environments/rspec_env'
shared_examples_for 'a named model' do
# clazz must be defined by the calling file
let(:model) { clazz.new }
it 'has a name' do
expect(model).to respond_to(:name)
end
it 'can change its name' do
expect(model).to respond_to(:name=)
mod... | 17.1 | 56 | 0.644737 |
08e492fec3fa0252d1d2c59ec46fd0a95451122c | 1,340 | # frozen_string_literal: true
require 'weather_destination/version'
require 'uri'
require 'net/http'
require 'openssl'
module WeatherDestination
class << self
attr_accessor :api_token
BASE_URL = 'https://api.weatherapi.com/v1/'
def config
yield self
end
def call(method_name, params)
... | 23.928571 | 103 | 0.683582 |
ed1d7d0a7c7d7403f7d2b4ef64d05b765d1593bd | 2,299 | #!/usr/bin/env ruby
#############################################################################
# File: test/scratch/multiplexing_log_service.rb
#
# Purpose: COMPLETE_ME
#
# Created: 7th February 2018
# Updated: 7th February 2018
#
# Author: Matthew Wilson
#
# Copyright: <<TBD>>
#
###... | 20.9 | 135 | 0.653328 |
d57d42f43237b57151b22d90dcd00c8ad15a6b03 | 2,616 | require_relative "base"
require "json"
require "yaml"
module MCollective
module Util
class Playbook
class DataStores
class FileDataStore < Base
attr_accessor :file, :format, :create
def startup_hook
@file_mutex = Mutex.new
end
def from_hash(pro... | 24.448598 | 108 | 0.496177 |
91b59612e33df4d2e3e8bd969b09f964fc323158 | 3,636 | class TasksController < ApplicationController
# The sortable method requires these
helper_method :sort_column, :sort_direction
# GET my/tasks
# GET /tasks.xml
def my_index
authorize! :read, Task
@tasks = Task.where(:user_id => current_user.id).order(sort_column + " " + sort_direction).page(permitted_... | 28.186047 | 158 | 0.624312 |
21cdbbfd7d718fe47cde712dce7d033169f67aa2 | 1,737 | #
# Be sure to run `pod lib lint EYDownLoadManager.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 = 'E... | 36.957447 | 108 | 0.650547 |
ac762e05f90d32c839f31828654c4ed67e90d71a | 1,481 | require "virtus"
module Postman
module App
module Model
class Base
include Virtus
attribute :id, String, :default => proc{UUID.generate.gsub("-",'')}
# 根据ID查找对象
def self.find(id)
key = self.redis_key(id)
h = ::P::C.redis.hgetall(key)
h && self.new(h)
end
def self.del(id)
... | 18.283951 | 71 | 0.582039 |
e97cc3c43e9ddd2e4b298675cd27eb52f27f7efd | 6,198 | class ProtobufAT31 < Formula
desc "Protocol buffers (Google's data interchange format)"
homepage "https://github.com/google/protobuf/"
url "https://github.com/google/protobuf/archive/v3.1.0.tar.gz"
sha256 "fb2a314f4be897491bb2446697be693d489af645cb0e165a85e7e64e07eb134d"
bottle do
sha256 "864843639906476... | 40.509804 | 145 | 0.745886 |
625402341937e25fe36985dcfa1cedab5db2b4de | 7,767 | # frozen_string_literal: true
require "excon"
require "toml-rb"
require "python_requirement_parser"
require "dependabot/update_checkers/base"
require "dependabot/shared_helpers"
require "dependabot/utils/python/requirement"
module Dependabot
module UpdateCheckers
module Python
class Pip < Dependabot::Upd... | 34.065789 | 79 | 0.615682 |
03877beaadbcac244cc493efba5b64bfc1cdbfec | 46 | require "minitest/autorun"
require "pinglish"
| 15.333333 | 26 | 0.804348 |
b94f4a8fcefcc5e517bc2f1c331cd739d90855f4 | 689 | require File.expand_path("../../Abstract/abstract-php-extension", __FILE__)
class Php54Pthreads < AbstractPhp54Extension
init ['with-thread-safety']
homepage 'http://pecl.php.net/package/pthreads'
url 'http://pecl.php.net/get/pthreads-0.1.0.tgz'
sha1 '311837ce19a76983d5d7af7d13af4e3528f4a70f'
head 'https://g... | 29.956522 | 75 | 0.701016 |
6185b987c39d74226f453fc2a1caeeef8f6dd624 | 825 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core/handler/reverse_tcp_ssl'
require 'msf/core/payload/python/reverse_tcp_ssl'
module MetasploitModule
CachedSize = 453
include Msf::Payload::Stager
include M... | 28.448276 | 72 | 0.62303 |
abe8674398e343ebcc3a2183c83f3f6bf15f8423 | 4,329 | require 'spec_helper'
require 'repositories/deployment_event_repository'
module VCAP::CloudController
module Repositories
RSpec.describe DeploymentEventRepository do
let(:app) { AppModel.make(name: 'popsicle') }
let(:user) { User.make }
let(:droplet) { DropletModel.make }
let(:deployment)... | 44.173469 | 112 | 0.634789 |
39b2cb25bf74414ce5827af47e76cee8be28c225 | 396 | module BootstrapEmail
module Component
class Card < Base
def build
each_node('.card') do |node|
node.replace(template('table', classes: node['class'], contents: node.inner_html))
end
each_node('.card-body') do |node|
node.replace(template('table', classes: node['c... | 26.4 | 92 | 0.606061 |
edbd9003f907ec1b03f7cae29680af7427032f1f | 592 | require 'spec_helper'
describe 'convert_to_json_string' do
it 'exists' do
is_expected.not_to eq(nil)
end
it 'hash to json string' do
data = {:some => "data"}
is_expected.to run.with_params(data).and_return('{"some":"data"}')
end
it 'array of strings with kv to json string' do
data = ['mykey... | 25.73913 | 88 | 0.660473 |
7a8abd949545f1bac4cb21d514db109a0807c808 | 3,169 | # frozen_string_literal: true
module Enolib
class HtmlReporter < Reporter
def self.report(context, emphasized = [], marked = [])
emphasized = [emphasized] unless emphasized.is_a?(Array)
marked = [marked] unless marked.is_a?(Array)
content_header = context.messages::CONTENT_HEADER
gutter_... | 27.318966 | 116 | 0.564847 |
7a32b298b8dc6fe4ce108fb4194156982a2368a8 | 37 | module Rangu
VERSION = "0.3.0"
end
| 9.25 | 19 | 0.648649 |
ffcbcc1dad5446a3c645b7ccf7c3a9ea713ca431 | 3,169 | # 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... | 41.155844 | 86 | 0.754812 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.