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 |
|---|---|---|---|---|---|
4ae5e2d9c339eecece76772c14f6ceac3ffefd22 | 714 | require 'test_helper'
require 'logger'
describe MetaRequest::LogInterceptor do
before do
@app_request = MetaRequest::AppRequest.new(17)
@app_request.current!
@app_request.events << 'mock'
@logger = Logger.new("/dev/null")
@logger.extend(MetaRequest::LogInterceptor)
end
it 'adds app request e... | 31.043478 | 94 | 0.726891 |
0896cc7b2035c397e0ed803fcc140782be5d6baa | 1,069 | # frozen_string_literal: true
module Mutations
module Clusters
module Agents
class Create < BaseMutation
include FindsProject
authorize :create_cluster
graphql_name 'CreateClusterAgent'
argument :project_path, GraphQL::Types::ID,
required: true,
... | 27.410256 | 99 | 0.595884 |
e270ddae88af716a54f98686549dd49dcfaab2a7 | 871 | $LOAD_PATH.push(File.expand_path('../lib', __FILE__))
require 'clingon/version'
Gem::Specification.new do |s|
s.name = 'clingon'
s.version = Clingon::VERSION.dup
s.date = '2018-04-06'
s.summary = 'Flexible command line parser.'
s.description =
'Clingon is a ... | 39.590909 | 80 | 0.623421 |
4a712e20eeacb20d59f7c0ee5d03349fd07f4a42 | 3,919 | class ArnoldCVariable
attr_reader :name
attr_accessor :value
def initialize(name, value = nil)
@name = name
@value = value
end
def to_s
"ArnoldCVariable: #{@name} => #{@value}"
end
end
class ArnoldCStatement
attr_reader :name, :args, :template
def initialize(name, template, *args)
#... | 21.651934 | 83 | 0.668538 |
b9115c0b2b3a4672edaec1bf9fe8a1fae5d6ff74 | 252 | # frozen_string_literal: true
module AwesomeRPNCalculator
module Operators
class Multiplication
class << self
def call(first_operand, second_operand)
first_operand * second_operand
end
end
end
end
end
| 18 | 47 | 0.674603 |
ac330c0557cf8b771e7f058eafa02a3cd90d1ea1 | 220 | class CreateSignLogs < ActiveRecord::Migration
def change
create_table :sign_logs do |t|
t.integer :order_id
t.integer :user_id
t.datetime :sign_at
t.timestamps null: false
end
end
end
| 20 | 46 | 0.677273 |
edfa3c7b99de1af8a0a7bd5e7db88aec08d802c2 | 465 | class AddUuidV2ToEntourages < ActiveRecord::Migration
def up
add_column :entourages, :uuid_v2, :string, limit: 12
Entourage.reset_column_information
Entourage.find_each do |e|
e.send :set_uuid
e.save!
end
change_column :entourages, :uuid_v2, :string, limit: 12, null: false
add_inde... | 25.833333 | 72 | 0.709677 |
bb52fc0048ff18583f71568a218e85ad9dd3d25e | 494 | class RestartsController < ConsoleController
def show
@application = Application.find(params[:application_id], :as => current_user)
end
def update
@application = Application.find(params[:application_id], :as => current_user)
if @application.restart!
message = @application.messages.first || "T... | 26 | 106 | 0.694332 |
2873fa40450eb7b3116a483807143b3e1f9242f4 | 419 | Rails.application.routes.draw do
get 'report', to: 'marty/report#index'
end
Marty::Engine.routes.draw do
match via: [:get, :post], 'rpc/evaluate(.:format)' => 'rpc', as: :rpc
match via: [:get, :post], 'report(.:format)' => 'report#index', as: :report
get 'job/download' => 'job', as: :job
post 'delayed_job/t... | 34.916667 | 79 | 0.653938 |
b9734700f8c664f135175a2309b943c39be2b8df | 5,875 | =begin
#Selling Partner API for Feeds
#The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.
OpenAPI spec version: 2020-09-04
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.33
=end
module AmzSpApi::Feeds_20200904
class Confi... | 29.522613 | 120 | 0.657021 |
6a38b1bfce9a875625704fff804514e7fc97bdca | 1,432 | # -*- encoding: utf-8 -*-
#
# Copyright 2015 North Development AB
#
# 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 applica... | 32.545455 | 74 | 0.694832 |
d565011425576f7ffaf43cb6f07b567bd066bbf7 | 4,521 | # frozen_string_literal: false
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules a... | 38.641026 | 133 | 0.647866 |
bbea6e73e9e034312c9cf2f42d851468b0d2ef5a | 11,427 | module TransactionService::Transaction
class BookingDatesInvalid < StandardError; end
class IllegalTransactionStateException < Exception
end
ProcessStatus = TransactionService::DataTypes::ProcessStatus
TxStore = TransactionService::Store::Transaction
ProcessTokenStore = TransactionService::Store::Process... | 37.343137 | 156 | 0.718386 |
089658d95693196ee38ec4beeb1837e98cc68e44 | 1,505 | require "spec_helper"
describe Watir::Browser do
describe "#scroll.to" do
it "scrolls to the top of the page" do
@browser.scroll.to :bottom
@browser.scroll.to :top
expect(visible?(@browser.button(text: 'Top'))).to eq(true)
expect(visible?(@browser.button(text: 'Center'))).to eq(true)
... | 34.204545 | 72 | 0.645847 |
03879adc4b1ed6a35d3e27f6892dde5b31795774 | 529 | Pod::Spec.new do |s|
s.name = "FUTabBarController"
s.version = "2.0.1"
s.summary = "custom FUTabBar"
s.homepage = "https://github.com/FuJunZhi/FUTabBarController"
s.license = "MIT"
s.authors = {"FuJunZhi" => "185476975@qq.com"}
s.platform = :ios, "7.0"
... | 40.692308 | 102 | 0.587902 |
4a22324fa431925a9ef190284ab440c70d125510 | 1,469 | module ShopifyCLI
module Services
autoload :BaseService, "shopify_cli/services/base_service"
autoload :ReportingService, "shopify_cli/services/reporting_service"
module App
module Serve
autoload :NodeService, "shopify_cli/services/app/serve/node_service"
autoload :RailsService, "sho... | 38.657895 | 88 | 0.727706 |
1c320c46dda95a7fb6ea28d8f1fbf9c001d99c82 | 211 | module RubyVolt
class DataType
class UInteger < IntegerType # Unsigned
DIRECTIVE = 'L>'
LENGTH = 4
NULL_INDICATOR = 0 # SQL NULL indicator for object type serializations
end
end
end | 23.444444 | 76 | 0.677725 |
394e502051beb489f40b058ceac2cc69abdf587e | 7,903 | require 'rubygems'
require 'rubygems/user_interaction'
require 'fileutils'
begin
gem 'rdoc'
rescue Gem::LoadError
# swallow
else
# This will force any deps that 'rdoc' might have
# (such as json) that are ambiguous to be activated, which
# is important because we end up using Specification.reset
# and we d... | 23.451039 | 78 | 0.664178 |
39eab17345162f55d3d43160302f49f3b439d3d2 | 1,515 | require 'git'
require 'logger'
module Tagging
class AppVersion
def initialize(options={})
@options = {message:'versioning by CI'}.merge(options)
@git = nil
end
def version
load_tags if @options[:load_tags]
@options[:current_version] ||= `git -C #{Dir.pwd} describe --tags $(git -... | 25.677966 | 176 | 0.623762 |
6156b8ec3ff08508a4ad049214e312ce9cbf6cf7 | 8,758 | module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class ConektaGateway < Gateway
self.live_url = 'https://api.conekta.io/'
self.supported_countries = ['MX']
self.supported_cardtypes = %i[visa master american_express carnet]
self.homepage_url = 'https://conekta.io/'
self.display... | 37.91342 | 127 | 0.611098 |
610f62da6fd5fd104f3ec2fdc807cfb9f5711e8a | 1,043 | require "logger"
require_relative "../connector/updater"
class InnerClientUpdater < Updater
def initialize(
poll_processor,
client_callback,
logger = nil
)
unless poll_processor.kind_of?(PollingProcessor)
raise "The 'poll_processor' parameter must be of '" + PollingProcessor.to_s + "' da... | 16.555556 | 97 | 0.689358 |
e2e65736beb53dac4a907abeaae618a14483a7bc | 702 | require('rspec')
require('roman_numerals')
describe('numerals_counter') do
it('Returns the Roman numeral version of a single digit') do
numerals_counter("1").should(eq("I"))
end
it('Returns the 2-character Roman numeral version of a single digit') do
numerals_counter("2").should(eq("II"))
end
it('R... | 26 | 74 | 0.713675 |
e2267fbcb025673f83f8cb4decd449569f8d4cad | 1,580 | # 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.
#
# This file is the source Rails uses to define your schema when running `bin/rai... | 36.744186 | 86 | 0.722785 |
62aec4e684040a385c7a55e431b89ec5eef9916d | 2,730 | require 'spec_helper'
describe Routler::Parser do
before :each do
@p = Routler::Parser.new
end
it 'should have controllers, lines and error_lines attrs' do
expect(@p.controllers).to eq({})
expect(@p.lines).to eq(0)
expect(@p.error_lines).to eq([])
end
describe '#parse_line' do
it 'shou... | 35.921053 | 120 | 0.678755 |
1a3d4ef8eca614fdd5da4f6fab0c1ba044d6cf44 | 1,156 | =begin
#Ory APIs
#Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.
The version of the OpenAPI document: v0.0.1-alpha.30
Contact: support@ory.sh
Generated by: https://openapi-generator.tech
O... | 30.421053 | 177 | 0.736159 |
e87815dcaaf99e7873074b2acd51f45c8a3f7937 | 21,958 | DEG2RAD = Math::PI / 180.0
class Vec2
attr_accessor(:x, :y)
def initialize(x = 0.0, y = 0.0)
@x = x
@y = y
end
def to_a
[@x, @y]
end
def set!(x, y)
@x = x
@y = y
self
end
def set_from!(vec2_other)
@x = vec2_other.x
@y = vec2_other.y
self
end
def add!(vec2_rh... | 18.913006 | 167 | 0.583386 |
b95770d54c0f8ca08418b56d6120bd4c0a4b08af | 2,025 | require File.expand_path(File.dirname(__FILE__) + './../spec_helper')
require 'rack/test'
require 'blackbeard/dashboard'
module Blackbeard
describe Dashboard do
include Rack::Test::Methods
let(:app) { Dashboard }
describe "get /features" do
it "should list all the features" do
Feature.cr... | 30.223881 | 143 | 0.643951 |
6ad7780401286b426b2645272fc640ce9ae2d1d9 | 1,173 | require 'spec_helper'
describe SimpleDeploy do
before do
@logger_mock = mock 'logger'
end
context "with new logger" do
before do
@logger_mock.should_receive(:datetime_format=).with '%Y-%m-%dT%H:%M:%S%z'
@logger_mock.should_receive(:formatter=)
@logger_mock.should_receive(:level=).with... | 28.609756 | 79 | 0.69139 |
39bdc1f58e8246d54d83bd0ffb7b789f78583452 | 1,904 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "daily_scores/version"
Gem::Specification.new do |spec|
spec.name = "daily_scores"
spec.version = DailyScores::VERSION
spec.authors = ["Nick Solony"]
spec.email = ["nicksolon... | 40.510638 | 96 | 0.685924 |
bf6a3680c65213c437675f0e25b8a9e117fd044b | 512 | require 'test/unit'
require File.join(File.dirname(__FILE__), '../lib/image_temp_file')
class ImageTempFileTest < Test::Unit::TestCase
include MiniMagick
def test_multiple_calls_yield_different_files
first = ImageTempFile.new('test')
second = ImageTempFile.new('test')
assert_not_equal first.path, seco... | 28.444444 | 67 | 0.730469 |
e87a1ac27920e3814098190c05b75c9dd232d69e | 2,550 | use_bpm 120
set :key, :e3
in_thread name: :guitar do
sync :start_guitar
root = sync :root
define :main_progression do
play chord(root, :major)
sleep 1
play chord(root, :major)
sleep 1
play root + 3, amp: 0.5
sleep 1
play chord(root + 5, :major)
sleep 2/3.0
play root + 7, a... | 17.465753 | 42 | 0.586275 |
33a9645efe2d08e777926015b1eb9eff5ffbe54b | 2,714 | #
# these tests are a little concerning b/c they are hacking around the
# modulepath, so these tests will not catch issues that may eventually arise
# related to loading these plugins.
# I could not, for the life of me, figure out how to programatcally set the modulepath
$LOAD_PATH.push(
File.join(
File.dirname(_... | 23.807018 | 86 | 0.599484 |
6af795447d744f8ba795378fc7a125915d38ff10 | 4,873 | class SavedSearch < ApplicationRecord
REDIS_EXPIRY = 1.hour
QUERY_LIMIT = 1000
attr_reader :disable_labels
belongs_to :user
normalize :query, :normalize_query
normalize :labels, :normalize_labels
validates :query, presence: true
validate :validate_count, on: :create
scope :labeled, ->(label) { wh... | 26.198925 | 131 | 0.620973 |
f80a2b8a849cc33a16e46ec5db13f635be118320 | 3,048 | require 'qml'
require 'json'
$htmlui_qmlcontroller_instance = nil
$htmlui_qmlcontroller_ui = ''
# @!visibility private
module HTMLUILogic
module HTMLUIController
VERSION = '1.0'
class HTMLUIController
include QML::Access
register_to_qml
property(:content) { 'http://example.com' }
property(:win... | 21.166667 | 97 | 0.625 |
61f06b70d19b4c376b799e234dc130a0c62f9e43 | 73 | dir = File.dirname(__FILE__) + "/extensions"
require "#{dir}/octokit.rb"
| 24.333333 | 44 | 0.69863 |
394b5bf4170d18542748355e4a53f425ce452412 | 349 | # frozen_string_literal: true
module ActionCable
# Returns the version of the currently loaded Action Cable as a <tt>Gem::Version</tt>.
def self.gem_version
Gem::Version.new VERSION::STRING
end
module VERSION
MAJOR = 5
MINOR = 2
TINY = 2
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE]... | 19.388889 | 88 | 0.659026 |
792e70e33415cf6b07448a30adf49a00446468f8 | 633 | class UsersController < ApplicationController
def show
@user = User.find(params[:id])
end
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save
session[:user_id] = @user.id
redirect_to root_path
else
render :new
end
end
def edit
... | 15.439024 | 58 | 0.617694 |
e9ca3bace8a52ec7611f7500ffd739d17f5dc7c5 | 1,045 | module PolicyManager
class TermsController < PolicyManager::ApplicationController
layout 'policy_manager'
inherit_resources
authorize_resource
def collection
if can? :create, Term
@terms = Term.all.order(state: :desc)
elsif @current_user
@terms = Term.published.where(targe... | 26.125 | 119 | 0.677512 |
e9871ec17d40ed4a09768d09ad1a28ca65c306b7 | 878 | # frozen_string_literal: true
if Rails.env.test? || Rails.env.development?
Rails.application.configure do
config.after_initialize do
Bullet.enable = true
Bullet.alert = true
Bullet.bullet_logger = true
Bullet.console = true
# Bullet.growl = true
# Bullet.xmpp = { account: 'bu... | 33.769231 | 75 | 0.612756 |
874d9b8e6176d5ee4aaeabc2b9c2bb9d036f0650 | 3,106 | require 'em-websocket'
module React
module Rails
module HotLoader
class Server
attr_reader :host, :port, :change_set_class
def initialize(host: "0.0.0.0", port:, change_set_class: React::Rails::HotLoader::AssetChangeSet)
@host = host
@port = port
@change_set_c... | 33.397849 | 126 | 0.575982 |
f85b14d299122d41f1cce6ff5db36afdf04147ae | 183 | class CreateUnits < ActiveRecord::Migration
def change
create_table :units do |t|
t.integer :number
t.string :name
t.timestamps null: false
end
end
end
| 16.636364 | 43 | 0.655738 |
28ff0139500194db6738d1c3dc5aa65c7724d4b0 | 1,974 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = AverageRanking
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
'Name... | 27.416667 | 94 | 0.515198 |
f71dbd8ba1f22b7de627bf1434512959e6213bec | 453 | # frozen_string_literal: true
# Active record type for achievements.
class AchievementType < ActiveRecord::Type::String
def cast(value)
return if value.nil?
return value if value.is_a?(Achievement)
raise TypeError unless value.is_a?(String) || value.is_a?(Symbol)
Achievement.find_by!(key: value)
e... | 22.65 | 69 | 0.717439 |
91cebf0e3472f24acb9e69344f4a52583a123a1d | 1,769 | begin
require 'puppet/provider/razor'
rescue LoadError
require_relative '../razor'
end
Puppet::Type.type(:rz_policy).provide(
:rest,
:parent => Puppet::Provider::Razor
) do
def exists?
@policy = get('policies', resource[:name])
end
def create
args = {
'name' => resource[:name],
... | 22.974026 | 80 | 0.578293 |
b9073c028c1746c6f472ff912facaf881a8eae0f | 419 | # typed: true
class CreateFavorites < ActiveRecord::Migration[5.2]
def change
create_table :favorites do |t|
t.references :favoritable, polymorphic: true, index: true
t.references :user, index: true
t.timestamps
end
add_index :favorites, :favoritable_id
add_index :favorites, :favor... | 26.1875 | 76 | 0.713604 |
62dbb89c15c91ff521a50ceae0f9c9aa6979f401 | 385 | class ProcedureSignatoryDecorator < Draper::Decorator
delegate_all
def signator_types
types = lambda { |type| [h.t("signatories.initiator_types.#{type}"), type] }
signatory_types = ProcedureSignatory.initiator_types.keys.map(&types)
h.options_for_select(signatory_types, object.initiator_type)
end
... | 27.5 | 80 | 0.763636 |
f86f20ee102aef73a33be940fb2b33161df5f9a2 | 935 | Pod::Spec.new do |s|
s.name = "NSObject+Rx"
s.version = "6.0.0-rc.2"
s.summary = "Handy RxSwift extensions on NSObject."
s.description = <<-DESC
Right now, we just have a `rx_disposeBag` property, but we're open to PRs!
DESC
s.homepage = "https://github.com/RxSwif... | 38.958333 | 103 | 0.617112 |
870526fc38e8a9636d14252d97dcdca535d06147 | 36,811 | #-- vim:sw=2:et
#++
#
# :title: Uno Game Plugin for rbot
#
# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
#
# Copyright:: (C) 2008 Giuseppe Bilotta
#
# License:: GPL v2
#
# Uno Game: get rid of the cards you have
#
# TODO documentation
# TODO allow full form card names for play
# TODO allow choice o... | 28.602176 | 185 | 0.565184 |
01f61445ca0529115731a0d1e4093e84444ddcbb | 1,170 | class EnquiryMailer < ApplicationMailer
include Devise::Mailers::Helpers
include ContentHelper
def send_enquiry(enquiry)
@enquiry = enquiry
return if @enquiry.opportunity.contacts.nil?
email_addresses = @enquiry.opportunity.contacts.pluck(:email)
subject = "Enquiry from #{@enquiry.company_name}... | 27.857143 | 92 | 0.651282 |
bfbfa8f653398d0d4351a468a6512e8c1d3e1dfa | 2,128 | require "spec_helper"
describe WeixinAuthorize::Api::Mass do
let(:image_jpg_path) do
"#{File.dirname(__FILE__)}/medias/ruby-logo.jpg"
end
let(:news_media_1) do
{
"thumb_media_id" => "",
"author" => "lanrion",
"title" => "Happy Day",
"content_source_url" => "www.qq.com",
"... | 29.971831 | 83 | 0.682801 |
1d7b8969ae0cbdeeae4bb4695a4394898f611a96 | 4,414 | class ProjectFolder < ApplicationRecord
before_destroy -> (folder) { throw :abort unless folder.deletable? }
before_destroy :unsort_assets_and_remove_children
belongs_to :project
belongs_to :parent,:class_name=>"ProjectFolder",:foreign_key=>:parent_id
has_many :children,-> { order(:title) }, :class_name=>"Pr... | 33.694656 | 154 | 0.680562 |
1d0c7a00a6d858db3d6ddaa1c0d88519c497f2de | 1,522 | require 'rails/generators/active_record'
require 'generators/adminpanel/resource/resource_generator_helper'
require 'generators/adminpanel/migration/migration_generator_helper'
module Adminpanel
class MigrationGenerator < ActiveRecord::Generators::Base
include ResourceGeneratorHelper
include MigrationGenerat... | 29.269231 | 109 | 0.647175 |
015971e0b0456d87f96d8727da9323c34d99b021 | 842 | require 'railroader/checks/base_check'
#Warn about response splitting in Rails versions before 2.3.13
#http://groups.google.com/group/rubyonrails-security/browse_thread/thread/6ffc93bde0298768
class Railroader::CheckResponseSplitting < Railroader::BaseCheck
Railroader::Checks.add self
@description = "Report respo... | 38.272727 | 133 | 0.726841 |
ed7432e91e3ca7f0b7ed0c66c3a6b6d7f33fb21b | 3,960 | # Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias
# Schmidt
require 'test_helper'
require 'yaml'
require 'active_support'
$password = YAML.load_file(File.expand_path(File.dirname(__FILE__)) + '/database.yml')['password'] rescue nil
require 'lhm/table'
require 'lhm/sql_helper'
module... | 20.204082 | 109 | 0.631566 |
01d89aecb638633afc1e4eb3904330291dc41cb2 | 990 | cask "electron" do
version "14.0.0"
if Hardware::CPU.intel?
sha256 "4025c50cb9a0dce1a7b5d5698ee5412e55abeae386329ffe293152a8c42388e8"
url "https://github.com/electron/electron/releases/download/v#{version}/electron-v#{version}-darwin-x64.zip",
verified: "github.com/electron/electron/"
else
sh... | 30.9375 | 115 | 0.711111 |
61d931ff9f383a1c5a4ba6d5c72297c4644d99e4 | 2,697 | module MetricFu
class ReekGenerator < Generator
def self.metric
:reek
end
def emit
files = files_to_analyze
if files.empty?
mf_log "Skipping Reek, no files found to analyze"
@output = run!([], config_files)
else
@output = run!(files, config_files)
end... | 29 | 134 | 0.626993 |
33eef4dbfd3e54e20bb2699cc4f10356ce13d077 | 1,270 | gem 'minitest', '~> 5.2'
require 'minitest/autorun'
require 'minitest/pride'
require_relative 'dragon'
class DragonTest < Minitest::Test
def test_it_has_a_name
dragon = Dragon.new("Ramoth", :gold, "Lessa")
assert_equal "Ramoth", dragon.name
end
def test_it_has_a_rider
dragon = Dragon.new("Ramoth", :... | 21.166667 | 53 | 0.690551 |
9126526b7376172a5d7fe6f060eba25bb1c074fe | 447 | # frozen_string_literal: true
require_relative 'helper'
class TestRDocMarkupInclude < RDoc::TestCase
def setup
super
@include = @RM::Include.new 'file', [Dir.tmpdir]
end
def test_equals2
assert_equal @include, @RM::Include.new('file', [Dir.tmpdir])
refute_equal @include, @RM::Include.new('file... | 21.285714 | 66 | 0.686801 |
bfec96ff8a7988452442f24a6d41562198c53138 | 729 | cask "kubenav" do
version "3.7.2"
if Hardware::CPU.intel?
sha256 "6977025db6c093f5e7f7cd72bd027cec9b23ddfbe76a44343a84a4e1d7a43fa1"
url "https://github.com/kubenav/kubenav/releases/download/#{version}/kubenav-darwin-amd64.zip",
verified: "github.com/kubenav/kubenav/"
else
sha256 "267047ccca59... | 34.714286 | 99 | 0.748971 |
0886f503e8ec926a124e2c7a524064213cfafdbb | 2,726 | require 'test_helper'
class PasswordResetsTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
def setup
ActionMailer::Base.deliveries.clear
@user = users(:micheal)
end
test "password resets" do
get new_password_reset_path
assert_template 'password_resets/new'
... | 32.452381 | 71 | 0.712766 |
08c76d6688a96a464cd4319b5607aa104e7593bd | 2,758 | # -*- encoding: utf-8 -*-
# stub: actionpack 5.2.6 ruby lib
Gem::Specification.new do |s|
s.name = "actionpack".freeze
s.version = "5.2.6"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "changelog_uri" => "https://github.com/rails/... | 51.074074 | 212 | 0.651197 |
79202293ccbbaa02c90fd1c66eab256894f206af | 1,348 | require 'cardigan/io'
require 'cardigan/root_context'
require 'flat_hash/directory'
require 'flat_hash/serialiser'
require 'flat_hash/repository'
require 'cardigan/workflow_repository'
require 'cardigan/configuration'
require 'cardigan/filtered_repository'
class Cardigan::Cli
def initialize io=Cardigan::Io.new
@... | 39.647059 | 96 | 0.732938 |
4a17d219fb268d64bfe47b03d1822a2629811469 | 1,619 | require "application_system_test_case"
class StiesTest < ApplicationSystemTestCase
setup do
@sty = sties(:one)
end
test "visiting the index" do
visit sties_url
assert_selector "h1", text: "Sties"
end
test "creating a Sty" do
visit sties_url
click_on "New Sty"
fill_in "Advice2", wit... | 25.296875 | 48 | 0.660902 |
181867d5b5c709adfc3c998577572824a6fc78a8 | 903 | require "spec_helper"
RSpec.describe FmRest::Spyke::Model::GlobalFields do
let(:test_class) { fmrest_spyke_class }
describe ".set_globals" do
before { stub_session_login }
let(:request) { stub_request(:patch, fm_url + "/globals").to_return_fm }
context "when given a valid values hash" do
it "b... | 28.21875 | 102 | 0.593577 |
26c18239dcb3d56069caede6d478bbfe4895facc | 1,294 | module NexusAPI
class Search < ::Thor
attr_accessor :api
include NexusAPI::CLIUtils
desc 'asset', 'Print names of any assets that match the search'
option :name, :aliases => '-n', :desc => 'Name of asset to search for', :required => true
option :type, :aliases => '-t', :desc => 'Sear... | 36.971429 | 105 | 0.554869 |
08fb21f4f6fcd4d6b1b7399f651085916e2929dd | 4,860 | #
# Be sure to run `pod lib lint WhirlyGlobe.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# Any lines starting with a # are optional, but encouraged
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name ... | 51.157895 | 718 | 0.669753 |
e24fa1dd494ee529025753f11811a774f4447414 | 1,800 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.use_transactional_fixtures = false
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test ... | 40 | 85 | 0.776667 |
1addd55ba93a145b035df9b7c3fe3c4fb03dbd32 | 15,850 | module CanCan
# This module is automatically included into all controllers.
# It also makes the "can?" and "cannot?" methods available to all views.
module ControllerAdditions
module ClassMethods
# Sets up a before filter which loads and authorizes the current resource. This performs both
# load_... | 40.641026 | 178 | 0.65123 |
ab8b96b1aa58c21601ddddcbcc7265fe6ce5399f | 2,827 | def create_music_album()
# Label
print 'Label title (e.g. new or gift): '
music_album_label_title = gets.chomp.downcase
print 'Label color (e.g. blue or yellow): '
music_album_label_color = gets.chomp.downcase
# Genre
print 'Genre: '
music_album_genre = gets.chomp.downcase
# Source
print 'Source (... | 54.365385 | 263 | 0.776795 |
62011d1cb5ad92ed66105197d1f5ce4ada311fab | 1,138 | require 'rails_helper'
require 'spree/api/testing_support/helpers'
RSpec.describe Spree::Api::UsersController, type: :controller do
include Spree::Api::TestingSupport::Helpers
routes { Spree::Core::Engine.routes }
let!(:user) do
create(:user) { |user| user.generate_spree_api_key }.tap(&:save)
end
let!(:... | 24.212766 | 75 | 0.629174 |
f8f557f1a502808785a1ce6de30ca798dc8de793 | 1,629 | require 'spec_helper'
require 'cfn-model'
require 'cfn-nag/custom_rules/SecurityGroupIngressCidrNon32Rule'
describe SecurityGroupIngressCidrNon32Rule do
context 'security group with ingress rules open to a cidr that is not /32' do
it 'returns offending logical resource id' do
cfn_model = CfnParser.new.pars... | 41.769231 | 115 | 0.799263 |
8729e70c50d17f778341d09d734580d49ce2e78d | 723 | 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 SampleApp
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails... | 32.863636 | 82 | 0.771784 |
2149fbe8ad88976717ccc9cb8048e18810e2c629 | 1,062 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'Soundcloud/version'
Gem::Specification.new do |spec|
spec.name = "Soundcloud"
spec.version = Soundcloud::VERSION
spec.authors = ["Amit"]
spec.email = ["gudeam... | 42.48 | 184 | 0.671375 |
2642e55dd166b5c849f4cb651c8f21f091d232a3 | 4,781 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 31.453947 | 98 | 0.646517 |
1c16c00be7182867f9ddb6eeafefce82ab82e706 | 3,371 | 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?... | 28.567797 | 78 | 0.670721 |
87e57c968e894b3b7f1d7da83d5b69340f062042 | 176 | FactoryBot.define do
factory :review do
reviewer_name { "MyString" }
title { "MyString" }
description { "MyText" }
score { 1 }
hospital { nil }
end
end
| 17.6 | 32 | 0.607955 |
61fc3cd39baebd79fbd43053f364764567366917 | 400 | # frozen_string_literal: true
module Api
module Internal
class MultipleRecordsController < Api::Internal::ApplicationController
before_action :authenticate_user!
def create
CreateMultipleEpisodeRecordsJob.perform_later(current_user.id, params[:episode_ids])
flash[:notice] = t 'messa... | 23.529412 | 92 | 0.725 |
7a2e404b690a9bd0fb936cf7e6f0ab9c73db06df | 251 | # frozen_string_literal: true
require "rails_helper"
module Alchemy
describe EssenceSelect do
it_behaves_like "an essence" do
let(:essence) { EssenceSelect.new }
let(:ingredient_value) { "select value" }
end
end
end
| 19.307692 | 50 | 0.681275 |
1ad9d337002fe42c79d3dd37a5282ba49d794f0a | 17,604 | require 'helper'
class TestSite < JekyllUnitTest
context "configuring sites" do
should "have an array for plugins by default" do
site = Site.new(Jekyll::Configuration::DEFAULTS)
assert_equal [File.join(Dir.pwd, '_plugins')], site.plugins
end
should "look for plugins under the site directory ... | 33.090226 | 120 | 0.637298 |
b94417b0d5d21b62b2d4ecdc373c75290d00e3e8 | 1,198 | # frozen_string_literal: true
# Advent of Code 2020
#
# Robert Haines
#
# Public Domain
require 'test_helper'
require 'aoc2020/toboggan_trajectory'
class AOC2020::TobogganTrajectoryTest < MiniTest::Test
MAP = <<~EOMAP
..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
... | 22.603774 | 70 | 0.489149 |
28985948713780f10f1c7489ae3b5346aca1cc0c | 1,760 | module NaspiRailsHelpers
module AssetsIncludeHelper
def naspi_stylesheet_link_tag(*sources)
options = sources.extract_options!.stringify_keys
sources.uniq.map { |source|
tag_options = {
"rel" => "stylesheet",
"media" => "screen",
"href" => naspi_file_path("#{sou... | 25.882353 | 65 | 0.602841 |
bb439713db3a304be084401b3df4f1fb89157dd7 | 409 | describe "UITableViewBuilder" do
it "should build UITableView" do
view = UI::UITableViewBuilder.new.build(UITableView)
view.class.should == UITableView
view.style.should == UITableViewStylePlain
end
it "should build UITableView with style" do
view = UI::UITableViewBuilder.new.build(UITableView, s... | 34.083333 | 88 | 0.762836 |
ed78bda944181806702331358138648d76be9a89 | 1,856 | # 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::SQL::Mgmt::V2014_04_01
module Models
#
# A database query.
#
class QueryStatistic
include MsRestAzure
# @retur... | 26.898551 | 70 | 0.478987 |
21889f920d9902f985c99fd0e3ddaeb31b6ac393 | 2,816 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = AverageRanking
include Msf::Exploit::Remote::Tcp
include Msf::Exploit::Remote::BruteTargets
def initialize(info = {})
... | 21.333333 | 79 | 0.506392 |
03d738a84fa39f7855c75c1d58e70050879af57d | 849 | module CryptKeeper
module Helper
module SQL
private
# Private: Sanitize an sql query and then execute it
def escape_and_execute_sql(query)
query = ::ActiveRecord::Base.send :sanitize_sql_array, query
::ActiveRecord::Base.connection.execute(query).first
end
end
mod... | 21.225 | 68 | 0.590106 |
1c85cd1868ea575b927f29b0194f7407bc57dbdf | 5,446 | require 'rails_helper'
RSpec.feature 'Accept data sharing agreement' do
include DfESignInHelpers
scenario 'Provider user cannot access provider_interface without a data sharing agreement in place' do
given_i_am_an_authorised_provider_user
and_no_data_sharing_agreement_for_my_provider_has_been_accepted
... | 42.546875 | 130 | 0.841902 |
18f68aa8d0599a5d7d3a36efa7bd327b471cb176 | 2,772 | # frozen_string_literal: true
require 'rails_helper'
describe ApplicationTemplate do
describe 'create_draft' do
before :each do
@application_template = create :application_template,
:with_questions,
email: 'something@example.com'
... | 33.39759 | 79 | 0.641775 |
18f90c354c25d45dadeabf593db148d6ff4c207e | 60 | json.array! @agendas, partial: 'agendas/agenda', as: :agenda | 60 | 60 | 0.733333 |
e9e5e08a6526a2c1bfdcc43841e9b7145bae30ab | 2,628 | # frozen_string_literal: true
module N1Loader
# The module to be included to the class to define associated loaders.
#
# class Example
# include N1Loader::Loadable
#
# # with inline loader
# n1_loader :something do
# def perform(elements)
# elements.each { |element| fulfil... | 26.545455 | 106 | 0.613014 |
1cfb7e0807c7112c76c94706fc99913b79063a5b | 3,375 | #!/usr/bin/env ruby
Process.setproctitle('ETA Service')
require 'bundler'
Bundler.require
require 'active_support/logger'
require 'active_support/cache'
MULTIPLIER = Float(ENV.fetch('MULTIPLIER', 1.5))
CACHE_EXPIRATION_TIME = Integer(ENV.fetch('CACHE_EXPIRATION_TIME', 15))
# 3 знака после запятой — это около 111 мет... | 32.142857 | 121 | 0.692148 |
266cdb31d04171d793bcb3b4c11dfe9a79e0e694 | 263 | require 'test_helper'
class TitleParserTest < Minitest::Test
def setup
@html = File.read File.expand_path("track_fragment.html", "test/data")
end
def test_parse
assert_equal "We Are The Champions",
Sektor::TitleParser.parse(@html)
end
end
| 20.230769 | 74 | 0.714829 |
ed3f3fb3c15bb91a7cc8216be181a07874f7057a | 440 | #
# Cookbook Name:: motd
# Spec:: default
#
# Copyright (c) 2015 The Authors, All Rights Reserved.
require 'spec_helper'
describe 'motd::default' do
context 'When all attributes are default, on an unspecified platform' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new
runner.converge(describe... | 20.952381 | 74 | 0.7 |
abc126bb47c37117c8bebbb2e37e45d765e7cc94 | 89 | # Just namespace for version number
module SpbtvCodeStyle
VERSION = '1.7.0'.freeze
end
| 17.8 | 35 | 0.764045 |
618aa13f5d6b2aeb6235c7db1c17d0cb223fb757 | 2,962 | # Copyright 2017 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... | 27.943396 | 91 | 0.674207 |
ff5857748dc14ecf2fbc89f81a8b2ed1df27d99b | 1,438 | RSpec.describe Xsd::Validator do
include Xsd::Validator
it "has a version number" do
expect(Xsd::Validator::VERSION).not_to be nil
end
it 'knows the root namespace' do
doc = "<thing xmlns='asdf'>asdf</thing>"
expect(root_namespace(doc)).to eq('asdf')
doc = "<ns:thing xmlns:ns='asdf'>asdf</thi... | 33.44186 | 109 | 0.678025 |
39e247e3c0de842b959f74117acc3c0eaf0782d9 | 461 | class RedisThrottle
class << self
attr_accessor :redis
def limit(time_in_secs, *args, &block)
key = ["redis-throttle", block_id(&block), *args].join('-')
return if @redis.get(key)
yield
@redis.setex(key, time_in_secs, Time.now)
end
# uses filename / line no. as ide... | 24.263158 | 88 | 0.600868 |
1a91ca946f12ed6edc9bef02f2b8c3ea173952b7 | 103 | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
end
| 12.875 | 52 | 0.796117 |
d56b16849c5a2f1d9dc36d7269b6dd6e1d3cf86d | 1,632 | #
# Copyright:: 2016-2018, Chef Software, 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 agree... | 30.222222 | 93 | 0.610294 |
1812199eb2e76fb9f8e94098e25f4bd0c7a0a5ee | 43 | module ToWa
VERSION = '0.3.0'.freeze
end
| 10.75 | 26 | 0.674419 |
ed61d4a7b0a99ee6faa87a5a74a03ec2bbc50320 | 11,423 | #
# converted from the gitrb project
#
# authors:
# Matthias Lederhofer <matled@gmx.net>
# Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
# Scott Chacon <schacon@gmail.com>
#
# provides native ruby access to git objects and pack files
#
require 'zlib'
require 'gifts/grit/git-ruby/internal/raw_object'
requi... | 28.629073 | 113 | 0.476757 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.