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 |
|---|---|---|---|---|---|
21714fd4e71451c38d0d291712efc0edac8fadd0 | 126 | require 'rails_helper'
RSpec.describe Champion, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
| 21 | 56 | 0.746032 |
61f57195ac745b8f9258a43d4d4905c014c4ddd6 | 719 | require 'sageone_sdk/signature'
require 'active_support'
require "active_support/core_ext"
module SageoneSdk
module Middleware
# Signature
class Signature < Faraday::Middleware
def initialize(app, access_token, signing_secret)
super(app)
@access_token = access_token
@signing_se... | 24.793103 | 115 | 0.670376 |
339c453645f4e820ba6de97ddb87fdf4743cde0d | 107 | require 'billogram'
require 'minitest/autorun'
require 'logger'
class TestBillogram < Minitest::Test
end
| 13.375 | 36 | 0.785047 |
33b92c876176e8056d353145eb7c1ce2be6feb75 | 444 | cask 'fsnotes' do
version '4.0.9'
sha256 '256723f712c68723b0f37cec606c9a0410cfa1d796035a2a2a7dcf6390ac091a'
# github.com/glushchenko/fsnotes was verified as official when first introduced to the cask
url "https://github.com/glushchenko/fsnotes/releases/download/#{version}/FSNotes_#{version}.zip"
appcast 'htt... | 34.153846 | 98 | 0.772523 |
87f912397ec19d825c3a8e4d5d8c30a0be1a413c | 2,266 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 34.861538 | 87 | 0.763019 |
bffa6eaa7ad904171f3c624da5a2f8f33199b6b5 | 838 | class SessionsController < ApplicationController
# GET /login
def new
#@session = Session.new
end
# POST /login
def create
user = User.find_by(email: params[:session][:email])
if user && user.authenticate(params[:session][:password])
if user.activated?
# Success
log_in user... | 23.277778 | 77 | 0.625298 |
33ad71fbef06f48943ed03f4f448ee87696e771e | 1,108 | require File.dirname(__FILE__) + '/../spec_helper'
describe CustomProjectsController, "new" do
let(:project) { Project.make! }
it "should not allow access to managers if project isn't trusted" do
expect( project ).not_to be_trusted
pu = ProjectUser.make!( project: project, role: "manager" )
sign_in pu.... | 30.777778 | 70 | 0.684116 |
1d91beda1077cd301586fa48a352d0fa070720b8 | 7,956 | # encoding: UTF-8
# frozen_string_literal: true
module API
module V2
module Admin
class Adjustments < Grape::API
helpers ::API::V2::Admin::Helpers
namespace :adjustments do
desc 'Get all adjustments, result is paginated.',
is_array: true,
success: API::V2:... | 51 | 165 | 0.552288 |
f74a50f55874a5e555254c75436f44d697d292fe | 4,104 | # frozen_string_literal: true
class PressSearchBuilder < ::SearchBuilder
self.default_processor_chain += [
:filter_by_press,
:filter_by_product_access,
:show_works_or_works_that_contain_files
]
def filter_by_press(solr_parameters)
solr_parameters[:fq] ||= []
solr_parameters[:fq] << "{!... | 39.461538 | 162 | 0.716862 |
87cb5cf505c535f5b6c63b585b01491fca510514 | 1,113 | require 'gtk3'
module Overcast
module Gui
class DirectoryDetailsWindow < Gtk::Window
def initialize(window_type, options = {})
@directory_item = options[:directory_item]
parent = options[:parent]
super(window_type)
self.set_title("Directory Details [#{@directory_item.path}]... | 38.37931 | 99 | 0.660377 |
61b00a0f5023b283714b9e8edf82eff1e52e4475 | 744 | require 'spec_helper'
describe 'cis_hardening::logaudit' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
# Check for default class
it {
is_expected.to contain_class('cis_hardening::logaudit')
}
# Check for all includes in the logaud... | 24.8 | 75 | 0.63172 |
1a476ed5e97395e6e92bc6f0d96cd3e5c8974579 | 1,759 | module Pocketsphinx
module API
module Pocketsphinx
extend FFI::Library
ffi_lib "libpocketsphinx"
typedef :pointer, :decoder
typedef :pointer, :configuration
# Allows expect(API::Pocketsphinx).to receive(:ps_init) in JRuby specs
def self.ps_init(*args)
ps_init_private(... | 41.880952 | 86 | 0.688459 |
034c1a75334a8d94d3417e79e1c62c31cfaba285 | 1,111 | require 'sql_helper'
module Bmg
module Sql
class Processor
describe Requalify, "on_inner_join" do
subject{ Requalify.new(Builder.new(2)).apply(expr) }
context 'with a predicate to requalify' do
let(:expr){
sexpr [ :inner_join,
[:table_as, [:table_name, :... | 28.487179 | 77 | 0.488749 |
62ca90478a384fe2d548fb9fbd50934ebc1c3964 | 1,906 | require 'spec_helper'
describe EventLink do
#def valid_params
# {}
#end
describe "Object Attributes" do
before(:each) { @obj = EventLink.new }
specify { @obj.should respond_to(:event_id) }
specify { @obj.should respond_to(:data_link_id) }
end
describe "Associations" do
... | 22.690476 | 61 | 0.549318 |
01aa4770bad2ffbda79e1264611179559ea02d68 | 256 | class ColorpickerDeveloper < Cask
url 'http://download.panic.com/picker/developercolorpicker.zip'
homepage 'http://download.panic.com/picker/'
version 'latest'
no_checksum
colorpicker 'Developer Color Picker/DeveloperColorPicker.colorPicker'
end
| 32 | 71 | 0.796875 |
01084b5004ac8e3be7b6fb28ca815805b6a02e77 | 2,217 | class ProjectsController < ApplicationController
before_action :set_project, only: [:show, :edit, :update, :destroy]
# GET /projects
# GET /projects.json
def index
@projects = Project.all
end
# GET /projects/1
# GET /projects/1.json
def show
end
# GET /projects/new
def new
@project = Pr... | 26.082353 | 119 | 0.662156 |
e800d8357c153fd9e5926e1634c6955ff89ad5fa | 811 | class CreateBranchPriorityCharts < ActiveRecord::Migration
def self.up
create_table :branch_priority_charts do |t|
t.integer "branch_id"
t.integer "priority_id"
t.integer "date_year"
t.integer "date_month"
t.integer "date_day"
t.integer "position"
t.integer "up_cou... | 30.037037 | 110 | 0.657213 |
ed34c92c701f991ccf54d1aa5fd9035255de5a94 | 277 | class Pdfier
def initialize(url, filename)
@url = url
@filename = filename
end
def save_as_pdf
`wkhtmltopdf #{@url} ./files/#{get_filename}`
get_filename
end
private
def get_filename
return @filename if @filename.match(/\.pdf$/)
"#{@filename}.pdf"
end
end | 15.388889 | 47 | 0.689531 |
5d94090c68723215fe5604a852c9c46cb9b69cc2 | 1,534 | require "set"
module ActiveRecord
module SqlAnalyzer
class BackgroundProcessor
def initialize
@queue = Queue.new
end
def <<(event)
processor_thread
@queue << event
end
private
MUTEX = Mutex.new
def process_queue
event = @queue.pop
... | 25.566667 | 132 | 0.562581 |
38ed20fb4b77586db4bd427fae0df0a4443fe5ed | 378 | # frozen_string_literal: true
class CreateOrganizations < ActiveRecord::Migration[5.0]
def change
create_table :organizations, id: :uuid do |t|
t.string :name
t.string :api_key
t.string :client_id
t.string :client_secret
t.string :primary_color
t.string :secondary_color
... | 21 | 56 | 0.671958 |
381182b4c737e5d7cea0d801f320f3235bf88a29 | 413 | # Be sure to restart your server when you modify this file.
Library::Application.config.session_store :cookie_store, key: '_library_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails g... | 45.888889 | 80 | 0.811138 |
d51b866a47127733b1328179eeaac76b7529a5c9 | 1,381 | class Mailboxer::Message < Mailboxer::Notification
attr_accessible :attachment if Mailboxer.protected_attributes?
self.table_name = :mailboxer_notifications
belongs_to :conversation, :class_name => "Mailboxer::Conversation", :validate => true, :autosave => true
validates_presence_of :sender
class_attribute ... | 27.62 | 106 | 0.735699 |
6a8e0b1be33d431ef93a435482d1b7bbf1e7f96a | 20,000 | require './test/helper'
class IntegrationTest < Test::Unit::TestCase
context "Many models at once" do
setup do
rebuild_model
@file = File.new(File.join(FIXTURES_DIR, "5k.png"), 'rb')
300.times do |i|
Dummy.create! :avatar => @file
end
end
teardown { @file.close }
... | 32.894737 | 108 | 0.57625 |
e24c2b0a8f7cd8e20f92bf5488818cfe12ddfdbd | 594 | # frozen_string_literal: true
module Discounts
class Base < Micro::Case
attributes :balance, :quantity_condition
def call!
Failure result: { error: 'Error: this method should not be call directly' }
end
private
def new_balance
{ quantity: new_quantity,
price: new_price,
... | 18 | 81 | 0.63468 |
d5ff9b025cc9d3db5aa8a2d20c96c98645631b2d | 468 | # frozen_string_literal: true
module Banzai
module Pipeline
class DescriptionPipeline < FullPipeline
WHITELIST = Banzai::Filter::SanitizationFilter::LIMITED.deep_dup.merge(
elements: Banzai::Filter::SanitizationFilter::LIMITED[:elements] - %w(pre code img ol ul li)
)
def self.transform... | 24.631579 | 100 | 0.666667 |
6a8d8cd62025107c08c26f7f82ef9a0cb0736a6b | 471 | require 'spec_helper'
describe Sufia::UploadSetUpdateFailureService do
let(:depositor) { create(:user) }
let(:upload_set) { UploadSet.create }
let(:inbox) { depositor.mailbox.inbox }
describe "#call" do
subject { described_class.new(depositor, upload_set) }
it "sends failing mail" do
subject.ca... | 26.166667 | 94 | 0.692144 |
7a6a7c6a44f409d379078377f34c01117d6f8c35 | 6,871 | require 'datadog/core/environment/variable_helpers'
require 'ddtrace/utils/only_once'
module Datadog
# Contains profiler for generating stack profiles, etc.
module Profiling # rubocop:disable Metrics/ModuleLength
GOOGLE_PROTOBUF_MINIMUM_VERSION = Gem::Version.new('3.0')
private_constant :GOOGLE_PROTOBUF_MI... | 45.503311 | 122 | 0.704264 |
d5723050822efcf632796fbe7436b23173f495f2 | 1,146 | module Gws::Circular::See
extend ActiveSupport::Concern
included do
field :see_type, type: String, default: 'normal'
field :seen, type: Hash, default: {}
permit_params :see_type
end
def seen_at(user)
self.seen[user.id.to_s].try { |time| time.in_time_zone }
end
def seen?(user)
!unseen?... | 20.105263 | 93 | 0.658813 |
9167c4ce180e8c60e20c8bc1c7780f26470f1251 | 254 | # frozen_string_literal: true
module Sail
class ApplicationController < ActionController::Base # :nodoc:
protect_from_forgery with: :exception
protected
def current_user
main_app.scope.request.env["warden"]&.user
end
end
end
| 18.142857 | 64 | 0.728346 |
f8a18e9d38dbf874ed323581002bb163d90968f7 | 2,957 | # frozen_string_literal: true
# Copyright (c) 2018 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limitation the rights
# to use, co... | 32.494505 | 88 | 0.701725 |
6a7e5b55dfab882a17072d8fdea822eb36c18913 | 143 | class ChangePublisherNameFieldToNotNull < ActiveRecord::Migration[7.1]
def change
change_column_null :publishers, :name, false
end
end
| 23.833333 | 70 | 0.79021 |
6acea90197dd5c44f00d3419878fb95cb53453c3 | 362 | # frozen_string_literal: true
class ConfirmationsController < ApplicationController
def show
user = User.confirm_by_token(params[:confirmation_token])
if user.errors.empty?
redirect_to sign_in_path, notice: t("messages.confirmations.confirmed")
else
redirect_to root_path, alert: t("messages.... | 25.857143 | 77 | 0.754144 |
ab5c634ead501bba112fb8b851951c18ed5d2c38 | 602 | # frozen_string_literal: true
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"
ActiveRecord::Migration.maintain_test_schema!
Dir["./spec/support/*.rb... | 26.173913 | 86 | 0.777409 |
91d738c5228b6bf4b94c54c6d63d214ce783fe5a | 1,636 | #! /usr/bin/env ruby
require 'spec_helper'
require 'puppet/provider/confine/false'
describe Puppet::Provider::Confine::False do
it "should be named :false" do
Puppet::Provider::Confine::False.name.should == :false
end
it "should require a value" do
lambda { Puppet::Provider::Confine.new }.should raise_... | 30.867925 | 94 | 0.668704 |
61b5a03e4c9070b33b2236fa15ae8ce374e7e6ec | 775 | #!/usr/bin/env ruby
# frozen_string_literal: true
$LOAD_PATH.unshift('./lib')
require 'binance'
require 'eventmachine'
require_relative '../../common'
logger = Common.setup_logger
client = Binance::Spot::WebSocket.new
EM.run do
onopen = proc { logger.info('connected to server') }
onmessage = proc { |msg, _type... | 23.484848 | 94 | 0.700645 |
113438055a6daaeeb86bddaee86255dacddca9a8 | 1,435 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-cloudfr... | 26.090909 | 85 | 0.75122 |
796812794b55b855d3103bbcb581d40bc7330c8b | 59 | module YouTube
class HTTPError < StandardError
end
end
| 11.8 | 33 | 0.779661 |
bbb3aeb21c9fb445d29f9a26b938db2f9674eb96 | 489 | # use when click to activation link in email
class AccountActivationsController < ApplicationController
def edit
user = User.find_by email: params[:email]
if user && !user.activated? && user.authenticated?(:activation, params[:id])
user.activate
log_in user
flash[:success] = t "controller.ac... | 30.5625 | 80 | 0.703476 |
1c0e3c3e7cdd3132cfc0683f21335181b2843532 | 311 | #!/usr/bin/env ruby
#
# make sure the namespace is created
#
module Rex
module Encoding
module Xor
end end end
#
# include the Xor encodings
#
require 'rex/encoding/xor/generic'
require 'rex/encoding/xor/byte'
require 'rex/encoding/xor/word'
require 'rex/encoding/xor/dword'
require 'rex/encoding/xor/qword' | 15.55 | 36 | 0.755627 |
7aa768b52251f57b1e3cfe1c91f163257afbbf81 | 240 | # frozen_string_literal: true
require "test_helper"
class RuberDialogTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::RuberDialog::VERSION
end
def test_it_does_something_useful
assert true
end
end
| 17.142857 | 39 | 0.791667 |
28fbdde6b327058bc4d0ffcb9bc521a8f90a7cd5 | 984 | class GstEditingServices < Formula
desc "GStreamer Editing Services"
homepage "https://gstreamer.freedesktop.org/modules/gst-editing-services.html"
url "https://gstreamer.freedesktop.org/src/gst-editing-services/gstreamer-editing-services-1.14.0.tar.xz"
sha256 "8d5f90eb532f4cf4aa1466807ef92b05bd1705970d7aabe100... | 33.931034 | 107 | 0.72561 |
ed04ba2da8c60ae26d4b0d3306bb6aed3af5022d | 1,394 | # Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | 39.828571 | 81 | 0.645624 |
bf36b1d42372e5d191ec4401b011040f85c42fb4 | 880 | $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
require 'chargify_api_ares'
# You could load your credentials from a file...
chargify_config = YAML::load_file(File.join(File.dirname(__FILE__), '..', 'chargify.yml'))
Chargify.configure do |c|
c.subdomain = chargify_config['subdomain']
c.api_key = cha... | 23.783784 | 90 | 0.760227 |
617eb288692c7096d817d806e094af405e094e50 | 6,694 | require 'forwardable'
require 'typhoeus'
require 'filemaker/configuration'
module Filemaker
class Server
extend Forwardable
# @return [Filemaker::Store::DatabaseStore] the database store
attr_reader :databases
alias database databases
alias db databases
def_delegators :@config, :host, :url,... | 29.883929 | 80 | 0.578428 |
d52e651d17ef740eaa4d2ba856dea2b7eaea727f | 1,465 | # encoding: utf-8
require_relative "../spec_helper"
require "logstash/outputs/s3"
require "logstash/codecs/line"
require "stud/temporary"
describe "Upload current file on shutdown", :integration => true do
include_context "setup plugin"
let(:options) { main_options }
let(:size_file) { 1000000 }
let(:time_file... | 28.173077 | 140 | 0.685324 |
ff7525438fdec53132eb1a45ffa176bab6fa80b9 | 206 | require File.expand_path('../fixtures/classes', __FILE__)
describe "Singleton#clone" do
it "is prevented" do
lambda { SingletonSpecs::MyClass.instance.clone }.should raise_error(TypeError)
end
end
| 25.75 | 83 | 0.757282 |
f800ccdf3fd321b75aeacda8aa8aa89f25496099 | 1,415 | class AddProduct < ActiveRecord::Migration[6.0]
def change
Product.create :title => "Ассам цветок весны",
:description => "Полностью ферментированный индийский черный чай из крупных цельных листьев. Рекомендован к употреблению в первой половине дня - бодрит и тонизирует. Сочетается с молоком и сахаром.",
:pr... | 42.878788 | 275 | 0.725088 |
3361a823e885a609b1c0d650956b822f38c6c23c | 73 | # frozen_string_literal: true
module Kubo
VERSION = "0.0.2.pre.1"
end
| 12.166667 | 29 | 0.712329 |
6a8fd883b9a7e028e44d79b1ffbeb945fb8f389f | 1,323 | require_relative '../../version2_0'
require_relative '../../relationship'
module BELParser
module Language
module Version2_0
module Relationships
# PrognosticBiomarkerFor: +A prognosticBiomarkerFor P+ -
# For term A and process term P, +A prognosticBiomarkerFor P+
# indicates that ... | 25.941176 | 73 | 0.61678 |
18435476c3d810d6e623703235a66b813e853260 | 67 | class <%= class_name %> < ActiveRecord::Base
acts_as_executor
end | 22.333333 | 44 | 0.746269 |
08a3bf3337bf96c458d288f174d2c9ed56b07162 | 183 | require "great_pretender/config"
require "great_pretender/controller"
require "great_pretender/version"
module GreatPretender
end
require "great_pretender/engine" if defined? Rails
| 20.333333 | 50 | 0.84153 |
e871980df0b6d8de51c307726009e8a961275d7a | 347 | # frozen_string_literal: true
class FakeUserModel
def self.finder
end
end
class FakeController
include Keycard::ControllerMethods
attr_reader :request, :notary, :session
def initialize(request, session, notary)
@request = request
@session = session
@notary = notary
end
def reset_session
... | 15.086957 | 42 | 0.729107 |
ac8cd8a41b8974d3f0ab790d39cee1a1892d46e0 | 1,373 | module Pixiebox
class System
include Utils::Visitable
include Utils::Output
attr_reader :os
def initialize(os)
@os = os
end
def install
accept(Commands::StartInstall.new)
accept(Commands::GetRootPermission.new)
accept(Commands::DownloadDocker.new)
accept(Comman... | 19.614286 | 48 | 0.644574 |
1d10a0936fc757999953f932a5e0b1a21c1d7943 | 640 | cask 'zalo' do
version '19.7.1a'
sha256 '04c6734460039851cda69eb9ed9d79bfa57f9e225a8249af88b7b36dfa80080f'
# res-download-pc-te-vnno-zn-3.zadn.vn/mac was verified as official when first introduced to the cask
url "https://res-download-pc-te-vnno-zn-3.zadn.vn/mac/ZaloSetup-#{version}.dmg"
name 'Zalo'
homepa... | 33.684211 | 103 | 0.654688 |
e2eed2ee41b216160fc3bfa043ee09a8772904a8 | 38,778 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 39.97732 | 206 | 0.720718 |
031326d5bdca7fdb4b9ea5f32d45c68204aa727f | 10,962 | require 'csv'
class ResponseLoader
def load_categories
puts 'start'
measures = JSON.parse(File.read(File.expand_path('../../../data/measures.json', __FILE__)))
puts "Loaded #{measures.length} measures"
measures.each_with_index do |measure, index|
category = Category.create(
name: measur... | 36.909091 | 212 | 0.582284 |
4afdbeaa10152b824ac89ae6183663cde91655ca | 25,195 | # frozen_string_literal: true
# Namespace for classes and modules that handle PHI Attribute Access Logging
module PhiAttrs
# Module for extending ActiveRecord models to handle PHI access logging
# and restrict access to attributes.
#
# @author Apsis Labs
# @since 0.1.0
module PhiRecord
extend ActiveSup... | 34.372442 | 160 | 0.646557 |
7a6c5f422f597cf8a2e2c9652ccc6f0bb0f526ee | 184 | class AddCachedVotesColumnToSite < ActiveRecord::Migration
def change
add_column :sites, :cached_votes_up, :integer, default: 0
add_index :sites, :cached_votes_up
end
end
| 26.285714 | 61 | 0.766304 |
1a5bcf6426d712e69f746f81b33b9bb56be9016d | 2,044 | #
# = Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
#
# Category:: Net
# Package:: Whois
# Author:: Simone Carletti <weppos@weppos.net>
# License:: MIT License
#
#--
#
#++
require 'whois/answer/parser/base'
module Whois
class Answer
class Parser
#
# = whois.ni... | 23.227273 | 81 | 0.557241 |
ab21084733c6ce746cbc6b5f7e0f3581febab5b5 | 20,892 | # frozen_string_literal: true
require_relative "helper"
require "openssl"
require "securerandom"
describe "Dalli" do
describe "options parsing" do
it "handle deprecated options" do
dc = Dalli::Client.new("foo", compression: true)
assert dc.instance_variable_get(:@options)[:compress]
refute dc.... | 27.967871 | 96 | 0.572564 |
bf28f3bd677144ef250dfa02e89cd427b093447c | 1,421 | require_relative 'modules/dbhandler'
class App < Sinatra::Base
register Sinatra::Reloader
get '/test' do
File.read(File.join('public', 'testing.html'))
end
post '/test' do
redirect '/test'
end
get '/api/users' do
DBhandler.get("users", "name")
end
post... | 17.54321 | 85 | 0.530612 |
91e07edfb6634143713fd7277e8360e25efe7ff0 | 1,731 | module WebMock
class RequestExecutionVerifier
attr_accessor :request_pattern, :expected_times_executed, :times_executed
def initialize(request_pattern = nil, expected_times_executed = nil)
@request_pattern = request_pattern
@expected_times_executed = expected_times_executed
end
def matc... | 30.368421 | 151 | 0.69844 |
5d404e32c4b74f557a69950efd8efa6e03af5312 | 500 |
require 'etc'
module Enkaironment
module EtcMethods
# test if system user exists
# @param username [String|Integer] the UID or login name of a user
# @return [Boolean]
def user_exists?(username)
# @see https://github.com/rubocop-hq/rubocop/issues/3344
# rubocop:disable Style/DoubleNegatio... | 26.315789 | 77 | 0.684 |
bb1d2db54ddfaf9e772a7f75ebbdc883774b1e96 | 924 | class Clearance::SessionsController < ApplicationController
skip_before_filter :authorize, :only => [:create, :new, :destroy]
protect_from_forgery :except => :create
def create
@user = authenticate(params)
if @user.nil?
flash_failure_after_create
render :template => 'sessions/new', :status =... | 22 | 93 | 0.707792 |
f86965419f21fddb7426df3ed1ff4ae7fb09c3de | 4,275 | module Switchman
module ActiveRecord
module Relation
def self.prepended(klass)
klass::SINGLE_VALUE_METHODS.concat [ :shard, :shard_source ]
end
def initialize(*args)
super
self.shard_value = Shard.current(klass ? klass.shard_category : :primary) unless shard_value
... | 36.853448 | 143 | 0.633684 |
1160defd51faef8457d0a938662dbfd635b71042 | 218 | # Copyright (c) Universidade Federal Fluminense (UFF).
# This file is part of SAPOS. Please, consult the license terms in the LICENSE file.
ActiveModel::Type.register(:text, ActiveRecord::Type::Text, override: false)
| 43.6 | 84 | 0.766055 |
f8223d2daba9fcd9e0ace7bc9cc243b73f0d5134 | 11,416 | require 'spec_helper'
describe 'python' do
on_supported_os.each do |os, facts|
next if os == 'gentoo-3-x86_64'
context "on #{os}" do
let :facts do
facts
end
context 'with defaults' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('pyt... | 35.018405 | 97 | 0.507708 |
38d135d9f386689c1bbbd10af8db4e4573e4f3cf | 1,895 | module PageSerializer
class SearchPage < PageSerializer::BasePageSerializer
# Initialise a Search index page serializer.
#
# @param [ActionDispatch::Request] request the current request object.
# @param [String] opensearch_description_url a description url for the search.
# @param [String] query a... | 41.195652 | 168 | 0.743536 |
28f1cfc97cb683f0e0240c350161c703482279c4 | 4,323 | require "#{File.dirname(__FILE__)}/../abstract_unit"
require "fixtures/person"
require "fixtures/street_address"
module Highrise
class Note < ActiveResource::Base
self.site = "http://37s.sunrise.i:3000"
end
class Comment < ActiveResource::Base
self.site = "http://37s.sunrise.i:3000"
end
end
class Ba... | 38.945946 | 93 | 0.718714 |
d57e14496097360d12d819418db9706c17261875 | 5,002 | =begin
#Selling Partner APIs for Fulfillment Outbound
#The Selling Partner API for Fulfillment Outbound lets you create applications that help a seller fulfill Multi-Channel Fulfillment orders using their inventory in Amazon's fulfillment network. You can get information on both potential and existing fulfillment orde... | 44.660714 | 268 | 0.748501 |
abf835860776b8aef817ebda9fa42aeee0a50176 | 154 | class VisitSerializer < ActiveModel::Serializer
attributes :id, :city_rating, :avatar, :user_id, :avatar_url
belongs_to :user
belongs_to :city
end
| 22 | 62 | 0.766234 |
bf025a4c3c093b293785d526e6ece1a3b668a19f | 1,590 | require "rails_helper"
describe CompositeRatingTierFactorSet do
let(:validation_errors) {
subject.valid?
subject.errors
}
it "requires a carrier profile" do
expect(validation_errors.has_key?(:carrier_profile_id)).to be_truthy
end
it "requires a default factor value" do
expect(validation_e... | 22.394366 | 76 | 0.697484 |
f7c3cf748f9a33d386ae56a3dd2f69358be76a46 | 1,094 | # frozen_string_literal: true
module EE
module Sidebars
module Projects
module Panel
extend ::Gitlab::Utils::Override
override :configure_menus
def configure_menus
super
insert_menu_before(::Sidebars::Projects::Menus::ProjectInformationMenu,
... | 29.567568 | 163 | 0.63894 |
ffdc8b0c67f4b70e72caab64b338e5b138aaa297 | 411 | class EventTranslation < ActiveRecord::Base
attr_accessible :event_id, :name, :locale, :name_abbrv, :description
belongs_to :event
validates :name, :locale, :presence => true
# this will always call validation to fail due to the translations being
# created while the event is created. probably way to fix
# ... | 34.25 | 74 | 0.746959 |
d5a909625b9c6bf2ab4ed26395974357f7dccac3 | 774 | Pod::Spec.new do |s|
s.name = 'TOCropViewController'
s.version = '2.5.5'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'A view controller that enables cropping and rotation of UIImage objects.'
s.homepage = 'https://github.com/TimOliver/TOCropViewController'
s.author = 'Tim Oliver... | 45.529412 | 130 | 0.677003 |
5d9f09ff89f4994502a60f2216fc8fdd21edf3a2 | 43 | # typed: true
def bar; end;
/foo#{bar}baz/
| 10.75 | 14 | 0.627907 |
385d01007d2288b5d6f5111ad13f391bc21a0b84 | 960 | # frozen_string_literal: true
require 'test_helper'
module Users
class OperatorTest < ActiveSupport::TestCase
test 'creation works' do
operator = create(:operator)
user_operator = Users::Operator.create(first_name: 'Martin',
last_name: 'Fourcade',
... | 35.555556 | 77 | 0.569792 |
0390062a2435cc3a2200e3b6c3f471de083ffd8c | 13,012 | assert_equal %q{[1, 2, 4, 5, 6, 7, 8]}, %q{$a = []; begin; ; $a << 1
[1,2].each{; $a << 2
break; $a << 3
}; $a << 4
begin; $a << 5
ensure; $a << 6
end; $a << 7
; $a << 8
; rescue Exception; $a << 99; end; $a}
assert_equal %q{[1, 2, 3, 5, 6, 7, 8]}, %q{$a = []; begin; ; $a << 1
begin; $a << 2
[1,2]... | 21.97973 | 280 | 0.40747 |
1c813f7215944ec6871e7536de36774cd3b5d9f3 | 3,061 | #
# Author:: Trevor O (<trevoro@joyent.com>)
# Copyright:: Copyright (c) 2009-2016 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
... | 28.082569 | 110 | 0.671023 |
01587c6a433be8498add2effade618da616b1e7d | 3,251 | require 'caramelize/input_wiki/wiki'
require 'caramelize/filters/swap_wiki_links'
require 'caramelize/filters/remove_table_tab_line_endings'
module Caramelize
module InputWiki
class RedmineWiki < Wiki
include DatabaseConnector
def initialize(options = {})
super(options)
@options[:mar... | 26.867769 | 93 | 0.579514 |
1d1224c456e02a7129ee033e931baf4f1cc0b069 | 2,654 | require 'fixtures/controllers'
require 'rspec/rails'
describe FakeController, type: :controller do
describe "type coercion" do
it "coerces to integer" do
get :index, page: "666"
expect(controller.params[:page]).to eql(666)
end
end
describe "nested_hash" do
it "validates nested propertie... | 30.159091 | 106 | 0.585531 |
acf439d876b943e04a280a4f917d297746cae1af | 1,396 | require 'RMagick'
require 'ruby3d/core/settings'
module Ruby3d::Assets
class Texture
attr_accessor :file_name
attr_accessor :id
attr_accessor :width
attr_accessor :height
attr_accessor :texture_id
def initialize(file_name)
@assets_config = Ruby3d::Core::Settings::Settings.instance.asse... | 36.736842 | 105 | 0.704155 |
bb6ec285d528eacc706c850035e4cf125fad76cf | 2,470 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with this
# work for additional information regarding copyright ownership. The ASF
# licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use t... | 32.933333 | 102 | 0.665992 |
2680f3e764b094571478c6d8e16a9ed293d1603b | 1,749 | require File.expand_path('../lib/avatax/version', __FILE__)
Gem::Specification.new do |s|
s.add_development_dependency('rake', '~> 12.0.0')
s.add_development_dependency('rspec', '~> 3.5.0')
s.add_development_dependency('webmock', '>= 2.0.0')
s.add_development_dependency('pry')
s.add_runtime_dependency('farad... | 42.658537 | 109 | 0.619211 |
1a8c987ce0f162959d6a84a5325542a2b17b4747 | 714 | require 'test_helper'
class MicropostTest < ActiveSupport::TestCase
def setup
@user = users(:michael)
@micropost = @user.microposts.build(content: "Lorem ipsum")
end
test "should be valid" do
assert @micropost.valid?
end
test "user id should be present" do
@micropost.user_id = nil
asse... | 20.4 | 63 | 0.684874 |
3322a421dbfd67ea32cd1b36825d715438df6368 | 107 | Rails.application.routes.draw do
mount StimulusReflexProfiler::Engine => "/stimulus_reflex_profiler"
end
| 26.75 | 69 | 0.82243 |
f8d0bdda9b091453a17387883c397e78f4aea654 | 8,735 | # -----------------------------------------------------------------------------
#
# Common tests for geometry collection implementations
#
# -----------------------------------------------------------------------------
require 'rgeo'
module RGeo
module Tests # :nodoc:
module Common # :nodoc:
module Ge... | 32.232472 | 101 | 0.587293 |
79110358ac6401c98bca082ee70d72d46b7a0076 | 2,094 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 35.491525 | 85 | 0.7617 |
acdd68ab009eafba42582e261f6eac98f16f82c1 | 2,548 | # -*- encoding: utf-8 -*-
# stub: dnsruby 1.61.3 ruby lib
Gem::Specification.new do |s|
s.name = "dnsruby".freeze
s.version = "1.61.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Alex Dalitz".fr... | 50.96 | 238 | 0.681319 |
bbdef324e989f0a92df7834ba974c34d893550c5 | 4,718 | ##
# $Id: bakbone_netvault_heap.rb 10394 2010-09-20 08:06:27Z jduck $
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.... | 28.768293 | 84 | 0.60195 |
abed0c36ea77ddd6e0cc0bf7dcc91975b4bfef5f | 187 | module Graviga
module Types
class IDType < ScalarType
def serialize(value)
value.to_s
end
def parse(value)
value.to_s
end
end
end
end
| 13.357143 | 29 | 0.57754 |
f79b5740be097d69dac4da54b68627c34e2cd47f | 1,289 | class AddOriginalLanguageIdToEtymologies < ActiveRecord::Migration
def self.up
add_column :etymologies, :original_language_id, :integer
say_with_time "Associating Languages with Etymologies..." do
etyma = Etymology.find(:all, :select => :source_language)
etyma.collect(&:source_language).... | 31.439024 | 108 | 0.648565 |
ab563558a577f1ec744ee8859eea3131ac59aae0 | 523 | cask "kodi" do
version "18.7-Leia"
sha256 "88822a1a4aa3dba8959cf84a49fb65ec2dd93ab08fc38467bd8af927707ba153"
url "https://mirrors.kodi.tv/releases/osx/x86_64/kodi-#{version}-x86_64.dmg"
appcast "https://github.com/xbmc/xbmc/releases.atom"
name "Kodi"
homepage "https://kodi.tv/"
app "Kodi.app"
zap tra... | 26.15 | 78 | 0.692161 |
01689dec6e2a698feed51a018ccfba6d92f95ded | 1,576 | class GnuTime < Formula
desc "GNU implementation of time utility"
homepage "https://www.gnu.org/software/time/"
url "https://ftpmirror.gnu.org/time/time-1.7.tar.gz"
mirror "https://ftp.gnu.org/gnu/time/time-1.7.tar.gz"
sha256 "e37ea79a253bf85a85ada2f7c632c14e481a5fd262a362f6f4fd58e68601496d"
bottle do
... | 28.142857 | 99 | 0.708122 |
bbfbf90ba04ea945260a07c34fed272dc844ca52 | 398 | module Outpost
module Secretary
module UserInjection
extend ActiveSupport::Concern
included do
before_filter :add_user_id_to_params, only: [:create, :update]
end
private
def add_user_id_to_params
if model.has_secretary?
params[model.singular_route_key].me... | 19.9 | 82 | 0.663317 |
613c78a2503e6889c8cddd755a54014ecfa9672b | 3,682 | class Luabind < Formula
desc "Library for bindings between C++ and Lua"
homepage "https://github.com/luabind/luabind"
url "https://downloads.sourceforge.net/project/luabind/luabind/0.9.1/luabind-0.9.1.tar.gz"
sha256 "80de5e04918678dd8e6dac3b22a34b3247f74bf744c719bae21faaa49649aaae"
license "MIT"
revision 2
... | 34.411215 | 137 | 0.695274 |
874401c65beb2089a5a4349d0781ddb19b2cc228 | 530 | require File.expand_path('../../../spec_helper', __FILE__)
ruby_version_is "1.9" do
describe "Fixnum#odd?" do
it "is false for zero" do
0.odd?.should be_false
end
it "is false for even positive Fixnums" do
4.odd?.should be_false
end
it "is false for even negative Fixnums" do
(... | 20.384615 | 58 | 0.630189 |
871ed314cd38f09fe42bad7f37a728344c664815 | 5,516 | # frozen_string_literal: true
require 'spec_helper'
require 'bolt/transport/local'
require 'bolt/target'
require 'bolt/inventory'
require 'bolt/util'
require 'bolt_spec/transport'
require 'bolt_spec/conn'
require 'shared_examples/transport'
describe Bolt::Transport::Local do
include BoltSpec::Transport
let(:tra... | 32.447059 | 113 | 0.59826 |
3918e35e952ce0d4206e3898a16f7918106a3a55 | 201 | # frozen_string_literal: true
class AgendasController < ApplicationController
def show
@rooms = Room.all
@days = AgendaDay.all.includes(times: { agendas: %i[room speakers tags] })
end
end
| 22.333333 | 78 | 0.726368 |
62562546851844eea8b98f1718dd36dd6c45ddc3 | 565 | require File.expand_path('spec/spec_helper')
require 'colored2/object'
subject1 = red('hello')
subject2 = red('blue').on.blue
subject3 = on.yellow('on yellow')
RSpec.describe Object do
describe 'with foreground and background colors' do
it 'should work with one color' do
expect(subject1).to eql('hello'.r... | 22.6 | 56 | 0.688496 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.